API

drypy

The package provides some basic function to turn on/off the dryrun mode.

drypy - dryrun for python

drypy.get_status()

Returns True if the dryrun system is active.

Returns:
True or False
drypy.get_version(short=False)

Returns the current drypy version.

Returns:
A string with the current drypy version.
drypy.set_dryrun(value)

Set the dryrun mode on or off.

Args:
value (bool): Mode to be in.
drypy.toggle_dryrun()

Toggle the current dryrun mode.

sham.py

This module provide a basic decorator to make your function log the call instead of executing.

class drypy.sham.sham(func)

Decorator which makes drypy to log the call of the target function without executing it.

Example:
>>> @sham
... def foo(bar, baz=None):
...     pass
...
>>> foo(bar, baz=42)
INFO:drypy.sham:[DRYRUN] call to 'foo(bar, baz=42)'

deputy.py

The deputy module provides the sheriff decorator to mark your function. The substitue function marked by sheriff.deputy will be run in place of the original one. If no deputy is provided, sheriff will fall back to drypy.sham.sham.

class drypy.deputy.sheriff(func)

Decorator which makes drypy to run func.deputy instead of func.

Example:
>>> @sheriff
... def my_func():
...    print("I'm the Sheriff!")
...
>>> @my_func.deputy
... def my_other_func():
...    print("I'm the Deputy!")
...
>>> my_func()
I'm the Deputy!

Note

Providing a deputy is optional: when not provided drypy will automatically fallback on sham behaviour.

deputy(func)

Mark the sheriff substitute.

Args:
func: The function drypy will run in place of sheriff.
Returns:
func itself.