taurus taurus

Previous topic

TangoStateAttribute

Next topic

taurus.core.util.argparse

This Page

taurus.core.util

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

Modules

Classes

Functions

CallableRef(object, del_cb=None)

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:

BoundMethodWeakref or weakref.ref

critical(msg, *args, **kw)
debug(msg, *args, **kw)
dictFromSequence(seq)

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 (:class:~`sequence`) – any sequence object
Return type::class:~`dict`
Returns:dictionary built from the given sequence
error(msg, *args, **kw)
getDictAsTree(dct)

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

>>> print getDictAsTree({'A':{'B':[1,2],'C':[3]}})
getSystemUserName()

Finds out user inf (currently just the logged user name) for Windows and Posix machines. sets a USER_NAME variable containing the logged user name defines a UNKNOWN_USER variable to which username falls back.

Return type::class:~`str`
Returns:current user name
info(msg, *args, **kw)
propertx(fct)

Decorator to simplify the use of property. Like @property for attrs who need more than a getter. For getter only property use @property.

adapted from http://code.activestate.com/recipes/502243/

self_locked(func, reentrant=True)

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)
warning(msg, *args, **kw)