msmetamacro

This module contains the class definition for the MacroServer meta macro information

Functions

Classes

MacroLibrary

class MacroLibrary(**kwargs)[source]

Bases: SardanaLibrary

Object representing a python module containing macro classes and/or macro functions. Public members:

  • module - reference to python module

  • file_path - complete (absolute) path (with file name at the end)

  • file_name - file name (including file extension)

  • path - complete (absolute) path

  • name - (=module name) module name (without file extension)

  • macros - dict<str, MacroClass>

  • exc_info - exception information if an error occurred when loading

    the module

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

Returns a serializable object describing this object.

Returns:

a serializable dict

get_macro(meta_name)

Returns a :class:~`sardana.sardanameta.SardanaCode` for the given meta name or None if the meta does not exist in this library.

Parameters:

meta_name (str) – the meta name (class, function)

Return type:

Type[SardanaCode]

Returns:

a meta or None

get_macros()

Returns a sequence of the meta (class and functions) that belong to this library.

Return type:

Sequence[SardanaCode]

Returns:

a sequence of meta (class and functions) that belong to this library

has_macro(meta_name)

Returns True if the given meta name belongs to this library or False otherwise.

Parameters:

meta_name (str) – the meta name

Return type:

bool

Returns:

True if the given meta (class or function) name belongs to this library or False otherwise

has_macros()

Returns True if any meta object exists in the library or False otherwise.

Return type:

bool

Returns:

True if any meta object (class or function) exists in the library or False otherwise

add_macro_class(meta_class)

Adds a new :class:~`sardana.sardanameta.SardanaClass` to this library.

Parameters:

meta_class (Type[SardanaClass]) – the meta class to be added to this library

Return type:

None

get_macro_class(meta_class_name)

Returns a :class:~`sardana.sardanameta.SardanaClass` for the given meta class name or None if the meta class does not exist in this library.

Parameters:

meta_class_name (str) – the meta class name

Return type:

Type[SardanaClass]

Returns:

a meta class or None

get_macro_classes()

Returns a sequence of the meta classes that belong to this library.

Return type:

Sequence[Type[SardanaClass]]

Returns:

a sequence of meta classes that belong to this library

has_macro_class(meta_class_name)

Returns True if the given meta class name belongs to this library or False otherwise.

Parameters:

meta_class_name (str) – the meta class name

Return type:

bool

Returns:

True if the given meta class name belongs to this library or False otherwise

add_macro_function(meta_function)

Adds a new :class:~`sardana.sardanameta.SardanaFunction` to this library.

Parameters:

meta_function (Type[SardanaFunction]) – the meta function to be added to this library

Return type:

None

get_macro_function(meta_function_name)

Returns a :class:~`sardana.sardanameta.SardanaFunction` for the given meta function name or None if the meta function does not exist in this library.

Parameters:

meta_function_name (str) – the meta function name

Return type:

Type[SardanaFunction]

Returns:

a meta function or None

get_macro_functions()

Returns a sequence of the meta functions that belong to this library.

Return type:

Sequence[Type[SardanaFunction]]

Returns:

a sequence of meta functions that belong to this library

has_macro_function(meta_function_name)

Returns True if the given meta function name belongs to this library or False otherwise.

Parameters:

meta_function_name (str) – the meta function name

Return type:

bool

Returns:

True if the given meta function name belongs to this library or False otherwise

Parameterizable

class Parameterizable[source]

Bases: object

Helper class to handle parameter and result definition for a MacroClass or a MacroFunction

MacroClass

class MacroClass(**kwargs)[source]

Bases: SardanaClass, Parameterizable

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

Returns a serializable object describing this object.

Returns:

a serializable dict

MacroFunction

class MacroFunction(**kwargs)[source]

Bases: SardanaFunction, Parameterizable

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

Returns a serializable object describing this object.

Returns:

a serializable dict