sardanameta
This module is part of the Python Sardana libray. It defines the base classes for MetaLibrary and MetaClass
Classes
SardanaLibrary
- class SardanaLibrary(**kwargs)[source]
Object representing a python module containing sardana classes. 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)
meta_classes - dict<str, SardanMetaClass>
- exc_info - exception information if an error occurred when loading
the module
- description = '<Undocumented>'
- property code: List[str]
Returns a sequence of sourcelines corresponding to the module code.
- Returns:
list of source code lines
- add_meta_class(meta_class)[source]
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:
- get_meta_class(meta_class_name)[source]
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:
- Returns:
a meta class or None
- get_meta_classes()[source]
Returns a sequence of the meta classes that belong to this library.
- Return type:
- Returns:
a sequence of meta classes that belong to this library
- has_meta_class(meta_class_name)[source]
Returns True if the given meta class name belongs to this library or False otherwise.
- add_meta_function(meta_function)[source]
Adds a new :class:~`sardana.sardanameta.SardanaFunction` to this library.
- get_meta_function(meta_function_name)[source]
Returns a :class:~`sardana.sardanameta.SardanaFunction` for the given meta function name or None if the meta function does not exist in this library.
- has_meta_function(meta_function_name)[source]
Returns True if the given meta function name belongs to this library or False otherwise.
- get_meta(meta_name)[source]
Returns a :class:~`sardana.sardanameta.SardanaCode` for the given meta name or None if the meta does not exist in this library.
- has_meta(meta_name)[source]
Returns True if the given meta name belongs to this library or False otherwise.
- has_metas()[source]
Returns True if any meta object exists in the library or False otherwise.
- Return type:
- Returns:
True if any meta object (class or function) exists in the library or False otherwise
- get_metas()[source]
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
- get_name()[source]
Returns the module name for this library (same as :meth:~sardana.sardanameta.SardanaLibrary.get_module_name).
- Return type:
- Returns:
the module name
- get_module_name()[source]
Returns the module name for this library (same as :meth:~sardana.sardanameta.SardanaLibrary.get_name).
- Return type:
- Returns:
the module name
- get_module()[source]
Returns the python module for this library.
- Return type:
- Returns:
the python module
- get_description()[source]
Returns the this library documentation or “<Undocumented>” if no documentation exists.
- Return type:
- Returns:
this library documentation or None
- get_file_path()[source]
Returns the file path for this library. On posix systems is something like: /abs/path/filename.py
- Return type:
- Returns:
this library file path
- get_file_name()[source]
Returns the file name for this library. On posix systems is something like: filename.py
- Return type:
- Returns:
this library file name
- has_errors()[source]
Returns True if this library has syntax errors or False otherwise.
- Return type:
- Returns:
True if this library has syntax errors or False otherwise
- set_error(exc_info)[source]
Sets the error information for this library
- Parameters:
exc_info (
Tuple
) – error information. It must be an object similar to the one returned bysys.exc_info()
- Return type:
- get_error()[source]
Gets the error information for this library or None if no error exists
- Return type:
- Returns:
error information. An object similar to the one returned by
sys.exc_info()
- serialize(*args, **kwargs)[source]
Returns a serializable object describing this object.
- Return type:
- Returns:
a serializable dict
- Critical = 50
Critical message level (constant)
- Debug = 10
Debug message level (constant)
- DftLogFormat = <logging.Formatter object>
Default log format (constant)
- DftLogLevel = 20
Default log level (constant)
- DftLogMessageFormat = '%(threadName)-14s %(levelname)-8s %(asctime)s %(name)s: %(message)s'
Default log message format (constant)
- Error = 40
Error message level (constant)
- Fatal = 50
Fatal message level (constant)
- Info = 20
Info message level (constant)
- Trace = 5
Trace message level (constant)
- Warning = 30
Warning message level (constant)
- addChild(child)
Adds a new logging child
- Parameters:
child (logging.Logger) – the new child
- classmethod addLevelName(level_no, level_name)
Registers a new log level
- addLogHandler(handler)
Registers a new handler in this object’s logger
- Parameters:
handler (logging.Handler) – the new handler to be added
- classmethod addRootLogHandler(h)
Adds a new handler to the root logger
- Parameters:
h (logging.Handler) – the new log handler
- add_listener(listener)
Adds a new listener for this object.
- Parameters:
listener – a listener
- are_events_blocked()
- block_events()
- call__init__(klass, *args, **kw)
Method to be called from subclasses to call superclass corresponding __init__ method. This method ensures that classes from diamond like class hierarquies don’t call their super classes __init__ more than once.
- call__init__wo_kw(klass, *args)
Same as call__init__ but without keyword arguments because PyQt4 does not support them.
- cleanUp()
The cleanUp. Default implementation does nothing Overwrite when necessary
- copyLogHandlers(other)
Copies the log handlers of other object to this object
- Parameters:
other (object) – object which contains ‘log_handlers’
- critical(msg, *args, **kw)
Record a critical message in this object’s logger. Accepted args and kwargs* are the same as
logging.Logger.critical()
.- Parameters:
msg (str) – the message to be recorded
args – list of arguments
kw – list of keyword arguments
- debug(msg, *args, **kw)
Record a debug message in this object’s logger. Accepted args and kwargs are the same as
logging.Logger.debug()
.- Parameters:
msg (str) – the message to be recorded
args – list of arguments
kw – list of keyword arguments
- deprecated(msg=None, dep=None, alt=None, rel=None, dbg_msg=None, _callerinfo=None, **kw)
Record a deprecated warning message in this object’s logger. If message is not passed, a estandard deprecation message is constructued using dep, alt, rel arguments. Also, an extra debug message can be recorded, followed by traceback info.
- Parameters:
msg (str) – the message to be recorded (if None passed, it will be constructed using dep (and, optionally, alt and rel)
dep (str) – name of deprecated feature (in case msg is None)
alt (str) – name of alternative feature (in case msg is None)
rel (str) – name of release from which the feature was deprecated (in case msg is None)
dbg_msg (str) – msg for debug (or None to log only the warning)
_callerinfo – for internal use only. Do not use this argument.
kw – any additional keyword arguments, are passed to
logging.Logger.warning()
- classmethod disableLogOutput()
Disables the
logging.StreamHandler
which dumps log records, by default, to the stderr.
- classmethod enableLogOutput()
Enables the
logging.StreamHandler
which dumps log records, by default, to the stderr.
- error(msg, *args, **kw)
Record an error message in this object’s logger. Accepted args and kwargs are the same as
logging.Logger.error()
.- Parameters:
msg (str) – the message to be recorded
args – list of arguments
kw – list of keyword arguments
- exception(msg, *args)
Log a message with severity ‘ERROR’ on the root logger, with exception information.. Accepted args are the same as
logging.Logger.exception()
.- Parameters:
msg (str) – the message to be recorded
args – list of arguments
- fatal(msg, *args, **kw)
Record a fatal message in this object’s logger. Accepted args and kwargs are the same as
logging.Logger.fatal()
.- Parameters:
msg (str) – the message to be recorded
args – list of arguments
kw – list of keyword arguments
- fire_event(event_type, event_value, listeners=None, protected=True)
- flushOutput()
Flushes the log output
- flush_queue()
- getAttrDict()
- getChildren()
Returns the log children for this object
- Returns:
the list of log children
- Return type:
sequence<logging.Logger
- classmethod getLogFormat()
Retuns the current log message format (the root log format)
- Returns:
the log message format
- Return type:
- getLogFullName()
Gets the full log name for this object
- Returns:
the full log name
- Return type:
- classmethod getLogLevel()
Retuns the current log level (the root log level)
- Returns:
a number representing the log level
- Return type:
- getLogObj()
Returns the log object for this object
- Returns:
the log object
- Return type:
- classmethod getLogger(name=None)
- getParent()
Returns the log parent for this object or None if no parent exists
- Returns:
the log parent for this object
- Return type:
logging.Logger or None
- classmethod getRootLog()
Retuns the root logger
- Returns:
the root logger
- Return type:
- get_frontend()
Returns this sardana frontend object or None if no frontend is registered
- Return type:
- Returns:
this objects frontend
- get_full_name()
Returns this sardana object full name
- Return type:
- Returns:
this sardana object full name
- get_interface()
Returns the interface this object implements.
- Return type:
Interface
- Returns:
The interface this object implements.
- get_interface_names()
Returns a sequence of interface names this object implements.
- get_interfaces()
Returns the set of interfaces this object implements.
- Return type:
Set
[Interface
]- Returns:
The set of interfaces this object implements.
- get_listeners()
- get_manager()
Return the
sardana.Manager
which owns this sardana object.- Return type:
- Returns:
the manager which owns this pool object.
- get_parent()
Returns this pool object parent.
- Return type:
- Returns:
this objects parent
- get_parent_name()
Returns this sardana object parent’s name.
- Return type:
- Returns:
this objects parent
- get_type()
Returns this sardana object type.
- Return type:
ElementType
- Returns:
this sardana object type
- has_listeners()
Returns True if anybody is listening to events from this object
- Returns:
True is at least one listener is listening or False otherwise
- info(msg, *args, **kw)
Record an info message in this object’s logger. Accepted args and kwargs are the same as
logging.Logger.info()
.- Parameters:
msg (str) – the message to be recorded
args – list of arguments
kw – list of keyword arguments
- classmethod initRoot()
Class method to initialize the root logger. Do NOT call this method directly in your code
- log(level, msg, *args, **kw)
Record a log message in this object’s logger. Accepted args and kwargs are the same as
logging.Logger.log()
.
- log_format = <logging.Formatter object>
Default log message format
- log_level = 20
Current global log level
- queue_event(event_type, event_value, listeners=None)
- removeLogHandler(handler)
Removes the given handler from this object’s logger
- Parameters:
handler (logging.Handler) – the handler to be removed
- classmethod removeRootLogHandler(h)
Removes the given handler from the root logger
- Parameters:
h (logging.Handler) – the handler to be removed
- remove_listener(listener)
Removes an existing listener for this object.
- Parameters:
listener – the listener to be removed
- Returns:
True is succeeded or False otherwise
- classmethod resetLogFormat()
Resets the log message format (the root log format)
- classmethod resetLogLevel()
Resets the log level (the root log level)
- root_init_lock = <unlocked _thread.lock object>
Internal usage
- root_inited = True
Internal usage
- serialized(*args, **kwargs)
- classmethod setLogFormat(format)
sets the new log message format
- Parameters:
format (str) – the new log message format
- classmethod setLogLevel(level)
sets the new log level (the root log level)
- Parameters:
level (int) – the new log level
- set_name(name)
Sets sardana object name
- Param:
sardana object name
- stack(target=5)
Log the usual stack information, followed by a listing of all the local variables in each frame.
- str(*args, **kwargs)
- stream_handler = <StreamHandler <stderr> (NOTSET)>
the main stream handler
- syncLog()
Synchronises the log output
- trace(msg, *args, **kw)
Record a trace message in this object’s logger. Accepted args and kwargs are the same as
logging.Logger.log()
.- Parameters:
msg (str) – the message to be recorded
args – list of arguments
kw – list of keyword arguments
- traceback(level=5, extended=True)
Log the usual traceback information, followed by a listing of all the local variables in each frame.
- unblock_events()
- updateAttrDict(other)
- warning(msg, *args, **kw)
Record a warning message in this object’s logger. Accepted args and kwargs* are the same as
logging.Logger.warning()
.- Parameters:
msg (str) – the message to be recorded
args – list of arguments
kw – list of keyword arguments
SardanaClass
- class SardanaClass(**kwargs)[source]
Object representing a python class.
- Critical = 50
Critical message level (constant)
- Debug = 10
Debug message level (constant)
- DftLogFormat = <logging.Formatter object>
Default log format (constant)
- DftLogLevel = 20
Default log level (constant)
- DftLogMessageFormat = '%(threadName)-14s %(levelname)-8s %(asctime)s %(name)s: %(message)s'
Default log message format (constant)
- Error = 40
Error message level (constant)
- Fatal = 50
Fatal message level (constant)
- Info = 20
Info message level (constant)
- Trace = 5
Trace message level (constant)
- Warning = 30
Warning message level (constant)
- addChild(child)
Adds a new logging child
- Parameters:
child (logging.Logger) – the new child
- classmethod addLevelName(level_no, level_name)
Registers a new log level
- addLogHandler(handler)
Registers a new handler in this object’s logger
- Parameters:
handler (logging.Handler) – the new handler to be added
- classmethod addRootLogHandler(h)
Adds a new handler to the root logger
- Parameters:
h (logging.Handler) – the new log handler
- add_listener(listener)
Adds a new listener for this object.
- Parameters:
listener – a listener
- are_events_blocked()
- block_events()
- call__init__(klass, *args, **kw)
Method to be called from subclasses to call superclass corresponding __init__ method. This method ensures that classes from diamond like class hierarquies don’t call their super classes __init__ more than once.
- call__init__wo_kw(klass, *args)
Same as call__init__ but without keyword arguments because PyQt4 does not support them.
- cleanUp()
The cleanUp. Default implementation does nothing Overwrite when necessary
- property code
Returns a tuple (sourcelines, firstline) corresponding to the definition of this code object. sourcelines is a list of source code lines. firstline is the line number of the first source code line.
- property code_object
- copyLogHandlers(other)
Copies the log handlers of other object to this object
- Parameters:
other (object) – object which contains ‘log_handlers’
- critical(msg, *args, **kw)
Record a critical message in this object’s logger. Accepted args and kwargs* are the same as
logging.Logger.critical()
.- Parameters:
msg (str) – the message to be recorded
args – list of arguments
kw – list of keyword arguments
- debug(msg, *args, **kw)
Record a debug message in this object’s logger. Accepted args and kwargs are the same as
logging.Logger.debug()
.- Parameters:
msg (str) – the message to be recorded
args – list of arguments
kw – list of keyword arguments
- deprecated(msg=None, dep=None, alt=None, rel=None, dbg_msg=None, _callerinfo=None, **kw)
Record a deprecated warning message in this object’s logger. If message is not passed, a estandard deprecation message is constructued using dep, alt, rel arguments. Also, an extra debug message can be recorded, followed by traceback info.
- Parameters:
msg (str) – the message to be recorded (if None passed, it will be constructed using dep (and, optionally, alt and rel)
dep (str) – name of deprecated feature (in case msg is None)
alt (str) – name of alternative feature (in case msg is None)
rel (str) – name of release from which the feature was deprecated (in case msg is None)
dbg_msg (str) – msg for debug (or None to log only the warning)
_callerinfo – for internal use only. Do not use this argument.
kw – any additional keyword arguments, are passed to
logging.Logger.warning()
- description = '<Undocumented>'
- classmethod disableLogOutput()
Disables the
logging.StreamHandler
which dumps log records, by default, to the stderr.
- classmethod enableLogOutput()
Enables the
logging.StreamHandler
which dumps log records, by default, to the stderr.
- error(msg, *args, **kw)
Record an error message in this object’s logger. Accepted args and kwargs are the same as
logging.Logger.error()
.- Parameters:
msg (str) – the message to be recorded
args – list of arguments
kw – list of keyword arguments
- exception(msg, *args)
Log a message with severity ‘ERROR’ on the root logger, with exception information.. Accepted args are the same as
logging.Logger.exception()
.- Parameters:
msg (str) – the message to be recorded
args – list of arguments
- fatal(msg, *args, **kw)
Record a fatal message in this object’s logger. Accepted args and kwargs are the same as
logging.Logger.fatal()
.- Parameters:
msg (str) – the message to be recorded
args – list of arguments
kw – list of keyword arguments
- property file_name: str
Returns the file name for the library where this class is. On posix systems is something like: filename.py
- Returns:
the file name for the library where this class is
- property file_path: str
Returns the file path for for the library where this class is. On posix systems is something like: /abs/path/filename.py
- Returns:
the file path for for the library where this class is
- fire_event(event_type, event_value, listeners=None, protected=True)
- flushOutput()
Flushes the log output
- flush_queue()
- getAttrDict()
- getChildren()
Returns the log children for this object
- Returns:
the list of log children
- Return type:
sequence<logging.Logger
- classmethod getLogFormat()
Retuns the current log message format (the root log format)
- Returns:
the log message format
- Return type:
- getLogFullName()
Gets the full log name for this object
- Returns:
the full log name
- Return type:
- classmethod getLogLevel()
Retuns the current log level (the root log level)
- Returns:
a number representing the log level
- Return type:
- getLogObj()
Returns the log object for this object
- Returns:
the log object
- Return type:
- classmethod getLogger(name=None)
- getParent()
Returns the log parent for this object or None if no parent exists
- Returns:
the log parent for this object
- Return type:
logging.Logger or None
- classmethod getRootLog()
Retuns the root logger
- Returns:
the root logger
- Return type:
- get_brief_description(max_chars=60)
- get_code()
Returns a tuple (sourcelines, firstline) corresponding to the definition of the controller class. sourcelines is a list of source code lines. firstline is the line number of the first source code line.
- get_frontend()
Returns this sardana frontend object or None if no frontend is registered
- Return type:
- Returns:
this objects frontend
- get_full_name()
Returns this sardana object full name
- Return type:
- Returns:
this sardana object full name
- get_interface()
Returns the interface this object implements.
- Return type:
Interface
- Returns:
The interface this object implements.
- get_interface_names()
Returns a sequence of interface names this object implements.
- get_interfaces()
Returns the set of interfaces this object implements.
- Return type:
Set
[Interface
]- Returns:
The set of interfaces this object implements.
- get_listeners()
- get_manager()
Return the
sardana.Manager
which owns this sardana object.- Return type:
- Returns:
the manager which owns this pool object.
- get_parent()
Returns this pool object parent.
- Return type:
- Returns:
this objects parent
- get_parent_name()
Returns this sardana object parent’s name.
- Return type:
- Returns:
this objects parent
- get_type()
Returns this sardana object type.
- Return type:
ElementType
- Returns:
this sardana object type
- has_listeners()
Returns True if anybody is listening to events from this object
- Returns:
True is at least one listener is listening or False otherwise
- info(msg, *args, **kw)
Record an info message in this object’s logger. Accepted args and kwargs are the same as
logging.Logger.info()
.- Parameters:
msg (str) – the message to be recorded
args – list of arguments
kw – list of keyword arguments
- classmethod initRoot()
Class method to initialize the root logger. Do NOT call this method directly in your code
- property lib: SardanaLibrary
Returns the library :class:~`sardana.sardanameta.SardanaLibrary` for this class.
- Returns:
a reference to the library where this class is located
- log(level, msg, *args, **kw)
Record a log message in this object’s logger. Accepted args and kwargs are the same as
logging.Logger.log()
.
- log_format = <logging.Formatter object>
Default log message format
- log_level = 20
Current global log level
- property path: str
Returns the absolute path for the library where this class is. On posix systems is something like: /abs/path
- Returns:
the absolute path for the library where this class is
- queue_event(event_type, event_value, listeners=None)
- removeLogHandler(handler)
Removes the given handler from this object’s logger
- Parameters:
handler (logging.Handler) – the handler to be removed
- classmethod removeRootLogHandler(h)
Removes the given handler from the root logger
- Parameters:
h (logging.Handler) – the handler to be removed
- remove_listener(listener)
Removes an existing listener for this object.
- Parameters:
listener – the listener to be removed
- Returns:
True is succeeded or False otherwise
- classmethod resetLogFormat()
Resets the log message format (the root log format)
- classmethod resetLogLevel()
Resets the log level (the root log level)
- root_init_lock = <unlocked _thread.lock object>
Internal usage
- root_inited = True
Internal usage
- serialize(*args, **kwargs)
Returns a serializable object describing this object.
- Return type:
- Returns:
a serializable dict
- serialized(*args, **kwargs)
- classmethod setLogFormat(format)
sets the new log message format
- Parameters:
format (str) – the new log message format
- classmethod setLogLevel(level)
sets the new log level (the root log level)
- Parameters:
level (int) – the new log level
- set_name(name)
Sets sardana object name
- Param:
sardana object name
- stack(target=5)
Log the usual stack information, followed by a listing of all the local variables in each frame.
- str(*args, **kwargs)
- stream_handler = <StreamHandler <stderr> (NOTSET)>
the main stream handler
- syncLog()
Synchronises the log output
- trace(msg, *args, **kw)
Record a trace message in this object’s logger. Accepted args and kwargs are the same as
logging.Logger.log()
.- Parameters:
msg (str) – the message to be recorded
args – list of arguments
kw – list of keyword arguments
- traceback(level=5, extended=True)
Log the usual traceback information, followed by a listing of all the local variables in each frame.
- unblock_events()
- updateAttrDict(other)
- warning(msg, *args, **kw)
Record a warning message in this object’s logger. Accepted args and kwargs* are the same as
logging.Logger.warning()
.- Parameters:
msg (str) – the message to be recorded
args – list of arguments
kw – list of keyword arguments
- property klass