linkcheck.decorators
Simple decorators (usable in Python >= 2.4).
Example:
@synchronized(thread.allocate_lock())
def f():
"Synchronized function"
print("i am synchronized:", f, f.__doc__)
:deprecated
def g():
"this function is deprecated"
pass
@notimplemented
def h():
"todo"
pass
Functions
|
A decorator which can be used to mark functions as deprecated. |
|
Raises a NotImplementedError if the function is called. |
|
From http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/410666 |
|
Return synchronized function acquiring the given lock. |
|
A decorator calling a function with acquired lock. |
|
Decorator to run a function with timing info. |
|
Print execution time of the function. |
|
Set meta information (eg. |
Classes
|
Decorator that returns a function that keeps returning functions until all arguments are supplied; then the original function is evaluated. |
- class linkcheck.decorators.curried(func, *a)[source]
Bases:
object
Decorator that returns a function that keeps returning functions until all arguments are supplied; then the original function is evaluated.
Store function and arguments.
- linkcheck.decorators.deprecated(func)[source]
A decorator which can be used to mark functions as deprecated. It emits a warning when the function is called.
- linkcheck.decorators.notimplemented(func)[source]
Raises a NotImplementedError if the function is called.
- linkcheck.decorators.signal_handler(signal_number)[source]
From http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/410666
A decorator to set the specified function as handler for a signal. This function is the ‘outer’ decorator, called with only the (non-function) arguments. If signal_number is not a valid signal (for example signal.SIGN), no handler is set.
- linkcheck.decorators.synchronize(lock, func, log_duration_secs=0)[source]
Return synchronized function acquiring the given lock.
- linkcheck.decorators.timed(log=<_io.TextIOWrapper name='<stderr>' mode='w' encoding='utf-8'>, limit=2.0)[source]
Decorator to run a function with timing info.