pyoload
This adds some runtime type checking and warnings when enabled. It is disabled by default.
Pyoload permits you to add runtime checking to classes on instance attribute assignment and functions.
usage
pyoload provides two basic methods:
pyoload.annotate: decorator over functions or methods.pyoload.annotate_class: decorator over classes. All wrapped bypyoload()which checks what to be called.
import pyoload
pyoload.debug()
@pyoload
def foo(a: int, b, c: str) -> tuple[str, int]:
return ("ab", 23)
@pyoload
class myclass:
pass
pyolaod modes
Pyoload includes three modes of enum type pyoload.Mode and where the current
mode is in pyoload.MODE.
- DEBUG: Shows warnings, comments, exceptions activate via
pyoload.debug() - DEV : Does not call upon validatore
- PROD(DEFAULT):
@pyoloadsimply does nothing.
Adding validators
You may add validators to check values furthermore.
def validator(value) -> Optional[str]:
if value.is_ok():
return None
else:
return "Value is not Ok! pass a value which is Ok please."
@pyoload(comments=dict(val=validator))
def func(val):
pass
Metadata
Release files for pyoload 3.0.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| pyoload-3.0.0.tar.gz | 7.0 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| pyoload-3.0.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 14.5 kB
Release files / pyoload-3.0.0.tar.gz
| Download URL | pyoload-3.0.0.tar.gz |
|---|---|
| Size | 7.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
1026f6981f47d91e4e70562232fa38759a5fdf924e5ce913fe3c1cbaf819830a
|
|
BLAKE2b-256 checksum How to use checksums |
1e2d7fbe1c023d294976f8bc0d20f244cb8b7cacd8a4b4de42fc6853d7d96c3b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.1.0 CPython/3.12.8
|
Release files / pyoload-3.0.0-py3-none-any.whl
| Download URL | pyoload-3.0.0-py3-none-any.whl |
|---|---|
| Size | 7.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
eb3a4f5f968392a9bf9dada23322df05cc31627b119a3837651c24923e190e56
|
|
BLAKE2b-256 checksum How to use checksums |
fc5008d5ca87a02190303f59d47b9f17cc0d08d7814510c38a055fc53444e6b2
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.1.0 CPython/3.12.8
|