Skip to main content

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


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.2.tar.gz (4.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

tsclasses-0.0.2-py3-none-any.whl (3.4 kB view details)

Uploaded Python 3

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

Hashes for tsclasses-0.0.2.tar.gz
Algorithm Hash digest
SHA256 a2cdfeaa66206a5172e09e054f9428bc5ef2df8ef1d096fbb25d8b504790f3d7
MD5 921147f57ee9b6f9b3d00fbedae1abf5
BLAKE2b-256 4dacfd1316d3d5c8b7cf68be51bf27276a2945b2c56187978dded4e091a5ba23

See more details on using hashes here.

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

Hashes for tsclasses-0.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 b91ad25f3ef40a2291520ca3d3ae40f17adac87f0325222b252228461028232d
MD5 0ae387aa20994aa3320924627c5bd050
BLAKE2b-256 c4d8bae02ebca20aaf1e786d49d4bc18197020299beedb1d2ffed500385fb14d

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page