A set of random utilities used by Moa
Decorator function to flag a function as deprecated
Parameters: | func – any function |
---|
A simple logger - uses the moa.logger code to log the calling function. Use as a decorator:
@moa.utils.flog
def any_function(*args);
...
This is for debugging purposes (obviously)
Parameters: | func – Any python function |
---|
Return MOABASE - the directory where Moa is installed. This function also sets an environment variable MOABASE
>>> d = getMoaBase()
>>> assert(os.path.isdir(d))
>>> assert(os.path.isfile(os.path.join(d, 'README')))
>>> assert(os.path.isdir(os.path.join(d, 'lib')))
Return type: | string (path) |
---|
Return some info on a process
Check if the job contains a proper Moa job, if not, exit with an error message and a non-zero exit code.
Parameters: | job – An instance of moa.job.Job |
---|
This decorator can be used to turn simple functions into well-behaved decorators, so long as the decorators are fairly simple. If a decorator expects a function and returns a function (no descriptors), and if it doesn’t modify function attributes or docstring, then it is eligible to use this. Simply apply @simple_decorator to your decorator and it will automatically preserve the docstring and function attributes of functions to which it is applied.
Note; I got this code from somehwere, but forgot where exactly. This seems the most likely source:
http://svn.navi.cx/misc/trunk/djblets/djblets/util/decorators.py