A handful of useful general-purpose python decorators.
Project description
Decs
![License: MIT](https://pypi-camo.freetls.fastly.net/4150014b4dfdd7b565fa18de88e9bb1b8ccd7c08/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f4c6963656e73652d4d49542d626c75652e737667)
A handful of useful general-purpose python decorators.
Installing
$ pip install decs
How to use
Verify functions inputs and outputs types:
from decs import accepts, returns
@returns(str)
@accepts(str)
def my_print(string):
print(string)
return string
Verify methods inputs and outputs types:
from decs import accepts, returns
class SomeClass:
@returns(float)
@accepts('self', int, float)
def class_method(self, int_arg, float_arg):
return int_arg + float_arg
Repeat test case N times:
from decs import repeat
N = 42
@repeat(N)
def test_something(arg):
pass
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
decs-0.0.4.tar.gz
(3.8 kB
view hashes)
Built Distribution
decs-0.0.4-py3-none-any.whl
(5.8 kB
view hashes)