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')
---------------------------------------------------------------------------
ValueError Traceback (most recent call last)
...
ValidationError Traceback (most recent call last)
Cell In[4], line 1
----> 1 D(i='i', s='s')
File <string>:12, in __init__(__cwtch_self__, i, s, **__extra_kwds)
ValidationError: type[ <class '__main__.D'> ] path[ 'i' ]
type[ <class 'int'> ] input_type[ <class 'str'> ] input_value[ 'i' ]
ValueError: invalid literal for int() with base 10: 'i'
-
Notifications
You must be signed in to change notification settings - Fork 0
Python Data Classes with validation and views
License
levsh/cwtch
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
About
Python Data Classes with validation and views
Topics
Resources
License
Stars
Watchers
Forks
Packages 0
No packages published