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.0.tar.gz
(6.4 kB
view details)
File details
Details for the file checksignature-0.1.0.tar.gz
.
File metadata
- Download URL: checksignature-0.1.0.tar.gz
- Upload date:
- Size: 6.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.9.18
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9bc3747036240ca26b122c77fdd544bfaf088e8c8a1564b1c0fe80d673fd7a4d |
|
MD5 | ea5d6645c187031bda85805a39f97ff1 |
|
BLAKE2b-256 | 203f2a5200dee88fa8f40cac1a139b211c24d455ccded940fb214f96e17a6d47 |