### Install taurus_pyqtgraph Source: https://gitlab.com/taurus-org/taurus/-/blob/develop/doc/how_to_release.md Install the taurus_pyqtgraph library using pip. ```bash pip install taurus_pyqtgraph ``` -------------------------------- ### Install Documentation Building Dependencies for Develop Mode Source: https://gitlab.com/taurus-org/taurus/-/blob/develop/doc/source/users/getting_started.md Installs Sphinx and related themes/tools for building Taurus documentation in develop mode. ```bash conda install -c conda-forge sphinx sphinx_rtd_theme graphviz ``` -------------------------------- ### Install taurus_pyqtgraph with Archiving Source: https://gitlab.com/taurus-org/taurus/-/blob/develop/doc/how_to_release.md Install the taurus_pyqtgraph library with Archiving support using pip. Ensure pyhdbpp is installed alongside. ```bash pip install taurus_pyqtgraph[Archiving] ``` -------------------------------- ### start() Source: https://gitlab.com/taurus-org/taurus/-/blob/develop/doc/source/devel/api/taurus.core.util.timer-Timer.md Starts the Timer object, initiating the scheduled execution of the associated function. ```APIDOC ## start() ### Description Starts the Timer object. This will begin the scheduled execution of the function provided during initialization. ### Method ``` start() ``` ``` -------------------------------- ### CodecFactory and Codec Pipeline Example Source: https://gitlab.com/taurus-org/taurus/-/blob/develop/doc/source/devel/api/taurus.core.util.codecs.md Demonstrates using CodecFactory to get JSON and BZ2_JSON codecs, encoding and decoding data, and comparing the sizes of encoded data. ```python >>> from taurus.core.util.codecs import CodecFactory >>> cf = CodecFactory() >>> json_codec = cf.getCodec('json') >>> bz2_json_codec = cf.getCodec('bz2_json') >>> data = range(100000) >>> f1, enc_d1 = json_codec.encode(('', data)) >>> f2, enc_d2 = bz2_json_codec.encode(('', data)) >>> print(len(enc_d1), len(enc_d2)) 688890 123511 >>> >>> f1, dec_d1 = json_codec.decode((f1, enc_d1)) >>> f2, dec_d2 = bz2_json_codec.decode((f2, enc_d2)) ``` -------------------------------- ### Get Help for TaurusDevicePanel Command Source: https://gitlab.com/taurus-org/taurus/-/blob/develop/doc/source/users/ui/devpanels.md Run this command to view detailed help and options for launching the TaurusDevicePanel. ```bash taurus dev --help ``` -------------------------------- ### Taurus Application Footer Source: https://gitlab.com/taurus-org/taurus/-/blob/develop/doc/source/devel/examples.md This code is required to be appended to most examples to display the GUI panel and start the application event loop. ```python panel.show() sys.exit(app.exec_()) ``` -------------------------------- ### Get Help for Taurus Configuration Browser Source: https://gitlab.com/taurus-org/taurus/-/blob/develop/doc/source/users/ui/configurations.md Run this command to display help information for the taurus config application. ```bash taurus config --help ``` -------------------------------- ### Install Basic Dependencies for Develop Mode Source: https://gitlab.com/taurus-org/taurus/-/blob/develop/doc/source/users/getting_started.md Installs basic dependencies like python, click, numpy, pint, pyqt, lxml, plotpy, and pyqtgraph for working with Taurus in develop mode using conda. ```bash conda install -c conda-forge python=3 click numpy pint pyqt ply lxml plotpy pyqtgraph ``` -------------------------------- ### Configuring Qt Logging Initialization Source: https://gitlab.com/taurus-org/taurus/-/blob/develop/doc/source/devel/tauruscustomsettings.md Example of configuring automatic Qt logging initialization. Set to True to automatically initialize Qt logging with Python logging. ```python QT_AUTO_INIT_LOG = True ``` -------------------------------- ### CircBuf Initialization and Usage Example Source: https://gitlab.com/taurus-org/taurus/-/blob/develop/doc/source/devel/api/taurus.core.util.containers-CircBuf.md Demonstrates how to initialize a CircBuf, add items, check its state (empty/full), and retrieve items. The buffer has a fixed capacity. ```python >>> cb = CircBuf(3) >>> cb.is_empty() 1 >>> cb.put('first') >>> cb.is_empty() 0 >>> cb.put('second') >>> cb.put('third') >>> cb.is_full() 1 >>> cb.put('fourth') >>> cb.get() 'second' >>> cb.get() 'third' >>> cb.get() 'fourth' >>> cb.is_empty() 1 ``` -------------------------------- ### Test Taurus Installation Source: https://gitlab.com/taurus-org/taurus/-/blob/develop/doc/source/users/getting_started.md Verify your Taurus installation by checking its version. This command imports the taurus library and prints the release version. ```python python -c "import taurus; print(taurus.Release.version)" ``` -------------------------------- ### Get Help for TaurusForm Standalone Application Source: https://gitlab.com/taurus-org/taurus/-/blob/develop/doc/source/users/ui/forms.md Run this command to view detailed help and available options for the TaurusForm standalone application. ```bash taurus form --help ``` -------------------------------- ### Tango Device Model Name Examples Source: https://gitlab.com/taurus-org/taurus/-/blob/develop/doc/source/devel/core_tutorial.md Examples of full and abbreviated model names for Tango devices, considering default schemes and aliases. ```text tango://machine:10000/sys/tg_test/1 ``` ```text tgtest1 ``` -------------------------------- ### Install Extra Dependencies for Develop Mode Source: https://gitlab.com/taurus-org/taurus/-/blob/develop/doc/source/users/getting_started.md Installs additional dependencies such as pytango, pyepics, spyder, and pymca for Taurus development. Select the ones you need. ```bash conda install -c conda-forge pytango pyepics spyder pymca ``` -------------------------------- ### Install Taurus from Source Tarball Source: https://gitlab.com/taurus-org/taurus/-/blob/develop/doc/how_to_release.md Install Taurus using pip after obtaining the source distribution tarball. This is typically done by downloading the artifacts.zip from a CI/CD pipeline. ```bash pip install ``` -------------------------------- ### CodecPipeline Encoding and Decoding Example Source: https://gitlab.com/taurus-org/taurus/-/blob/develop/doc/source/devel/api/taurus.core.util.codecs-CodecPipeline.md Demonstrates how to use CodecPipeline to encode a range of data and then decode it back. Ensure taurus.core.util.codecs is imported. ```python >>> from taurus.core.util.codecs import CodecPipeline >>> data = range(100000) >>> codec = CodecPipeline('bz2_json') >>> format, encoded_data = codec.encode(("", data)) # decode it format, decoded_data = codec.decode((format, encoded_data)) print(decoded_data) ``` -------------------------------- ### Get Help for TaurusPanel Command Source: https://gitlab.com/taurus-org/taurus/-/blob/develop/doc/source/users/ui/devpanels.md Execute this command to display comprehensive help information for the TaurusPanel launch command. ```bash taurus panel --help ``` -------------------------------- ### Enabling Lightweight Imports Source: https://gitlab.com/taurus-org/taurus/-/blob/develop/doc/source/devel/tauruscustomsettings.md Example of enabling lightweight imports. Set to True for delayed imports, which may break older code. ```python LIGHTWEIGHT_IMPORTS = True ``` -------------------------------- ### Get CodecFactory Singleton Instance Source: https://gitlab.com/taurus-org/taurus/-/blob/develop/doc/source/devel/api/taurus.core.util.codecs-CodecFactory.md Instantiate the singleton CodecFactory to manage codecs. ```python from taurus.core.util.codecs import CodecFactory f = CodecFactory() ``` -------------------------------- ### Taurus External Qt API Example Source: https://gitlab.com/taurus-org/taurus/-/blob/develop/doc/source/tep/TEP18.md Demonstrates the usage of taurus.external.qt with Qt5 style and PyQt4 bindings. Note that QtGui.QGuiApplication is not supported in this configuration, while QtWidgets.QLabel is. ```python import sys from taurus import tauruscustomsettings tauruscustomsettings.DEFAULT_QT_API = 'pyqt' from taurus.external.qt import Qt, QtGui, QtCore, QtWidgets from taurus.qt.qtgui.display import TaurusLabel g = QtGui.QGuiApplication(sys.argv) # <-- this is Qt5 style and not supported a = Qt.QApplication(sys.argv) o = QtCore.QObject() w = QtWidgets.QLabel() # <-- this is Qt5 style but is supported l = TaurusLabel() ``` -------------------------------- ### Setting Custom Organization Logo Source: https://gitlab.com/taurus-org/taurus/-/blob/develop/doc/source/devel/tauruscustomsettings.md Example of setting a custom organization logo. Provide the absolute path to an image file or a Qt registered path. ```python ORGANIZATION_LOGO = 'logos:taurus.png' ``` -------------------------------- ### Example of URI with Fragment for Data Slicing Source: https://gitlab.com/taurus-org/taurus/-/blob/develop/doc/source/tep/TEP15.md Illustrates a Taurus URI referencing a specific slice of data using fragment notation. This is the chosen implementation approach. ```text eval:arange(5)#rvalue[0:2] ``` -------------------------------- ### Taurus Device Unicity Example Source: https://gitlab.com/taurus-org/taurus/-/blob/develop/doc/source/devel/core_tutorial.md Demonstrates that Taurus returns the same object for identical device requests, ensuring model unicity. ```python >>> import taurus >>> sim1 = taurus.Device('sys/tg_test/1') >>> sim2 = taurus.Device('sys/tg_test/1') >>> print sim1 == sim2 True ``` -------------------------------- ### TaurusFirstRead.init Source: https://gitlab.com/taurus-org/taurus/-/blob/develop/doc/source/devel/api/taurus.core.taurusfirstread-TaurusFirstRead.md Initializes the internal state and starts the background reading thread. This method is intended to be called only once, during the first creation of the singleton instance. ```APIDOC ## init ### Description Initializes the internal state and starts the background reading thread. This method is intended to be called only once, during the first creation of the singleton instance. It sets up the task queue, control flags, and launches a daemon thread that continuously processes attribute read requests. It uses an internal _initialized flag to prevent repeated initialization in case the method is accidentally invoked more than once. ### Method Signature `init()` ``` -------------------------------- ### Advertising Entry Points with setuptools Source: https://gitlab.com/taurus-org/taurus/-/blob/develop/doc/source/tep/TEP13.md Defines how to advertise objects for Taurus entry point groups using the 'entry_points' argument in setuptools.setup(). ```python entry_points = { "taurus.core.schemes": [ "tango = taurus_tangoarchiving.tango:TangoScheme", ], "taurus.model_selector.items": [ "tango_archiving = taurus_tangoarchiving.model_selector:TangoArchivingModelChooser", ], } ``` -------------------------------- ### Get Help for TaurusImageDialog Command Source: https://gitlab.com/taurus-org/taurus/-/blob/develop/doc/source/users/ui/taurusimage.md Run this command to view the available options and usage details for the standalone TaurusImageDialog application. ```bash taurus image --help ``` -------------------------------- ### Encode and Decode Data with Utf8Codec Source: https://gitlab.com/taurus-org/taurus/-/blob/develop/doc/source/devel/api/taurus.core.util.codecs.md Shows how to use Utf8Codec in conjunction with other codecs (like zip_utf8_json) for encoding and decoding UTF-8 strings. The example is incomplete, showing only the setup and encoding part. ```python >>> from taurus.core.util.codecs import CodecFactory >>> cf = CodecFactory() >>> codec = cf.getCodec('zip_utf8_json') >>> >>> # first encode something >>> data = { 'hello' : 'world', 'goodbye' : 1000 } >>> format, encoded_data = codec.encode(("", data)) >>> >>> # now decode it >>> _, decoded_data = codec.decode((format, encoded_data)) >>> print(decoded_data) ``` -------------------------------- ### Import EvaluationDevice Source: https://gitlab.com/taurus-org/taurus/-/blob/develop/doc/source/devel/api/taurus.core.evaluation-EvaluationDevice.md Demonstrates how to import the EvaluationDevice class from the taurus.core.evaluation module. ```python from taurus.core.evaluation import EvaluationDevice ``` -------------------------------- ### ThreadDict Usage Example Source: https://gitlab.com/taurus-org/taurus/-/blob/develop/doc/source/devel/api/taurus.core.util.containers-ThreadDict.md Illustrates how to access and update values in a ThreadDict. Direct access to a key triggers a read operation, while assignment triggers a write operation. ```default a[2] equals to a[2]=read_method(2) a[2]=1 equals to a[2]=write_method(2,1) ``` -------------------------------- ### Get Help for Taurus Remote Log Monitor Source: https://gitlab.com/taurus-org/taurus/-/blob/develop/doc/source/users/ui/logs.md Run this command to view detailed help and available options for the Taurus Remote Log Monitor. ```bash taurusremotelogmonitor --help ``` -------------------------------- ### Instantiate and Verify TaurusManager Source: https://gitlab.com/taurus-org/taurus/-/blob/develop/doc/source/devel/api/taurus.core.taurusmanager.md Demonstrates how to import and create an instance of the TaurusManager. It also verifies that subsequent calls return the same singleton instance. ```python >>> import taurus.core.taurusmanager >>> manager = taurus.core.taurusmanager.TaurusManager() >>> print(manager == taurus.core.taurusmanager.TaurusManager()) True ``` -------------------------------- ### Install Taurus with pip Source: https://gitlab.com/taurus-org/taurus/-/blob/develop/doc/source/users/getting_started.md Use this command to install the latest release of Taurus via pip. This method is platform-independent. ```bash pip install taurus ``` -------------------------------- ### Install PyTango in Conda Environment Source: https://gitlab.com/taurus-org/taurus/-/blob/develop/doc/source/users/getting_started.md Optionally install PyTango in your conda environment. This is useful if you need to interact with a Tango controls system. ```bash conda install -c conda-forge pytango ``` -------------------------------- ### Implicit PyQt5 Binding with taurus.external.qt Source: https://gitlab.com/taurus-org/taurus/-/blob/develop/doc/source/tep/TEP18.md Demonstrates the common use of taurus.external.qt with implicit selection of PyQt5 binding by forcing PyQt5 import. Requires PyQt5 to be installed. ```python import sys import PyQt5.QtWidgets # force using PyQt5 from taurus.external.qt import Qt, QtGui, QtCore from taurus.qt.qtgui.display import TaurusLabel a = Qt.QApplication(sys.argv) o = QtCore.QObject() w = QtGui.QLabel() l = TaurusLabel() assert(QtGui.QLabel is PyQt5.QtWidgets.QLabel) ``` -------------------------------- ### Run Taurus Demo Application Source: https://gitlab.com/taurus-org/taurus/-/blob/develop/doc/how_to_release.md Execute the 'taurus demo' command to launch the demonstration application. Test all interactive elements and features within the demo. ```bash taurus demo ``` -------------------------------- ### Install Taurus on Debian-based Linux Source: https://gitlab.com/taurus-org/taurus/-/blob/develop/doc/source/users/getting_started.md Install Taurus and its dependencies on Debian-based systems using apt-get. This command requires root privileges. ```bash apt-get install python-taurus ``` -------------------------------- ### Using Theme and Custom Icons in Taurus Source: https://gitlab.com/taurus-org/taurus/-/blob/develop/doc/source/devel/icon_guide.md Demonstrates how to load icons from the system theme (e.g., 'document-open') and from Taurus's custom icon collections (e.g., 'actions:exit.svg'). Ensure `taurus.qt.qtgui` is imported to add custom icon paths. ```python from taurus.external.qt import Qt from taurus.qt.qtgui.application import TaurusApplication class MyGUI(Qt.QMainWindow): def __init__(self, parent=None): Qt.QMainWindow.__init__(self, parent) toolbar = self.addToolBar("Tools") # get icon from theme icon1 = Qt.QIcon.fromTheme("document-open") # get icon using prefix + filename icon2 = Qt.QIcon("actions:exit.svg") toolbar.addAction(icon1, "Open HDF5", self.open_file) toolbar.addAction(icon2, "Exit", self.close) def open_file(self): pass # do something if __name__ == "__main__": import sys app = TaurusApplication(cmd_line_parser=None) gui = MyGUI() gui.show() sys.exit(app.exec_()) ``` -------------------------------- ### LogIt with Arguments and Return Value Logging Source: https://gitlab.com/taurus-org/taurus/-/blob/develop/doc/source/devel/api/taurus.core.util.log-LogIt.md Shows how to use LogIt to log method entry with arguments and exit with the return value. Ensure 'showargs' and 'showret' are set to True. ```python from taurus.core.util.log import Logger, LogIt class Example(Logger): @LogIt(Logger.Debug, showargs=True, showret=True) def go(self, msg): msg = "Hello world",msg print(msg) return msg ``` -------------------------------- ### Install Taurus PyQtGraph in Develop Mode Source: https://gitlab.com/taurus-org/taurus/-/blob/develop/doc/source/users/getting_started.md Clones the taurus_pyqtgraph repository and installs it in editable mode using pip. This is for developing the PyQtGraph integration of Taurus. ```bash git clone https://gitlab.com/taurus-org/taurus_pyqtgraph.git pip install -e ./taurus_pyqtgraph ``` -------------------------------- ### Taurus Logger Usage with Manual Initialization Source: https://gitlab.com/taurus-org/taurus/-/blob/develop/doc/source/tep/TEP8.md Demonstrates manual initialization of the Taurus logger using `initLogger()`. This ensures the logger is set up before use. ```python #!/usr/bin/python # Code goes here ... import taurus taurus.initLogger() taurus.warning('asd') ``` -------------------------------- ### Install Code Style Checking Dependencies for Develop Mode Source: https://gitlab.com/taurus-org/taurus/-/blob/develop/doc/source/users/getting_started.md Installs pre-commit for automatic code style checking, useful for contributing to Taurus development. ```bash conda install -c conda-forge pre-commit ``` -------------------------------- ### Import EntryPointAlike Source: https://gitlab.com/taurus-org/taurus/-/blob/develop/doc/source/devel/api/taurus.core.util.plugin-EntryPointAlike.md Import the EntryPointAlike class from the taurus.core.util.plugin module. ```python from taurus.core.util.plugin import EntryPointAlike ``` -------------------------------- ### Check Installed Taurus Version Source: https://gitlab.com/taurus-org/taurus/-/blob/develop/doc/how_to_release.md Verify the installed Taurus version using the command-line interface. The version should match the one specified in the release file. ```bash taurus --version ``` -------------------------------- ### Get Taurus Device Source: https://gitlab.com/taurus-org/taurus/-/blob/develop/doc/source/devel/api/taurus.md Obtain a Taurus device object using its name. This function is a shortcut for accessing the TaurusManager and Factory to get the specified device. ```python import taurus.core.taurusmanager manager = taurus.core.taurusmanager.TaurusManager() factory = manager.getFactory() device = factory.getDevice(device_name) ``` -------------------------------- ### Create New GUI with Taurus Wizard Source: https://gitlab.com/taurus-org/taurus/-/blob/develop/doc/source/devel/taurusgui_newgui.md Use the 'taurus newgui' command to launch a wizard for creating a new TaurusGui-based GUI without manual coding. ```bash taurus newgui ``` -------------------------------- ### Install Taurus in a Conda Environment Source: https://gitlab.com/taurus-org/taurus/-/blob/develop/doc/source/users/getting_started.md Install Taurus and taurus_pyqtgraph in a conda environment using the conda-forge channel. It's recommended to create a dedicated environment for Taurus. ```bash conda install -c conda-forge taurus taurus_pyqtgraph ``` -------------------------------- ### PyQt5 Style and Binding with taurus.external.qt Source: https://gitlab.com/taurus-org/taurus/-/blob/develop/doc/source/tep/TEP18.md Demonstrates using taurus.external.qt with PyQt5 style and PyQt5 binding. This example explicitly sets the default Qt API and imports QtWidgets. ```python import sys from taurus import tauruscustomsettings tauruscustomsettings.DEFAULT_QT_API = 'pyqt5' from taurus.external.qt import Qt, QtGui, QtCore, QtWidgets from taurus.qt.qtgui.display import TaurusLabel g = QtGui.QGuiApplication(sys.argv) a = Qt.QApplication(sys.argv) o = QtCore.QObject() w = QtWidgets.QLabel() l = TaurusLabel() ``` -------------------------------- ### Import CaselessDefaultDict Source: https://gitlab.com/taurus-org/taurus/-/blob/develop/doc/source/devel/api/taurus.core.util.containers-CaselessDefaultDict.md Import the CaselessDefaultDict class from the taurus.core.util.containers module. ```default from taurus.core.util.containers import CaselessDefaultDict ``` -------------------------------- ### Tango Attribute Model Name Examples Source: https://gitlab.com/taurus-org/taurus/-/blob/develop/doc/source/devel/core_tutorial.md Examples of model names for Tango attributes, showing various ways to reference them with and without full device paths or aliases. ```text tango://machine:10000/sys/tg_test/1/double_scalar ``` ```text sys/tg_test/1/double_scalar ``` ```text tango:tgtest1/double_scalar ``` ```text tgtest1/double_scalar ``` -------------------------------- ### Object Class Initialization Utilities Source: https://gitlab.com/taurus-org/taurus/-/blob/develop/doc/source/devel/api/taurus.core.util.object-Object.md Provides methods for safely initializing Object subclasses, handling potential issues with multiple inheritance and compatibility with libraries like PyQt4. ```APIDOC ## Class Object Import from `taurus.core.util.object` as: ```python from taurus.core.util.object import Object ``` ### `call___init__(klass, *args, **kw)` #### Description Method to be called from subclasses to call superclass corresponding `__init__` method. This method ensures that classes from diamond like class hierarchies don’t call their super classes `__init__` more than once. ### Method `call___init__` ### Parameters - **klass** (type) - Description - **args** (type) - Description - **kw** (type) - Description ### `call___init__wo_kw(klass, *args)` #### Description Same as `call___init__` but without keyword arguments because PyQt4 does not support them. ### Method `call___init__wo_kw` ### Parameters - **klass** (type) - Description - **args** (type) - Description ### `getAttrDict()` #### Description Retrieves the attribute dictionary of the object. ### Method `getAttrDict` ### `updateAttrDict(other)` #### Description Updates the object's attribute dictionary with attributes from another dictionary or object. ### Method `updateAttrDict` ### Parameters - **other** (type) - Description ``` -------------------------------- ### Get Taurus Attribute by Full Name Source: https://gitlab.com/taurus-org/taurus/-/blob/develop/doc/source/devel/api/taurus.md Use this function to get a Taurus attribute when you have the full attribute name. It's a shortcut for directly accessing the TaurusManager and Factory. ```python import taurus.core.taurusmanager manager = taurus.core.taurusmanager.TaurusManager() factory = manager.getFactory() attribute = factory.getAttribute(full_attribute_name) ``` -------------------------------- ### Launch Taurus Form from Command Line Source: https://gitlab.com/taurus-org/taurus/-/blob/develop/doc/source/users/introduction.md This command-line example shows how to launch a Taurus form for a specific Tango device and its attributes without writing Python code. It navigates to the panel directory and uses the 'taurus form' command with device attributes. ```bash % cd taurus/qt/qtgui/panel % taurus form motor/icepap/01/state motor/icepap/01/position motor/icepap/01/velocity ``` -------------------------------- ### Install Taurus in Develop Mode Source: https://gitlab.com/taurus-org/taurus/-/blob/develop/doc/source/users/getting_started.md Clones the Taurus repository and installs it in editable mode using pip. This allows for direct changes to the Taurus source code without reinstallation. ```bash git clone https://gitlab.com/taurus-org/taurus.git pip install -e ./taurus ``` -------------------------------- ### Import TaurusConfigurationProxy Source: https://gitlab.com/taurus-org/taurus/-/blob/develop/doc/source/devel/api/taurus.core.taurusconfiguration-TaurusConfigurationProxy.md Import the TaurusConfigurationProxy class from the taurus.core.taurusconfiguration module. ```python from taurus.core.taurusconfiguration import TaurusConfigurationProxy ``` -------------------------------- ### Get Taurus Attribute by Device and Attribute Name Source: https://gitlab.com/taurus-org/taurus/-/blob/develop/doc/source/devel/api/taurus.md Use this function to get a Taurus attribute when you have the device name and the attribute name separately. It simplifies accessing attributes through the TaurusManager and Factory. ```python import taurus.core.taurusmanager manager = taurus.core.taurusmanager.TaurusManager() factory = manager.getFactory() device = factory.getDevice(device_name) attribute = device.getAttribute(attribute_name) ``` -------------------------------- ### Install Test Suite Dependencies for Develop Mode Source: https://gitlab.com/taurus-org/taurus/-/blob/develop/doc/source/users/getting_started.md Installs pytest and related plugins for running the Taurus test suite in develop mode. Includes pytest-qt, pytest-xvfb, pytest-forked, pytest-xdist, and flaky. ```bash conda install -c conda-forge pytest pytest-qt pytest-xvfb pytest-forked pytest-xdist flaky ``` -------------------------------- ### Using WarnIt as a Decorator Source: https://gitlab.com/taurus-org/taurus/-/blob/develop/doc/source/devel/api/taurus.core.util.log-WarnIt.md Demonstrates how to use the WarnIt decorator to log function arguments and return values at the warn level. Ensure Logger and WarnIt are imported. ```python from taurus.core.util.log import Logger, WarnIt class Example(Logger): @WarnIt() def go(self): print("Hello world") ``` -------------------------------- ### User-Implemented Class Example Source: https://gitlab.com/taurus-org/taurus/-/blob/develop/doc/source/tep/TEP20.md This example shows a potential issue in user-implemented classes that override methods internally called with the 'key' kwarg by TEP20 base classes. It highlights the need for compatibility adjustments. ```python class W(Qt.QWidget, TaurusBaseComponent): def getModelClass(self): return TaurusElementType.Attribute ``` -------------------------------- ### Instantiate EntryPointAlike Source: https://gitlab.com/taurus-org/taurus/-/blob/develop/doc/source/devel/api/taurus.core.util.plugin-EntryPointAlike.md Create an EntryPointAlike instance by wrapping an object. The name can be optionally provided; otherwise, the object's representation is used. ```python my_object = "some_value" wrapped_entry_point = EntryPointAlike(my_object, name="my_custom_name") # Or without a name: wrapped_entry_point_auto_name = EntryPointAlike(my_object) ``` -------------------------------- ### Tango Authority Name Validator Example Source: https://gitlab.com/taurus-org/taurus/-/blob/develop/doc/source/tep/TEP3.md Example validator class for Tango authority names, defining regex patterns for scheme, authority, host, and port. It specifies that path, query, and fragment are not used. ```python class TangoAuthorityNameValidator(TaurusAuthorityNameValidator): """Validator for Tango authority names. Apart from the standard named groups (scheme, authority, path, query and fragment), the following named groups are created: - host: tango host name, without port. - port: port number """ scheme = 'tango' authority = '//(?P([\w\-_]+\.)*[\w\-_]+):(?P\d{1,5})' path = '(?!)' query = '(?!)' fragment = '(?!)' ``` -------------------------------- ### Registering Taurus CLI Subcommands with Setuptools Source: https://gitlab.com/taurus-org/taurus/-/blob/develop/doc/source/tep/TEP13.md Use this code in your setup.py to register a Click-based command as a subcommand for the 'taurus' CLI. Ensure the 'taurus.cli.subcommands' entry point group is correctly specified. ```python import setuptools entry_points = {} ... entry_points["taurus.cli.subcommands"] = ["foo = foo_mod.cli:foo"] setuptools.setup( entry_points=entry_points, ... ) ``` -------------------------------- ### getLogName Source: https://gitlab.com/taurus-org/taurus/-/blob/develop/doc/source/devel/api/taurus-Logger.md Gets the log name for the current object. ```APIDOC ## getLogName ### Description Gets the log name for this object. ### Method Instance Method ### Returns - **str**: The log name. ``` -------------------------------- ### getLogFullName Source: https://gitlab.com/taurus-org/taurus/-/blob/develop/doc/source/devel/api/taurus-Logger.md Gets the full log name for the current object. ```APIDOC ## getLogFullName ### Description Gets the full log name for this object. ### Method Instance Method ### Returns - **str**: The full log name. ``` -------------------------------- ### Get Value by Key Source: https://gitlab.com/taurus-org/taurus/-/blob/develop/doc/source/devel/api/taurus.core.resource-ResourcesFactory.md Returns the value for a given key. ```python ResourcesFactory().getValue('some_key') ``` -------------------------------- ### Example of URI with Explicit Slice Function Source: https://gitlab.com/taurus-org/taurus/-/blob/develop/doc/source/tep/TEP15.md Demonstrates an alternative syntax for data slicing using an explicit '_slice' function within the URI fragment. This was not the selected implementation. ```text eval:arange(5)#_slice(0,2) ``` ```text eval:arange(5)#rvalue._slice(0,2) ``` -------------------------------- ### Importing WarnIt Source: https://gitlab.com/taurus-org/taurus/-/blob/develop/doc/source/devel/api/taurus.core.util.log-WarnIt.md Shows the necessary import statement for using the WarnIt class from the taurus.core.util.log module. ```python from taurus.core.util.log import WarnIt ``` -------------------------------- ### Importing ThreadDict Source: https://gitlab.com/taurus-org/taurus/-/blob/develop/doc/source/devel/api/taurus.core.util.containers-ThreadDict.md Shows the correct way to import the ThreadDict class from the taurus.core.util.containers module. ```default from taurus.core.util.containers import ThreadDict ``` -------------------------------- ### Get Attribute Type Source: https://gitlab.com/taurus-org/taurus/-/blob/develop/doc/source/devel/api/taurus.core.taurusattribute-TaurusAttribute.md Retrieves the data type of the attribute. Caching can be utilized. ```python attr_type = attribute.getType(cache=True) ``` -------------------------------- ### Import WriteAttrOperation Source: https://gitlab.com/taurus-org/taurus/-/blob/develop/doc/source/devel/api/taurus.core.taurusoperation-WriteAttrOperation.md Demonstrates how to import the WriteAttrOperation class from the taurus.core.taurusoperation module. ```python from taurus.core.taurusoperation import WriteAttrOperation ``` -------------------------------- ### Check taurus_pyqtgraph version Source: https://gitlab.com/taurus-org/taurus/-/blob/develop/doc/how_to_release.md Verify the installed version of taurus_pyqtgraph using a Python command. ```python python3 -c "import taurus_pyqtgraph; print(taurus_pyqtgraph.__version__)" ``` -------------------------------- ### Setting Plot Background Mode Source: https://gitlab.com/taurus-org/taurus/-/blob/develop/doc/source/devel/tauruscustomsettings.md Example of setting the plot background mode. Can be 'DARK' or 'LIGHT'. ```python PLOT_BACKGROUND_MODE = 'LIGHT' ``` -------------------------------- ### Get Taurus Manager Instance Source: https://gitlab.com/taurus-org/taurus/-/blob/develop/doc/source/devel/api/taurus.md Retrieves the singleton instance of the TaurusManager. This is a shortcut for direct instantiation. ```default import taurus.core manager = taurus.core.taurusmanager.TaurusManager() ``` -------------------------------- ### Taurus Application Header Source: https://gitlab.com/taurus-org/taurus/-/blob/develop/doc/source/devel/examples.md This code is required to be prepended to most examples to set up the Taurus application and GUI elements. ```python import sys from taurus.external.qt import Qt from taurus.qt.qtgui.application import TaurusApplication app = TaurusApplication(sys.argv, cmd_line_parser=None) panel = Qt.QWidget() layout = Qt.QHBoxLayout() panel.setLayout(layout) ``` -------------------------------- ### Import CaselessList Source: https://gitlab.com/taurus-org/taurus/-/blob/develop/doc/source/devel/api/taurus.core.util.containers-CaselessList.md Import the CaselessList class from the taurus.core.util.containers module. ```default from taurus.core.util.containers import CaselessList ``` -------------------------------- ### Getting Child Loggers Source: https://gitlab.com/taurus-org/taurus/-/blob/develop/doc/source/devel/api/taurus-Logger.md Use the getChildren method to retrieve a list of the log children associated with this object. ```python getChildren() ``` -------------------------------- ### Import LogExceptHook Source: https://gitlab.com/taurus-org/taurus/-/blob/develop/doc/source/devel/api/taurus.core.util.log-LogExceptHook.md Import the LogExceptHook class from the taurus.core.util.log module. ```python from taurus.core.util.log import LogExceptHook ``` -------------------------------- ### Get Device Source: https://gitlab.com/taurus-org/taurus/-/blob/develop/doc/source/devel/api/taurus.core.resource-ResourcesFactory.md Obtain the device model object referenced by name. Raises TaurusException if the name is invalid. ```python ResourcesFactory().getDevice('device_name') ``` -------------------------------- ### Import CaselessWeakValueDict Source: https://gitlab.com/taurus-org/taurus/-/blob/develop/doc/source/devel/api/taurus.core.util.containers-CaselessWeakValueDict.md Import the CaselessWeakValueDict class from the taurus.core.util.containers module. ```python from taurus.core.util.containers import CaselessWeakValueDict ``` -------------------------------- ### Get Authority Source: https://gitlab.com/taurus-org/taurus/-/blob/develop/doc/source/devel/api/taurus.core.resource-ResourcesFactory.md Obtain the authority model object referenced by name. Raises TaurusException if the name is invalid. ```python ResourcesFactory().getAuthority('authority_name') ``` -------------------------------- ### Get Attribute Source: https://gitlab.com/taurus-org/taurus/-/blob/develop/doc/source/devel/api/taurus.core.resource-ResourcesFactory.md Obtain the attribute model object referenced by name. Raises TaurusException if the name is invalid. ```python ResourcesFactory().getAttribute('attribute_name') ``` -------------------------------- ### Encode and Decode Data with ZIPCodec Source: https://gitlab.com/taurus-org/taurus/-/blob/develop/doc/source/devel/api/taurus.core.util.codecs-ZIPCodec.md Demonstrates how to encode a string to gzip format and then decode it back using ZIPCodec. Ensure the CodecFactory is imported and initialized. ```python >>> from taurus.core.util.codecs import CodecFactory >>> # first encode something >>> data = 100 * "Hello world\n" >>> cf = CodecFactory() >>> codec = cf.getCodec('zip') >>> format, encoded_data = codec.encode(("", data)) >>> print(len(data), len(encoded_data)) 1200, 31 >>> format, decoded_data = codec.decode((format, encoded_data)) >>> print(decoded_data[20]) 'Hello world\nHello wo' ```