Simple Class Attribute Type Validation
Project description
Class Attribute Type Validation
Includes the Validate superclass, the validate decorator, and the ValidationError exception.
Inheriting from Validate or using the validate decorator 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
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.2.tar.gz.
File metadata
- Download URL: tsclasses-0.0.2.tar.gz
- Upload date:
- Size: 4.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.12.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a2cdfeaa66206a5172e09e054f9428bc5ef2df8ef1d096fbb25d8b504790f3d7
|
|
| MD5 |
921147f57ee9b6f9b3d00fbedae1abf5
|
|
| BLAKE2b-256 |
4dacfd1316d3d5c8b7cf68be51bf27276a2945b2c56187978dded4e091a5ba23
|
File details
Details for the file tsclasses-0.0.2-py3-none-any.whl.
File metadata
- Download URL: tsclasses-0.0.2-py3-none-any.whl
- Upload date:
- Size: 3.4 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 |
b91ad25f3ef40a2291520ca3d3ae40f17adac87f0325222b252228461028232d
|
|
| MD5 |
0ae387aa20994aa3320924627c5bd050
|
|
| BLAKE2b-256 |
c4d8bae02ebca20aaf1e786d49d4bc18197020299beedb1d2ffed500385fb14d
|