Simple Class Attribute Type Validation
Project description
Class Attribute Type Validation
Includes the Validate superclass and the ValidationError exception.
Inheriting from Validate will result in instantiation type-checking based on annotations, as well as in-method attribute static-typing by raising ValidationError.
Example
from tsclasses import Validate
class Example(Validate):
number: int
def __init__(self, *args, **kwargs):
self.string = "five"
def valid_method(self):
self.number = 5
def invalid_method(self):
self.string = 5
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
tsclasses-0.0.1.tar.gz
(3.4 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file tsclasses-0.0.1.tar.gz.
File metadata
- Download URL: tsclasses-0.0.1.tar.gz
- Upload date:
- Size: 3.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.12.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f42e13af471d797725a51e5be65a8131c03eb439a02d2c4ea5245c84fac72886
|
|
| MD5 |
a8170ca648e4bebf5089596753c57113
|
|
| BLAKE2b-256 |
dddce82a1ed3675e0b74294181063a9addeeb0f3a2f46c03e8a09ca18bce0354
|
File details
Details for the file tsclasses-0.0.1-py3-none-any.whl.
File metadata
- Download URL: tsclasses-0.0.1-py3-none-any.whl
- Upload date:
- Size: 3.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.12.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
332f5dc19469a60dbc46ebb72fe64138124905128d3dd582398cb0caa6e86593
|
|
| MD5 |
badd86af99c06f33e7371dc1cfd5b704
|
|
| BLAKE2b-256 |
87e5ee415fb0fc8ce435c8bc9574387af19c7ff9d04fc445b730933c83beb92d
|