Skip to content

withtwoemms/checksignature

Repository files navigation

checksignature

a function decorator for enforcing function signatures

tests publish codecov

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

About

a function decorator for enforcing function signatures

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages