cyme.utils
unipath.Path version that can use the / operator to combine paths:
>>> p = Path("foo")
>>> p / "bar" / "baz"
Path("foo/bar/baz")
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.
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.
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.
Merge two django settings modules, keys in b have precedence.
Like find_symbol() but instantiates the class found using *args and **kwargs.
See celery.log.Log.redirect_stdouts_to_logger().
Setup logging using loglevel and logfile.
stderr will be used if not logfile provided.