cyme.utils

cyme.utils

class cyme.utils.LazyProgressBar(size, description=None, endtext=None)
finish(**kwargs)
step(i=1, **kwargs)
class cyme.utils.Path

unipath.Path version that can use the / operator to combine paths:

>>> p = Path("foo")
>>> p / "bar" / "baz"
Path("foo/bar/baz")
cyme.utils.find_package(mod, _s=None)

Find the package a module belongs to.

if you have structure:

package/__init__.py
       /foo.py
       /bar/__init__.py
       /bar/baz.py

Then the following examples returns:

>>> find_package(import_module("package"))
"package"
>>> find_package(import_module("package.foo"))
"package"
>>> find_package(import_module("package.bar.baz"))
>>> package.bar

Note that this does not look at the file system, but rather uses the __package__ attribute of a module.

cyme.utils.find_symbol(origin, sym)

Find symbol in module relative by origin.

E.g. if origin is an object in the module package.foo, then:

>>> find_symbol(origin, ".bar.my_symbol")

will return the object my_symbol from module package.bar.

cyme.utils.force_list(obj)

Force object to be a list.

If obj is a scalar value then a list with that value as sole element is returned, or if obj is a tuple then it is coerced into a list.

cyme.utils.imerge_settings(a, b)

Merge two django settings modules, keys in b have precedence.

cyme.utils.instantiate(origin, sym, *args, **kwargs)

Like find_symbol() but instantiates the class found using *args and **kwargs.

cyme.utils.redirect_stdouts_to_logger(loglevel='INFO', logfile=None, redirect_level='WARNING', stdout=False, stderr=True)

See celery.log.Log.redirect_stdouts_to_logger().

cyme.utils.setup_logging(loglevel='INFO', logfile=None)

Setup logging using loglevel and logfile.

stderr will be used if not logfile provided.

Previous topic

cyme.bin.cyme_branch

This Page