Skip to main content

A python module for type checking function parameters and returns

Project description

Description:

A python dectorater to enforce type checks on your python functions for your stupid colleagues who pass int type when you clearly told them to pass string. ヽ(ಠ_ಠ)ノ

You can define parameter and return types for your python functions using type hints (check them out here : https://mypy.readthedocs.io/en/stable/cheat_sheet_py3.html) and the watcher decorator over them to handle the dirty work.

Currently we only support positional arguments only and single return types but will add support for keyword arguments and mutiple return types.

Raise and issue in the gitrepo if you find any bugs or need a feature.

Pypi Link:

The package can be found on

https://pypi.org/project/design-patterns-WS/1.0.0/

Types Checking Supported for

Positional Parameters Single return types User defined data types

Example

from be_holder import watcher


@watcher
def f():  # Will work as normal
    return "pass"

@watcher
def f1(a:str,b): #Will be typed checked and will raise TypeError if types do not match
    return "pass"
@watcher
def f2(a:str,b:int):
    return "pass":

@watcher
def f3()>str: #Will raise a type error due to return type not matching function definition
    return 1

@watcher    
def f4(a:str)->str:
    return "pass"

if __name__ == "__main__":
    f4(1)
    f2("s",1)
    f2(1,1)

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

be_holder-1.1.tar.gz (2.7 kB view details)

Uploaded Source

Built Distribution

be_holder-1.1-py3-none-any.whl (3.3 kB view details)

Uploaded Python 3

File details

Details for the file be_holder-1.1.tar.gz.

File metadata

  • Download URL: be_holder-1.1.tar.gz
  • Upload date:
  • Size: 2.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/50.3.0 requests-toolbelt/0.9.1 tqdm/4.48.2 CPython/3.6.9

File hashes

Hashes for be_holder-1.1.tar.gz
Algorithm Hash digest
SHA256 4d81ec1e7d1b672b7cbdd279706966628f42a117452d644bbad7156c2294534e
MD5 459bda5a6ce9ff385c076da5086e7761
BLAKE2b-256 e21d3eb4d00f2fe80ab99d09ada4f5c9a56437630434c7c10d12185ad19acd30

See more details on using hashes here.

File details

Details for the file be_holder-1.1-py3-none-any.whl.

File metadata

  • Download URL: be_holder-1.1-py3-none-any.whl
  • Upload date:
  • Size: 3.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/50.3.0 requests-toolbelt/0.9.1 tqdm/4.48.2 CPython/3.6.9

File hashes

Hashes for be_holder-1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 ad31fd2319a60a639df680c59f00ed96522421e1b071121703aefa487e62e4fe
MD5 6076c3596403e22a1d6fe00dcc2f14aa
BLAKE2b-256 14c74f44aaf94624ba6323f3a6627fc61ae9dd3ca2bd5654ff1f830bd7813110

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