opt
/
hc_python
/
lib
/
python3.12
/
site-packages
/
pydantic
/
v1
/
__pycache__
/
Go to Home Directory
+
Upload
Create File
root@0UT1S:~$
Execute
By Order of Mr.0UT1S
[DIR] ..
N/A
__init__.cpython-312.pyc
2.14 KB
Rename
Delete
_hypothesis_plugin.cpython-312.pyc
20.00 KB
Rename
Delete
annotated_types.cpython-312.pyc
3.77 KB
Rename
Delete
class_validators.cpython-312.pyc
19.16 KB
Rename
Delete
color.cpython-312.pyc
25.22 KB
Rename
Delete
config.cpython-312.pyc
8.18 KB
Rename
Delete
dataclasses.cpython-312.pyc
22.19 KB
Rename
Delete
datetime_parse.cpython-312.pyc
10.08 KB
Rename
Delete
decorator.cpython-312.pyc
13.57 KB
Rename
Delete
env_settings.cpython-312.pyc
17.28 KB
Rename
Delete
error_wrappers.cpython-312.pyc
8.69 KB
Rename
Delete
errors.cpython-312.pyc
28.88 KB
Rename
Delete
fields.cpython-312.pyc
56.07 KB
Rename
Delete
generics.cpython-312.pyc
16.57 KB
Rename
Delete
json.cpython-312.pyc
5.06 KB
Rename
Delete
main.cpython-312.pyc
46.96 KB
Rename
Delete
mypy.cpython-312.pyc
45.15 KB
Rename
Delete
networks.cpython-312.pyc
28.83 KB
Rename
Delete
parse.cpython-312.pyc
2.66 KB
Rename
Delete
schema.cpython-312.pyc
47.28 KB
Rename
Delete
tools.cpython-312.pyc
3.76 KB
Rename
Delete
types.cpython-312.pyc
47.33 KB
Rename
Delete
typing.cpython-312.pyc
21.68 KB
Rename
Delete
utils.cpython-312.pyc
34.34 KB
Rename
Delete
validators.cpython-312.pyc
29.87 KB
Rename
Delete
version.cpython-312.pyc
1.89 KB
Rename
Delete
� ,��g�F � � � d Z ddlZddlZddlZddlmZ ddlmZ ddlmZ ddl mZmZm Z mZmZmZmZmZmZmZmZ ddlmZ ddlmZ dd lmZmZmZmZ dd lm Z ddl!m"Z" ddl#m$Z$m%Z%m&Z&m'Z' dd l(m)Z)m*Z* ddl+m,Z, er,ddl(m-Z- ddl.m/Z/m0Z0 edd�� Z1eed df Z2 G d� d� Z3g d�Z4 ed� Z5ejl dk\ r� eejn e$f�� eddddddddddd� de8de8d e8d!e8d"e8d#e8d$eeee9 df d%ee8 d&ee8 d'e8d(e ee5 gd)f fd*�� � Z: eejn e$f�� eddddddddddd� d+ee5 de8de8d e8d!e8d"e8d#e8d$eeee9 df d%ee8 d&ee8 d'e8d(d)fd,�� � Z:n� eejn e$f�� edddddddddd-� de8de8d e8d!e8d"e8d#e8d$eeee9 df d%ee8 d&ee8 d(e ee5 gd)f fd.�� � Z: eejn e$f�� edddddddddd-� d+ee5 de8de8d e8d!e8d"e8d#e8d$eeee9 df d%ee8 d&ee8 d(d)fd/�� � Z: eejn e$f�� dIddddddddddd� d+eee5 de8de8d e8d!e8d"e8d#e8d$eeee9 df d%ee8 d&ee8 d'e8d(ee ee5 gd)f d)f fd0�� Z:ed1ed d2e8d(eed ddf fd3�� Z; G d4� d� Z<d5ed d$ee d%e8d6e=d(df d7�Z>dJd9�Z?d1ed d:ed(dfd;�Z@edfd5ed d$ee d6ee= d(ed< fd=�ZAejl d>k\ rd?dd@e=d(e8fdA�ZBn d?dd@e=d(e8fdB�ZBdKdD�ZCdCddEe=d2ed(dfdF�ZDd+ee d(e8fdG�ZEd5ed d$ee d(d8fdH�ZFy# e $ r Y ��"w xY w)LaX The main purpose is to enhance stdlib dataclasses by adding validation A pydantic dataclass can be generated from scratch or from a stdlib one. Behind the scene, a pydantic dataclass is just like a regular one on which we attach a `BaseModel` and magic methods to trigger the validation of the data. `__init__` and `__post_init__` are hence overridden and have extra logic to be able to validate input data. When a pydantic dataclass is generated from scratch, it's just a plain dataclass with validation triggered at initialization The tricky part if for stdlib dataclasses that are converted after into pydantic ones e.g. ```py @dataclasses.dataclass class M: x: int ValidatedM = pydantic.dataclasses.dataclass(M) ``` We indeed still want to support equality, hashing, repr, ... as if it was the stdlib one! ```py assert isinstance(ValidatedM(x=1), M) assert ValidatedM(x=1) == M(x=1) ``` This means we **don't want to create a new dataclass that inherits from it** The trick is to create a wrapper around `M` that will act as a proxy to trigger validation without altering default `M` behaviour. � N)�contextmanager)�wraps)�cached_property)� TYPE_CHECKING�Any�Callable�ClassVar�Dict� Generator�Optional�Type�TypeVar�Union�overload)�dataclass_transform)�gather_all_validators)� BaseConfig� ConfigDict�Extra� get_config)�ValidationError)�DataclassTypeError)�Field� FieldInfo�Required� Undefined)�create_model�validate_model)�ClassAttribute)� BaseModel)�CallableGenerator�NoArgAnyCallable� DataclassT� Dataclass)�bound�DataclassProxyc � � e Zd ZU eeeef ed<