msmetamacro

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

Functions

Classes

MacroLibrary

class MacroLibrary(**kwargs)[source]

Bases: sardana.sardanameta.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

Return type

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)

Returns

a meta or None

Return type

:class:~`sardana.sardanameta.SardanaCode`

get_macros()

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

Returns

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

Return type

seq<:class:~`sardana.sardanameta.SardanaCode`>

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

Returns

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

Return type

bool

has_macros()

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

Returns

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

Return type

bool

add_macro_class(meta_class)

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

Parameters

meta_class (:class:~`sardana.sardanameta.SardanaClass`) – the meta class to be added to this library

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

Returns

a meta class or None

Return type

:class:~`sardana.sardanameta.SardanaClass`

get_macro_classes()

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

Returns

a sequence of meta classes that belong to this library

Return type

seq<:class:~`sardana.sardanameta.SardanaClass`>

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

Returns

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

Return type

bool

add_macro_function(meta_function)

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

Parameters

meta_function (:class:~`sardana.sardanameta.SardanaFunction`) – the meta function to be added to this library

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

Returns

a meta function or None

Return type

:class:~`sardana.sardanameta.SardanaFunction`

get_macro_functions()

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

Returns

a sequence of meta functions that belong to this library

Return type

seq<:class:~`sardana.sardanameta.SardanaFunction`>

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

Returns

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

Return type

bool

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: sardana.sardanameta.SardanaClass, sardana.macroserver.msmetamacro.Parameterizable

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

Returns a serializable object describing this object.

Returns

a serializable dict

Return type

dict

MacroFunction

class MacroFunction(**kwargs)[source]

Bases: sardana.sardanameta.SardanaFunction, sardana.macroserver.msmetamacro.Parameterizable

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

Returns a serializable object describing this object.

Returns

a serializable dict

Return type

dict