tango_frame package

class AutoDispatchClient(config=None)[ソース]

ベースクラス: object

Reconstruct a Python device API over a TANGO connection.

device_class defines the local Python interface. The remote TANGO device may be generated by this framework or independently implemented, as long as its commands and attributes match that interface.

パラメータ:

config (Config | None)

config: Config | None = None
device_class: Type[Any] | None = None
property tango_config: Config

Return the TANGO connection configuration.

戻り値:

Configuration used by this reconstructed client.

class AutoDispatchDevice(cl, name)[ソース]

ベースクラス: Device

Expose an ordinary Python device class as a TANGO device server.

Subclasses set device_class to the transport-independent Python class. Public methods become TANGO commands and public properties become TANGO attributes.

TangoClassClass

:py:class:`~tango.server.AutoDispatchDeviceClass`の別名です。

TangoClassName = 'AutoDispatchDevice'
delete_device()[ソース]

Release the wrapped Python device object when available.

戻り値の型:

None

device_class: Type[Any] | None = None
excluded_commands: Set[str] = {}
init_device()[ソース]

Create the local Python device object when TANGO initializes it.

例外:

RuntimeError -- If no Python device class has been configured.

戻り値の型:

None

initialize_dynamic_attributes()[ソース]

Install TANGO commands and attributes from the Python class.

例外:

RuntimeError -- If no Python device class has been configured.

戻り値の型:

None

run_device_server(device_class, args=None)[ソース]

Run a PyTango device server class.

The helper does not force database-less operation. Normal TANGO database startup arguments can therefore be supplied by the application. -nodb remains an application-level option for local tests only.

パラメータ:
  • device_class (Type[Any]) -- PyTango Device subclass to run.

  • args (Sequence[str] | None) -- Optional argument sequence passed to tango.server.run.

戻り値の型:

None

Submodules

tango_frame.auto_dispatch module

Automatic adaptation between ordinary Python classes and TANGO devices.

class AutoDispatchClient(config=None)[ソース]

ベースクラス: object

Reconstruct a Python device API over a TANGO connection.

device_class defines the local Python interface. The remote TANGO device may be generated by this framework or independently implemented, as long as its commands and attributes match that interface.

パラメータ:

config (Config | None)

config: Config | None = None
device_class: Type[Any] | None = None
property tango_config: Config

Return the TANGO connection configuration.

戻り値:

Configuration used by this reconstructed client.

class AutoDispatchDevice(cl, name)[ソース]

ベースクラス: Device

Expose an ordinary Python device class as a TANGO device server.

Subclasses set device_class to the transport-independent Python class. Public methods become TANGO commands and public properties become TANGO attributes.

TangoClassClass

:py:class:`~tango.server.AutoDispatchDeviceClass`の別名です。

TangoClassName = 'AutoDispatchDevice'
delete_device()[ソース]

Release the wrapped Python device object when available.

戻り値の型:

None

device_class: Type[Any] | None = None
excluded_commands: Set[str] = {}
init_device()[ソース]

Create the local Python device object when TANGO initializes it.

例外:

RuntimeError -- If no Python device class has been configured.

戻り値の型:

None

initialize_dynamic_attributes()[ソース]

Install TANGO commands and attributes from the Python class.

例外:

RuntimeError -- If no Python device class has been configured.

戻り値の型:

None

tango_frame.client module

Client-side adapters for native and reconstructed TANGO devices.

class DeviceProxy(config)[ソース]

ベースクラス: object

Framework proxy for a native TANGO device.

This class does not reconstruct a Python device class. It creates the native PyTango DeviceProxy from Config and transparently delegates the normal TANGO client API to it.

パラメータ:

config (Config) -- TANGO connection configuration.

property config: Config

Return the framework connection configuration.

戻り値:

TANGO connection configuration used by this proxy.

property native_proxy: DeviceProxy

Return the underlying native PyTango proxy.

戻り値:

Native tango.DeviceProxy instance.

class TangoTransport(config)[ソース]

ベースクラス: object

Transport used by AutoDispatchClient for reconstructed Python APIs.

パラメータ:

config (Config) -- TANGO connection configuration.

command(name, value=None)[ソース]

Execute a TANGO command.

パラメータ:
  • name (str) -- TANGO command name.

  • value (Any) -- Optional command input value.

戻り値:

Command result returned by PyTango.

戻り値の型:

Any

ping()[ソース]

Ping the remote TANGO device.

戻り値:

Round-trip time reported by PyTango in microseconds.

戻り値の型:

int

property proxy: DeviceProxy

Return the underlying native PyTango proxy.

戻り値:

Native tango.DeviceProxy instance.

read_attribute(name)[ソース]

Read a TANGO attribute value.

パラメータ:

name (str) -- TANGO attribute name.

戻り値:

Attribute value.

戻り値の型:

Any

write_attribute(name, value)[ソース]

Write a TANGO attribute value.

パラメータ:
  • name (str) -- TANGO attribute name.

  • value (Any) -- Value written to the attribute.

戻り値の型:

None

tango_frame.codec module

JSON codec used when a Python call cannot use a native TANGO type.

pack_call(args, kwargs)[ソース]

Serialize positional and keyword arguments into one TANGO string.

パラメータ:
  • args (Tuple[Any, ...]) -- Positional call arguments.

  • kwargs (Dict[str, Any]) -- Keyword call arguments.

戻り値:

Compact JSON payload.

戻り値の型:

str

pack_value(value)[ソース]

Serialize a non-native Python value.

パラメータ:

value (Any) -- Python value to serialize.

戻り値:

Compact JSON payload.

戻り値の型:

str

unpack_call(payload)[ソース]

Deserialize a call payload.

パラメータ:

payload (str) -- JSON call payload.

戻り値:

Tuple containing positional arguments and keyword arguments.

戻り値の型:

Tuple[Tuple[Any, ...], Dict[str, Any]]

unpack_value(payload)[ソース]

Deserialize a non-native Python value.

パラメータ:

payload (str) -- JSON payload.

戻り値:

Restored Python value.

戻り値の型:

Any

tango_frame.config module

Configuration objects for TANGO client connections.

class Config(device_name, tango_host=None, database=True)[ソース]

ベースクラス: object

Store the connection settings for a TANGO device.

Normal operation uses the TANGO database namespace. A database-less connection is supported only for local tests and requires tango_host.

パラメータ:
  • device_name (str) -- TANGO device name in domain/family/member form, or a device alias when a database is used.

  • tango_host (str | None) -- TANGO database endpoint in host:port form. If omitted for a database connection, PyTango resolves the device using the process TANGO_HOST configuration.

  • database (bool) -- Whether the normal TANGO database namespace is used.

device_url()[ソース]

Return the device identifier passed to native tango.DeviceProxy.

戻り値:

Device name, alias, or a fully qualified TANGO URL.

戻り値の型:

str

tango_frame.introspection module

Introspection helpers for ordinary Python device classes.

class MethodSpec(name, signature)[ソース]

ベースクラス: NamedTuple

Describe one public Python method.

パラメータ:
name

Public method name.

Type:

str

signature

Method signature without the instance self parameter.

Type:

inspect.Signature

name: str

Alias for field number 0

signature: Signature

Alias for field number 1

class PropertySpec(name, descriptor, annotation, writable)[ソース]

ベースクラス: NamedTuple

Describe one public Python property.

パラメータ:
name

Public property name.

Type:

str

descriptor

Original Python property descriptor.

Type:

property

annotation

Getter return annotation used for TANGO type mapping.

Type:

Any

writable

Whether the property has a setter.

Type:

bool

annotation: Any

Alias for field number 2

descriptor: property

Alias for field number 1

name: str

Alias for field number 0

writable: bool

Alias for field number 3

public_methods(device_class)[ソース]

Return public callable methods declared by a device class.

パラメータ:

device_class (Type[Any]) -- Ordinary Python device class to inspect.

戻り値:

Public method specifications.

戻り値の型:

List[MethodSpec]

public_properties(device_class)[ソース]

Return public properties declared by a device class.

パラメータ:

device_class (Type[Any]) -- Ordinary Python device class to inspect.

戻り値:

Public property specifications.

戻り値の型:

List[PropertySpec]

tango_frame.server module

Helpers for starting TANGO device servers.

run_device_server(device_class, args=None)[ソース]

Run a PyTango device server class.

The helper does not force database-less operation. Normal TANGO database startup arguments can therefore be supplied by the application. -nodb remains an application-level option for local tests only.

パラメータ:
  • device_class (Type[Any]) -- PyTango Device subclass to run.

  • args (Sequence[str] | None) -- Optional argument sequence passed to tango.server.run.

戻り値の型:

None

tango_frame.type_mapping module

Map Python 3.7 type annotations onto PyTango value types.

input_type(signature)[ソース]

Determine the TANGO command input type for a Python signature.

パラメータ:

signature (Signature) -- Python method signature without self.

戻り値:

Native PyTango type, str for encoded input, or None for void.

戻り値の型:

Any | None

is_void(annotation)[ソース]

Return whether an annotation represents no return value.

パラメータ:

annotation (Any) -- Python return annotation.

戻り値:

True for None or NoneType.

戻り値の型:

bool

output_type(signature)[ソース]

Determine the TANGO command output type for a Python signature.

パラメータ:

signature (Signature) -- Python method signature without self.

戻り値:

Native PyTango type, str for encoded output, or None for void.

戻り値の型:

Any | None

tango_array_type(annotation)[ソース]

Map a homogeneous list annotation to a PyTango spectrum type.

パラメータ:

annotation (Any) -- Python type annotation.

戻り値:

PyTango high-level spectrum type, or None when unsupported.

戻り値の型:

Any | None

tango_scalar_type(annotation)[ソース]

Map a scalar Python annotation to a PyTango high-level type.

パラメータ:

annotation (Any) -- Python type annotation.

戻り値:

PyTango-compatible scalar type, or None when unsupported.

戻り値の型:

Any | None

tango_value_type(annotation)[ソース]

Map a supported Python annotation to a PyTango value type.

パラメータ:

annotation (Any) -- Python type annotation.

戻り値:

PyTango-compatible type, or None when JSON fallback is required.

戻り値の型:

Any | None

uses_encoded_input(signature)[ソース]

Return whether a call requires the JSON input envelope.

パラメータ:

signature (Signature) -- Python method signature without self.

戻り値:

True when the input cannot be represented by one native TANGO value.

戻り値の型:

bool

uses_encoded_output(signature)[ソース]

Return whether a return value requires JSON encoding.

パラメータ:

signature (Signature) -- Python method signature without self.

戻り値:

True when the return type has no native TANGO representation.

戻り値の型:

bool