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.
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
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
Built Distribution
File details
Details for the file be_holder-1.0.tar.gz
.
File metadata
- Download URL: be_holder-1.0.tar.gz
- Upload date:
- Size: 2.6 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
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8f823e593a7ed50e511fa249dbce6315891f3d5ade03376de7ef023511a0d97d |
|
MD5 | f80f5b07dc6dcb87f1b6c31605a67856 |
|
BLAKE2b-256 | 754218bf63cbdfe22ba69eb225984a54da535bbf571b8557b4bb5cc30cf67bda |
File details
Details for the file be_holder-1.0-py3-none-any.whl
.
File metadata
- Download URL: be_holder-1.0-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
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0835451a6047d4dc884767d88bd80876931e9d4a7b5747ad1021e7618671aebe |
|
MD5 | 07f906bce51fa07e314a9e09ec407bfa |
|
BLAKE2b-256 | c0c7107979353389e52afcb8a239ccb704bb2784d6c930aba450496759ff73e0 |