taurus.core.util.init_lightweight

This package consists of a collection of useful classes and functions. Most of the elements are taurus independent and can be used generically.

This module contains a python implementation of json. This was done because json only became part of python since version 2.6. The json implementation follows the rule:

  1. if python >= 2.6 use standard json from python distribution

  2. otherwise use private implementation distributed with taurus

Classes

Functions

CallableRef(object, del_cb=None)[source]

This function returns a callable weak reference to a callable object. Object can be a callable object, a function or a method.

Parameters
  • object (callable object) – a callable object

  • del_cb (callable object or None) – calback function. Default is None meaning to callback.

Returns

a weak reference for the given callable

Return type

taurus.core.util.BoundMethodWeakref or weakref.ref

critical(msg, *args, **kw)[source]
debug(msg, *args, **kw)[source]
deprecated(*args, **kw)[source]
deprecation_decorator(func=None, alt=None, rel=None, dbg_msg=None)[source]

decorator to mark methods as deprecated

dictFromSequence(seq)[source]

Translates a sequence into a dictionary by converting each to elements of the sequence (k,v) into a k:v pair in the dictionary

Parameters

seq (sequence) – any sequence object

Return type

dict

Returns

dictionary built from the given sequence

error(msg, *args, **kw)[source]
fatal(msg, *args, **kw)[source]
getDictAsTree(dct)[source]

This method will print a recursive dict in a tree-like shape:

>>> print(getDictAsTree({'A':{'B':[1,2],'C':[3]}}))
info(msg, *args, **kw)[source]
self_locked(func, reentrant=True)[source]

Decorator to make thread-safe class members Decorator to create thread-safe objects.

Warning

  • With Lock() this decorator should not be used to decorate nested functions; it will cause Deadlock!

  • With RLock this problem is avoided … but you should rely more on python threading

trace(msg, *args, **kw)[source]
warning(msg, *args, **kw)[source]