Skip to main content

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


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)

Uploaded Source

Built Distribution

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

tsclasses-0.0.1-py3-none-any.whl (3.3 kB view details)

Uploaded Python 3

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

Hashes for tsclasses-0.0.1.tar.gz
Algorithm Hash digest
SHA256 f42e13af471d797725a51e5be65a8131c03eb439a02d2c4ea5245c84fac72886
MD5 a8170ca648e4bebf5089596753c57113
BLAKE2b-256 dddce82a1ed3675e0b74294181063a9addeeb0f3a2f46c03e8a09ca18bce0354

See more details on using hashes here.

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

Hashes for tsclasses-0.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 332f5dc19469a60dbc46ebb72fe64138124905128d3dd582398cb0caa6e86593
MD5 badd86af99c06f33e7371dc1cfd5b704
BLAKE2b-256 87e5ee415fb0fc8ce435c8bc9574387af19c7ff9d04fc445b730933c83beb92d

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