a function decorator for enforcing function signatures
Project description
checksignature
a function decorator for enforcing function signatures
Setup
Install build dependencies.
pip install -r requirements
Run nox
to build, install, and run checksignature
tests.
Usage
Decorate any funciton with @checksignature
.
@checksignature
def function(a: str, b: int, c, *args: int, **kwargs: int)::
return a, b, c, args, kwargs
Upon invocation of function
, the signature check is evaluated.
function('one', 2, 3.0, 1, 2, 3, **{'four': 4}) #=> functions as usual--no problem.
function('one', 2, 3.0, 1, 2, 3, **{'four': 4.0}) #=> raises a TypeError
function('one', 2, 'x', 1, 2, 3, **{'four': 4}) #=> raises a TypeError
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
checksignature-0.1.1.tar.gz
(6.6 kB
view details)
File details
Details for the file checksignature-0.1.1.tar.gz
.
File metadata
- Download URL: checksignature-0.1.1.tar.gz
- Upload date:
- Size: 6.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.9.18
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 54ec49a2248d7d6bf44f70244075a77a2b8dd9d8077326ac76453de270870e67 |
|
MD5 | 90f64b57ea5c93bb399037f6e53f8db0 |
|
BLAKE2b-256 | 5b426416bf6b64a84e03e0271bd3b88cdbc8383bea031fd8756ba1ec305064bb |