Skip to main content

a function decorator for enforcing function signatures

Project description

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

Project details


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)

Uploaded Source

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

Hashes for checksignature-0.1.0.tar.gz
Algorithm Hash digest
SHA256 9bc3747036240ca26b122c77fdd544bfaf088e8c8a1564b1c0fe80d673fd7a4d
MD5 ea5d6645c187031bda85805a39f97ff1
BLAKE2b-256 203f2a5200dee88fa8f40cac1a139b211c24d455ccded940fb214f96e17a6d47

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page