Home | Trees | Indices | Help |
---|
|
Various decorator functions
|
|||
Common tools | |||
---|---|---|---|
countcalls Keeps track of the number of times a function is called. |
|||
LogPrinter LogPrinter class which serves to emulates a file object and logs whatever it gets sent to a Logger object at the INFO level. |
|
|||
Common tools | |||
---|---|---|---|
|
|||
|
|||
|
|||
2-tuple |
|
||
2-tuple |
|
||
|
|||
|
|||
|
|||
|
|||
Disable decorator | |||
|
|||
Extend/Reopen class decorator | |||
|
|||
|
|
|||
logger = logging.getLogger("DEC")
|
|||
memory = {}
|
|
Cache a function's return value each time it is called. If called later with the same arguments, the cached value is returned, and not re-evaluated. |
Make a parallel version of a function. This extends the function's arguments with one extra argument, which is a parallel array that collects the output of the function. You have to decorate this function in turn with a function that calls the basic function, but with different arguments so to effectively make it parallel (e.g. in the frequency analysis case, this would be a function that calls the periodogram calculation with different f0 and fn. |
Time a function.
|
Time a function and return duration.
|
Retry a function or method until it returns True. Delay sets the initial delay, and backoff sets how much the delay should lengthen after each failure. backoff must be greater than 1, or else it isn't really a backoff. tries must be at least 0, and delay greater than 0. |
Retry a function or method reading from the internet until no socket or IOError is raised delay sets the initial delay, and backoff sets how much the delay should lengthen after each failure. backoff must be greater than 1, or else it isn't really a backoff. tries must be at least 0, and delay greater than 0. |
Disables the provided function use as follows:
|
Decorator that allows you to add methods or attributes to an already existing class. Inspired on the reopening of classes in Ruby Example: >>> @extend(SomeClassThatAlreadyExists) >>> def some_method(): >>> do stuff Will add the method some_method to SomeClassThatAlreadyExists |
Similar as extend(cls), but instead of decorating a function, you use it to decorate a class. All attributes of that class will be added to cls. Use at own risk, results may vary!!! |
Home | Trees | Indices | Help |
---|
Generated by Epydoc 3.0.1 on Fri Mar 30 10:45:18 2018 | http://epydoc.sourceforge.net |