# `TangoFactory`

digraph inheritancedd31596989 { bgcolor=transparent; rankdir=UD; ratio=compress; size="8.0, 12.0"; "Logger" [URL="taurus-Logger.html#taurus.Logger",color=dodgerblue1,fillcolor=white,fontcolor=black,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.5,shape=box,style=rounded,target="_top",tooltip="The taurus logger class. All taurus pertinent classes should inherit"]; "Singleton" [URL="taurus.core.util.singleton-Singleton.html#taurus.core.util.singleton.Singleton",color=dodgerblue1,fillcolor=white,fontcolor=black,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.5,shape=box,style=rounded,target="_top",tooltip="This class allows Singleton objects"]; "TangoFactory" [URL="#taurus.core.tango.TangoFactory",color=dodgerblue1,fillcolor=white,fontcolor=black,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.5,shape=box,style=rounded,target="_top",tooltip="A :class:`TaurusFactory` singleton class to provide Tango-specific"]; "Singleton" -> "TangoFactory" [arrowsize=0.5,style="setlinewidth(0.5)"]; "TaurusFactory" -> "TangoFactory" [arrowsize=0.5,style="setlinewidth(0.5)"]; "Logger" -> "TangoFactory" [arrowsize=0.5,style="setlinewidth(0.5)"]; "TaurusFactory" [URL="taurus.core.taurusfactory-TaurusFactory.html#taurus.core.taurusfactory.TaurusFactory",color=dodgerblue1,fillcolor=white,fontcolor=black,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.5,shape=box,style=rounded,target="_top",tooltip="The base class for valid Factories in Taurus."]; }

class TangoFactory(*p, **k)

  A `TaurusFactory` singleton class to provide Tango-specific Taurus Element objects (TangoAuthority, TangoDevice, TangoAttribute)

  Tango model names are URI based See https://tools.ietf.org/html/rfc3986. For example, a TangoAttribute would be:

      tango://foo.org:1234/a/b/c/d#label
      \___/   \_____/ \__/ \_____/ \___/
        |        |     |      |      |
        |    hostname port  attr     |
        |   \____________/\______/   |
        |         |           |      |
      scheme   authority     path  fragment

  For Tango Elements:

  > - The ‘scheme’ must be the string “tango” (lowercase mandatory)

  > - The ‘authority’ identifies the Tango database (<hostname> and <port> are mandatory if authority is given)

  > - The ‘path’ identifies Tango Device and Attributes. For devices it must have the format _/_/_ or alias For attributes it must have the format _/_/_/_ or devalias/_

  > - The ‘fragment’ is optional and it refers to a member of the model object, thus not being part of the model name itself

  Import from `taurus.core.tango` as:

      from taurus.core.tango import TangoFactory

  caseSensitive = False
  cleanUp()

    Cleanup the singleton instance

  disablePolling()

    Disable the application tango polling

  elementTypesMap = {3: <class 'taurus.core.tango.tangodevice.TangoDevice'>, 13: <class 'taurus.core.tango.tangoattribute.TangoAttribute'>, 18: <class 'taurus.core.tango.tangodatabase.TangoAuthority'>}
  enablePolling()

    Enable the application tango polling

  getAttribute(attr_name, create_if_needed=True, **kwargs)

    Obtain the object corresponding to the given attribute name. If the corresponding attribute already exists, the existing instance is returned. Otherwise a new instance is stored and returned.

    Parameters:

      - attr_name (str) – a valid attribute name URI

      - create_if_needed (bool) – If True, the Attribute is created if it did not already exist. If False, None is returned if it did not exist

    Returns:

      attribute object :raise: (taurus.core.taurusexception.TaurusException) if the given alias is invalid.

    Return type:

      taurus.core.tangoattribute.TangoAttribute

  getAttributeInfo(full_attr_name)

    Deprecated: Use `taurus.core.tango.TangoFactory.getConfiguration()` instead.

    Obtain attribute information corresponding to the given attribute name. If the corresponding attribute info already exists, the existing information is returned. Otherwise a new information instance is stored and returned.

    Parameters:

      full_attr_name (str) – attribute name in format: <tango device name>’/’<attribute name>

    Returns:

      configuration object

    Return type:

      taurus.core.tango.TangoConfiguration

  getAttributeNameValidator()

    Return TangoAttributeNameValidator

  getAuthority(name=None)

    Obtain the object corresponding to the given database name or the default database if name is None. If the corresponding authority object already exists, the existing instance is returned. Otherwise a new instance is stored and returned.

    Parameters:

      name (str) – database name string alias. If None, the default database is used

    Returns:

      database object :raise: (taurus.core.taurusexception.TaurusException) if the given alias is invalid.

    Return type:

      taurus.core.tangodatabase.TangoAuthority

  getAuthorityNameValidator()

    Return TangoAuthorityNameValidator

  getConfiguration(**kwargs)

    Obtain the object corresponding to the given attribute or full name. If the corresponding configuration already exists, the existing instance is returned. Otherwise a new instance is stored and returned.

    Parameters:

      param (taurus.core.taurusattribute.TaurusAttribute or str) – attribute object or full configuration name

    Returns:

      configuration object

    Return type:

      taurus.core.tango.TangoAttribute

    Deprecated since version 4.0: Use getAttribute instead

  getDatabase(name=None)

    Deprecated. Use getAuthority instead

  getDatabaseNameValidator()

    Deprecated

  getDevice(dev_name, create_if_needed=True, **kw)

    Obtain the object corresponding to the given tango device name. If the corresponding device already exists, the existing instance is returned. Otherwise a new instance is stored and returned.

    Parameters:

      - dev_name (str) – tango device name or tango alias for the device. It must be a valid Tango device URI. If authority is not explicit, the default Tango Database will be used

      - create_if_needed (bool) – If True, the Device is created if it did not exist previously. If False, it returns None if it did not exist

    Returns:

      a device object :raise: (taurus.core.taurusexception.TaurusException) if the given dev_name is invalid.

    Return type:

      taurus.core.tango.TangoDevice

  getDeviceNameValidator()

    Return TangoDeviceNameValidator

  getExistingAttribute(attr_name)

    Deprecated: use getAtribute with create_if_needed=False

  getExistingAttributes()

    Returns a new dictionary will all registered attributes on this factory

    Returns:

      dictionary will all registered attributes on this factory

    Return type:

      dict

  getExistingDatabases()

    Returns a new dictionary will all registered databases on this factory

    Returns:

      dictionary will all registered databases on this factory

    Return type:

      dict

  getExistingDevice(dev_name)

    Deprecated: use getDevice with create_if_needed=False

  getExistingDevices()

    Returns a new dictionary will all registered devices on this factory

    Returns:

      dictionary will all registered devices on this factory

    Return type:

      dict

  getOperationMode()

    Deprecated. Gives the current operation mode.

  get_default_tango_host()

    Retruns the current default tango host

  init(*args, **kwargs)

    Singleton instance initialization. For internal usage only

  isPollingEnabled()

    Tells if the local tango polling is enabled

    Returns:

      wheter or not the polling is enabled

    Return type:

      bool

  is_tango_event_subscription_disabled()
  is_tango_subscribe_enabled(**kwargs)

    Returns the current tango_subscribe_enabled status

    Warning

    This method belongs to a “Delayed Event Subscription” API added in v.4.2.1-alpha as an experimental feature. This API may not be stable and/or it may be removed in a future release (even on a minor version change)

    Deprecated since version 5.2.1: Use is_tango_event_subscription_disabled instead

  reInit()

    Reinitialize the singleton

  registerAttributeClass(attr_name, attr_klass)

    Registers a new attribute class for the attribute name.

    Parameters:

      - attr_name (str) – attribute name

      - attr_klass (taurus.core.tango.TangoAttribute) – the new class that will handle the attribute

  registerDeviceClass(dev_klass_name, dev_klass)

    Registers a new python class to handle tango devices of the given tango class name

    Parameters:

      - dev_klass_name (str) – tango device class name

      - dev_klass (taurus.core.tango.TangoDevice) – the new class that will handle devices of the given tango class name

  removeExistingAttribute(attr_or_attr_name)

    Removes a previously registered attribute.

    Parameters:

      attr_or_attr_name (str or TangoAttribute) – attribute name or attribute object

  removeExistingDevice(dev_or_dev_name)

    Removes a previously registered device.

    Parameters:

      dev_or_dev_name (str or TangoDevice) – device name or device object

  schemes = ('tango', 'tango-nodb')
  setOperationMode(mode)

    Deprecated. setOperationMode(OperationMode mode) -> None Sets the operation mode for the Tango system.

  set_default_tango_host(tango_host)

    Sets the new default tango host. The method will transform the given name to an Authority URI.

    Note

    Calling this method also clears the device alias cache.

    Parameters:

      tango_host (str) – the new tango host. It accepts any valid Tango authority name or None to use the defined by $TANGO_HOST env. var.

  set_tango_event_subscription_disabled(disable_subscription)

    Disable subscription to tango events. Needs to be called before creating Attributes or setting models

  set_tango_subscribe_enabled(**kwargs)

    If True, enables event subscribing on TangoAttribute objects

    Warning

    This method belongs to a “Delayed Event Subscription” API added in v.4.2.1-alpha as an experimental feature. This API may not be stable and/or it may be removed in a future release (even on a minor version change)

    Deprecated since version 5.2.1: Use set_tango_event_subscription_disabled instead

  unregisterAttributeClass(attr_name)

    Unregisters the attribute class for the given attribute If no class was registered before for the given attribute, this call as no effect

    Parameters:

      attr_name (str) – attribute name

  unregisterDeviceClass(dev_klass_name)

    Unregisters the class for the given tango class name If no class was registered before for the given attribute, this call as no effect

    Parameters:

      dev_klass_name (str) – tango device class name