Skip to main content

No project description provided

Project description

cwtch [wip] - Python dataclasses with validation and views.

Documentation

tests coverage License: MIT

In [1]: from cwtch import dataclass, field

In [2]: @dataclass
   ...: class D:
   ...:     i: int
   ...:     s: str = field(validate=False)
   ...: 

In [3]: D(i=1, s='s')
Out[3]: D(i=1, s='s')

In [4]: D(i='i', s='s')
---------------------------------------------------------------------------
...
ValidationError                           Traceback (most recent call last)
Cell In[4], line 1
----> 1 D(i='i', s='s')

File <string>:14, in __init__(__cwtch_self__, i, s, **__cwtch_kwds__)

ValidationError: type[ <class '__main__.D'> ] path[ 'i' ] value_type[ <class 'str'> ]
  type[ <class 'int'> ] value_type[ <class 'str'> ] value[ 'i' ]
    Error: invalid literal for int() with base 10: 'i'

In [5]: D(i='1', s=0)
Out[5]: D(i=1, s=0)

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

cwtch-0.1.0.tar.gz (19.1 kB view details)

Uploaded Source

Built Distribution

cwtch-0.1.0-cp311-cp311-macosx_14_0_arm64.whl (185.2 kB view details)

Uploaded CPython 3.11 macOS 14.0+ ARM64

File details

Details for the file cwtch-0.1.0.tar.gz.

File metadata

  • Download URL: cwtch-0.1.0.tar.gz
  • Upload date:
  • Size: 19.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.3 CPython/3.11.9 Darwin/23.5.0

File hashes

Hashes for cwtch-0.1.0.tar.gz
Algorithm Hash digest
SHA256 6079f100611a1caca70edff06497617c2d3ce475734a7fe686136c7d1988dac3
MD5 bcb6f88619935cab7f89e38c7d0714c0
BLAKE2b-256 1094513f00db0db8e533b4c01a964ff3a3b7ace2f2e4306cf5ad0467dab584a5

See more details on using hashes here.

File details

Details for the file cwtch-0.1.0-cp311-cp311-macosx_14_0_arm64.whl.

File metadata

File hashes

Hashes for cwtch-0.1.0-cp311-cp311-macosx_14_0_arm64.whl
Algorithm Hash digest
SHA256 d303089f2917f883b30e19c0e141932324e23ec8a0d2c6be96200780c007e941
MD5 ad3a57e96948a91c978e57fc00ecedce
BLAKE2b-256 3089905988029a912e9e132fd5dac00b2bc9f684039bd083f4e99a2a5c186101

See more details on using hashes here.

Supported by

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