ResourcesFactory

Inheritance diagram of ResourcesFactory
class ResourcesFactory[source]

Bases: taurus.core.util.singleton.Singleton, taurus.core.taurusfactory.TaurusFactory, taurus.core.util.log.Logger

A Singleton class designed to provide Simulation related objects.

DftResourceName = 'taurus_resources.py'

the default resource file name

DftResourcePriority = 10

priority for the default resource

clear()[source]
findObjectClass(absolute_name)[source]

Obtain the class object corresponding to the given name.

Parameters

absolute_name (str) – the object absolute name string

Return type

TaurusModel or None

Returns

the class for the model object mapped by absolute_name, or None if absolute_name is invalid.

getAttribute(name)[source]

Obtain the attribute model object referenced by name.

Parameters

name (str) – name

Return type

TaurusAttribute

Returns

attribute object

Raise

(TaurusException) if name is invalid

getAttributeNameValidator()[source]

Return ResourceAttributeNameValidator

getAuthority(name=None)[source]

Obtain the authority model object referenced by name.

Parameters

name (str) – name

Return type

TaurusAuthority

Returns

authority object

Raise

(TaurusException) if name is invalid

getAuthorityNameValidator()[source]

Return ResourceAuthorityNameValidator

getDevice(name)[source]

Obtain the device model object referenced by name.

Parameters

name (str) – name

Return type

TaurusDevice

Returns

device object

Raise

(TaurusException) if name is invalid

getDeviceNameValidator()[source]

Return ResourceDeviceNameValidator

getValue(key)[source]

Returns the value for a given key

Parameters

key (str) – a key

Return type

str

Returns

the value for the given key

init(*args, **kwargs)[source]

Singleton instance initialization. For internal usage only

loadResource(obj=None, priority=1, name=None)

(Re)Loads the given resource.

Parameters
  • obj (dict or file or None) – the resource object. Default is None meaning in will (re)load the default resource: taurus_resources.py from the application directory

  • priority (int) – the resource priority. Default is 1 meaning maximum priority

  • name (str) – an optional name to give to the resource

Return type

dict

Returns

a dictionary version of the given resource object

reloadResource(obj=None, priority=1, name=None)[source]

(Re)Loads the given resource.

Parameters
  • obj (dict or file or None) – the resource object. Default is None meaning in will (re)load the default resource: taurus_resources.py from the application directory

  • priority (int) – the resource priority. Default is 1 meaning maximum priority

  • name (str) – an optional name to give to the resource

Return type

dict

Returns

a dictionary version of the given resource object

schemes = ('res', 'resource')

the list of schemes that this factory supports. For this factory: ‘res’ and ‘resources’ are the supported schemes