AlkantarClanX12

Your IP : 3.15.148.203


Current Path : /opt/alt/python310/lib64/python3.10/__pycache__/
Upload File :
Current File : //opt/alt/python310/lib64/python3.10/__pycache__/dataclasses.cpython-310.opt-1.pyc

o

6��fF��@sddlZddlZddlZddlZddlZddlZddlZddlZddlZddl	Z	ddlm
Z
mZgd�ZGdd�de
�ZGdd�d�Ze�ZGdd	�d	�Ze�ZGd
d�d�Ze�Ze�i�ZGdd
�d
�Zed�Zed�Zed�ZdZdZdZe�d�Zdd�Z Gdd�d�Z!Gdd�d�Z"Gdd�d�Z#eeddddded�dd �Z$d!d"�Z%d#d$�Z&dded%�d&d'�Z'd(d)�Z(d*d+�Z)d,d-�Z*d.d/�Z+d0d1�Z,d2d3�Z-d4d5�Z.d6d7�Z/d8d9�Z0d:d;�Z1d<d=�Z2d>d?�Z3d@dA�Z4dBdC�Z5dDdE�Z6dFdG�Z7dHdI�Z8dJdK�Z9idLd�dMd�dNd�dOd�dPe7�dQd�dRe8�dSd�dTe8�dUe9�dVe8�dWe9�dXe8�dYe9�dZe8�d[e9�Z:d\d]�Z;d^d_�Z<d`da�Z=dbdc�Z>d~ddddddddddddddde�	dfdg�Z?dhdi�Z@djdk�ZAdldm�ZBeCdn�dodp�ZDdqdr�ZEeFds�dtdu�ZGdvdw�ZHdxddddddddddddddddy�dzd{�ZId|d}�ZJdS)�N)�FunctionType�GenericAlias)
�	dataclass�field�Field�FrozenInstanceError�InitVar�KW_ONLY�MISSING�fields�asdict�astuple�make_dataclass�replace�is_dataclassc@�eZdZdS)rN��__name__�
__module__�__qualname__�rr�2/opt/alt/python310/lib64/python3.10/dataclasses.pyr�src@seZdZdd�ZdS)�_HAS_DEFAULT_FACTORY_CLASScCsdS)Nz	<factory>r��selfrrr�__repr__��z#_HAS_DEFAULT_FACTORY_CLASS.__repr__N)rrrrrrrrr�src@r)�
_MISSING_TYPENrrrrrr��rc@r)�
_KW_ONLY_TYPENrrrrrr�rrc@seZdZdd�Zdd�ZdS)�_FIELD_BASEcC�
||_dS�N��name�rr$rrr�__init__��
z_FIELD_BASE.__init__cCs|jSr"r#rrrrr�sz_FIELD_BASE.__repr__N)rrrr&rrrrrr �sr �_FIELD�_FIELD_CLASSVAR�_FIELD_INITVARZ__dataclass_fields__Z__dataclass_params__Z
__post_init__z^(?:\s*(\w+)\s*\.)?\s*(\w+)cs"t��t�����fdd��}|S)Nc	sLt|�t��f}|�vrdS��|�z�|�}W��|�|S��|�w)Nz...)�id�_thread�	get_ident�add�discard)r�key�result��repr_running�
user_functionrr�wrapper�s


�z _recursive_repr.<locals>.wrapper)�set�	functools�wraps)r4r5rr2r�_recursive_repr�s
r9c@s(eZdZdZdd�Zdd�Zdd�ZdS)	r��typecCr!r"r:)rr;rrrr&�r'zInitVar.__init__cCs8t|jt�rt|jt�s|jj}nt|j�}d|�d�S)Nzdataclasses.InitVar[�])�
isinstancer;rr�repr)rZ	type_namerrrr�s

zInitVar.__repr__cCst|�Sr")r)�clsr;rrr�__class_getitem__szInitVar.__class_getitem__N)rrr�	__slots__r&rr@rrrrr�s
rc@s4eZdZdZdd�Zedd��Zdd�Zee	�Z
dS)	r)r$r;�default�default_factoryr>�hash�init�compare�metadata�kw_only�_field_typec		CsXd|_d|_||_||_||_||_||_||_|durtnt	�
|�|_||_d|_
dSr")r$r;rBrCrEr>rDrF�_EMPTY_METADATA�types�MappingProxyTyperGrHrI)	rrBrCrEr>rDrFrGrHrrrr&s��
zField.__init__cCs^d|j�d|j�d|j�d|j�d|j�d|j�d|j�d|j�d	|j�d
|j	�d|j
�d�S)
NzField(name=z,type=z	,default=z,default_factory=z,init=�,repr=z,hash=z	,compare=z
,metadata=z	,kw_only=z
,_field_type=�))r$r;rBrCrEr>rDrFrGrHrIrrrrr.s.��������	�
��zField.__repr__cCs,tt|j�dd�}|r||j||�dSdS)N�__set_name__)�getattrr;rB)r�ownerr$�funcrrrrOFs�zField.__set_name__N)rrrrAr&r9rrO�classmethodrr@rrrrrs

rc@s eZdZdZdd�Zdd�ZdS)�_DataclassParams�rEr>�eq�order�unsafe_hash�frozencCs(||_||_||_||_||_||_dSr"rU)rrEr>rVrWrXrYrrrr&Ys
z_DataclassParams.__init__c
Cs6d|j�d|j�d|j�d|j�d|j�d|j�d�
S)Nz_DataclassParams(init=rMz,eq=z,order=z
,unsafe_hash=z,frozen=rNrUrrrrras������z_DataclassParams.__repr__N)rrrrAr&rrrrrrTPsrTT�rBrCrEr>rDrFrGrHc	Cs.|tur|turtd��t||||||||�S)a�Return an object to identify dataclass fields.

    default is the default value of the field.  default_factory is a
    0-argument function called to initialize a field's value.  If init
    is true, the field will be a parameter to the class's __init__()
    function.  If repr is true, the field will be included in the
    object's repr().  If hash is true, the field will be included in the
    object's hash().  If compare is true, the field will be used in
    comparison functions.  metadata, if specified, must be a mapping
    which is stored but not otherwise examined by dataclass.  If kw_only
    is true, the field will become a keyword-only parameter to
    __init__().

    It is an error to specify both default and default_factory.
    z/cannot specify both default and default_factory)r
�
ValueErrorrrZrrrros
�rcCs$tdd�|D��tdd�|D��fS)Ncss �|]}|jr|js|VqdSr"�rErH��.0�frrr�	<genexpr>���z(_fields_in_init_order.<locals>.<genexpr>css �|]}|jr|jr|VqdSr"r\r]rrrr`�ra)�tuple�rrrr�_fields_in_init_order�s�rdcs(|sdSdd��fdd�|D���d�S)N�()�(�,csg|]
}��d|j���qS)�.r#r]��obj_namerr�
<listcomp>��z_tuple_str.<locals>.<listcomp>�,))�join)rjrrrir�
_tuple_str�s ro)�globals�locals�return_typec
Cs�|duri}d}|tur||d<d}d�|�}d�dd�|D��}d|�d	|�d
|�d|��}d�|���}d
|�d|�d|��}i}	t|||	�|	ddi|��S)N�Z_return_typez->_return_typerg�
css�|]}d|��VqdS)z  Nr)r^�brrrr`���z_create_fn.<locals>.<genexpr>z def rfrNz:
�, zdef __create_fn__(z):
z	
 return Z
__create_fn__r)r
rn�keys�exec)
r$�args�bodyrprqrrZreturn_annotationZtxtZ
local_vars�nsrrr�
_create_fn�s
r}cCs0|rd|�d|�d|�d�S|�d|�d|��S)Nz*__dataclass_builtins_object__.__setattr__(rgrNrh�=r)rYr$�value�	self_namerrr�
_field_assign�sr�cCs�d|j��}|jtur+|jr |j||<|�d|j�d|j��}n6|j||<|�d�}n+|jrE|jtur7|j}n|jturD|j||<|j}n|rT|jturT|j||<|}ndS|jtur]dSt||j||�S)NZ_dflt_z() if z is _HAS_DEFAULT_FACTORY else re)r$rCr
rErBrIr*r�)r_rYrpr��slotsZdefault_namerrrr�_field_init�s2

��



�

r�cCsV|jtur
|jtur
d}n|jturd|j��}n|jtur d}|j�d|j�|��S)Nrsz=_dflt_z=_HAS_DEFAULT_FACTORYz:_type_)rBr
rCr$)r_rBrrr�_init_param�s

r�cCsd}|D]}	|	jr!|	jtur|	jtusd}q|r!td|	j�d���qdd�|D�}
|
�tttd��g}|D]}	t	|	||
||�}|rG|�
|�q6|rbd�d	d
�|D��}
|�
|�dt�d|
�d
��|sgdg}dd�|D�}|r~|dg7}|dd�|D�7}t
d|g|||
|dd�S)NFTznon-default argument z follows default argumentcSsi|]
}d|j��|j�qS)Z_type_)r$r;r]rrr�
<dictcomp>#rlz_init_fn.<locals>.<dictcomp>)r
�_HAS_DEFAULT_FACTORYZ__dataclass_builtins_object__rgcss �|]}|jtur|jVqdSr")rIr*r$r]rrrr`4s�
��z_init_fn.<locals>.<genexpr>rhrfrN�passcS�g|]}t|��qSr�r�r]rrrrk<�z_init_fn.<locals>.<listcomp>�*cSr�rr�r]rrrrkBr�r&)rqrprr)rErBr
rC�	TypeErrorr$�updater��objectr��appendrn�_POST_INIT_NAMEr})rZ
std_fieldsZkw_only_fieldsrY�
has_post_initr�rpr�Zseen_defaultr_rqZ
body_lines�lineZ
params_strZ_init_paramsrrr�_init_fnsH
��
�
�r�cCs2tdddd�dd�|D��dg|d�}t|�S)	Nrrz(return self.__class__.__qualname__ + f"(rwcSs g|]}|j�d|j�d��qS)z={self.z!r}r#r]rrrrkOs�z_repr_fn.<locals>.<listcomp>z)"�rp)r}rnr9)rrp�fnrrr�_repr_fnKs
����r�cCsp|td�}|rdd�dd�|D��d}nd}tdd	d
|�d�dd
f||d�tddd
|�d�ddf||d�fS)N)r?rrfrgcss�|]}t|j�VqdSr")r>r$r]rrrr`Zrvz'_frozen_get_del_attr.<locals>.<genexpr>rmre�__setattr__)rr$rz if type(self) is cls or name in �:z> raise FrozenInstanceError(f"cannot assign to field {name!r}")z)super(cls, self).__setattr__(name, value))rqrp�__delattr__r%z; raise FrozenInstanceError(f"cannot delete field {name!r}")z"super(cls, self).__delattr__(name))rrnr})r?rrprqZ
fields_strrrr�_frozen_get_del_attrVs2�
��
���r�cCs$t|ddd|�|�|��dg|d�S)N)r�otherz%if other.__class__ is self.__class__:z return zreturn NotImplementedr�)r})r$�op�
self_tuple�other_tuplerprrr�_cmp_fnos��r�cCs$td|�}tddd|�d�g|d�S)Nr�__hash__rzreturn hash(rNr�)ror})rrpr�rrr�_hash_fn}s
�r�cCs$||jupt|�|juo|j|juSr")�ClassVarr;Z
_GenericAlias�
__origin__)�a_type�typingrrr�_is_classvar�s

�r�cCs||jupt|�|juSr")rr;�r��dataclassesrrr�_is_initvar�s
�r�cCs
||juSr")r	r�rrr�_is_kw_only�r'r�c	Cs�t�|�}|rAd}|�d�}|stj�|j�j}ntj�|j�}|r2|j�|�|ur2tj�|j�j}|rA||�|�d��|�rAdSdS)N��TF)�_MODULE_IDENTIFIER_RE�match�group�sys�modules�getr�__dict__)	�
annotationr?Za_moduler�Zis_type_predicater�r|Zmodule_name�modulerrr�_is_type�s
)
r�cCspt||t�}t|t�r|}n
t|tj�rt}t|d�}||_||_t	|_
tj�
d�}|rDt||�sAt|jt�rDt|j|||jt�rDt|_
|j
t	urftjt}t||�sct|jt�rft|j|||jt�rft|_
|j
ttfvr{|jtur{td|j�d���|j
t	tfvr�|jtur�||_n|jtur�td|j�d���|j
t	ur�t|jtttf�r�tdt|j��d|j�d���|S)	N)rBr��field z cannot have a default factoryz$ is a ClassVar but specifies kw_onlyzmutable default z for field z$ is not allowed: use default_factory)rPr
r=rrK�MemberDescriptorTyperr$r;r(rIr�r�r�r��strr�r�r)rr�rr*rCr�rHrB�list�dictr6r[)r?Za_namer�Zdefault_kw_onlyrBr_r�r�rrr�
_get_field�sV



���



���
	
�

�r�cCs"t|t�r|j�d|j��|_|S)Nrh)r=rrr)r?rrrr�
_set_qualname1s
r�cCs(||jvrdSt||�t|||�dS)NTF)r�r��setattr)r?r$rrrr�_set_new_attribute8s


r�cCsdSr"r�r?rrprrr�_hash_set_noneGrr�cCsdd�|D�}t|t||��S)NcSs(g|]}|jdur
|jrn|jr|�qSr")rDrFr]rrrrkKs(z_hash_add.<locals>.<listcomp>)r�r�)r?rrp�fldsrrr�	_hash_addJsr�cCstd|j����)Nz-Cannot overwrite attribute __hash__ in class )r�rr�rrr�_hash_exceptionNs�r�)FFFF)FFFT)FFTF)FFTT)FTFF)FTFT)FTTF)FTTT)TFFF)TFFT)TFTF)TFTT)TTFF)TTFT)TTTF)TTTTc
%Cs0i}
|jtjvrtj|jj}ni}t|tt||||||��d}d}
|jddd�D]"}t|t	d�}|durMd}
|�
�D]}||
|j<q=t|t�jrMd}q+|j�
di�}g}d}tjt}|��D]/\}}t||�syt|t�r�t||||jt�r�|r�t|�d���d}d}qb|�t||||��qb|D]%}||
|j<tt||jd�t�r�|jtur�t||j�q�t||j|j�q�|j��D]\}}t|t�r�||vr�t|�d���q�|
r�|r�|s�td��|s�|r�td	��t|t	|
�|j�
d
t�}|tup�|duo�d|jv}|�r|�std��d
d�|
�
�D�}t|�\}}|�r8t|t�}t |dt!|||||d|
v�r2dnd||	��dd�|
�
�D�}|�rTdd�|D�}t |dt"||��|�rudd�|D�}t#d|�} t#d|�}!t |dt$dd| |!|d��|�r�dd�|D�}t#d|�} t#d|�}!dD]\}}"t ||t$||"| |!|d���r�td|�d|j�d����q�|�r�t%|||�D]}#t ||#j|#��r�td|#j�d|j�����q�t&t'|�t'|�t'|�|f}$|$�r�|$|||�|_(t|d��s�|jtt)�*|���+dd �|_,|�r	t |d!t-d"d#�|D���|	�rt.||�}t/�0|�|S)$NF���rT�__annotations__z3 is KW_ONLY, but KW_ONLY has already been specifiedz& is a field but has no type annotationz5cannot inherit non-frozen dataclass from a frozen onez5cannot inherit frozen dataclass from a non-frozen oner��__eq__z eq must be true if order is truecSsg|]}|jttfvr|�qSr)rIr(r*r]rrrrk�s�z"_process_class.<locals>.<listcomp>r&rZ__dataclass_self__cSsg|]	}|jtur|�qSr�rIr(r]rrrrkscS�g|]}|jr|�qSr)r>r]rrrrk�rcSr�r�rFr]rrrrkr�r�z==r�cSr�rr�r]rrrrk#r�))�__lt__�<)�__le__z<=)�__gt__�>)�__ge__z>=zCannot overwrite attribute z
 in class z). Consider using functools.total_ordering�__doc__z -> Noners�__match_args__cs��|]}|jVqdSr"r#r]rrrr`J��z!_process_class.<locals>.<genexpr>)1rr�r�r�r��_PARAMSrT�__mro__rP�_FIELDS�valuesr$rYr�r�itemsr�r=r�r�r	r�r�r�rrBr
�delattrr[rd�hasattrr�r�r�r�ror�r��_hash_action�boolr��inspectZ	signaturerr�rb�
_add_slots�abc�update_abstractmethods)%r?rEr>rVrWrXrY�
match_argsrHr�rrpZany_frozen_baseZhas_dataclass_basesruZbase_fieldsr_Zcls_annotationsZ
cls_fieldsZKW_ONLY_seenr�r$r;rZ
class_hashZhas_explicit_hashZall_init_fieldsZstd_init_fieldsZkw_only_init_fieldsr�Z
field_listr�r�r�r�r�Zhash_actionrrr�_process_classqs��

���

����
��

��


��

�������

r�cs�fdd�t��D�S)Ncsg|]}t�|j��qSr)rPr$r]rrrrkYsz'_dataclass_getstate.<locals>.<listcomp>rcrrrr�_dataclass_getstateXsr�cCs,tt|�|�D]\}}t�||j|�qdSr")�ziprr�r�r$)r�staterrrrr�_dataclass_setstate\s�r�cCs�d|jvr
t|j�d���t|j�}tdd�t|�D��}||d<|D]}|�|d�q#|�dd�t|dd�}t|�|j|j	|�}|durI||_
|rQt|_t
|_|S)NrAz already specifies __slots__csr�r"r#r]rrrr`lr�z_add_slots.<locals>.<genexpr>r�r)r�r�rr�rbr�poprPr;�	__bases__rr��__getstate__r��__setstate__)r?�	is_frozenZcls_dict�field_namesZ
field_name�qualnamerrrr�bs 

r�F�	rEr>rVrWrXrYr�rHr�c		s0���������f	dd�}
|dur|
S|
|�S)a�Returns the same class as was passed in, with dunder methods
    added based on the fields defined in the class.

    Examines PEP 526 __annotations__ to determine fields.

    If init is true, an __init__() method is added to the class. If
    repr is true, a __repr__() method is added. If order is true, rich
    comparison dunder methods are added. If unsafe_hash is true, a
    __hash__() method function is added. If frozen is true, fields may
    not be assigned to after instance creation. If match_args is true,
    the __match_args__ tuple is added. If kw_only is true, then by
    default all fields are keyword-only. If slots is true, an
    __slots__ attribute is added.
    cst|����������
Sr")r�)r?�	rVrYrErHr�rWr>r�rXrr�wrap�s�zdataclass.<locals>.wrapNr)r?rEr>rVrWrXrYr�rHr�r�rr�rr�srcCs>zt|t�}Wntytd�d�wtdd�|��D��S)z�Return a tuple describing the fields of this dataclass.

    Accepts a dataclass or an instance of one. Tuple elements are of
    type Field.
    z0must be called with a dataclass type or instanceNcss�|]
}|jtur|VqdSr"r�r]rrrr`�s�zfields.<locals>.<genexpr>)rPr��AttributeErrorr�rbr�)Zclass_or_instancerrrrr�s
�rcCstt|�t�S)z2Returns True if obj is an instance of a dataclass.)r�r;r�)�objrrr�_is_dataclass_instance�sr�cCs*t|t�rt|t�s|nt|�}t|t�S)zEReturns True if obj is a dataclass or an instance of a
    dataclass.)r=r;rr�r�)r�r?rrrr�s 
r��dict_factorycC�t|�std��t||�S)a�Return the fields of a dataclass instance as a new dictionary mapping
    field names to field values.

    Example usage:

      @dataclass
      class C:
          x: int
          y: int

      c = C(1, 2)
      assert asdict(c) == {'x': 1, 'y': 2}

    If given, 'dict_factory' will be used instead of built-in dict.
    The function applies recursively to field values that are
    dataclass instances. This will also look into built-in containers:
    tuples, lists, and dicts.
    z0asdict() should be called on dataclass instances)r�r��
_asdict_inner)r�r�rrrr��
rcs�t|�r"g}t|�D]}tt||j���}|�|j|f�q
�|�St|t�r9t|d�r9t	|��fdd�|D��St|t
tf�rMt	|��fdd�|D��St|t�rat	|��fdd�|��D��St
�|�S)N�_fieldsc�g|]}t|���qSr�r��r^�vr�rrrk�r�z!_asdict_inner.<locals>.<listcomp>c3��|]}t|��VqdSr"r�r�r�rrr`�rvz _asdict_inner.<locals>.<genexpr>c3�(�|]\}}t|��t|��fVqdSr"r��r^�kr�r�rrr`�s���)r�rr�rPr$r�r=rbr�r;r�r�r��copy�deepcopy)r�r�r1r_rrr�rr��s
�
r���
tuple_factorycCr�)a�Return the fields of a dataclass instance as a new tuple of field values.

    Example usage::

      @dataclass
      class C:
          x: int
          y: int

    c = C(1, 2)
    assert astuple(c) == (1, 2)

    If given, 'tuple_factory' will be used instead of built-in tuple.
    The function applies recursively to field values that are
    dataclass instances. This will also look into built-in containers:
    tuples, lists, and dicts.
    z1astuple() should be called on dataclass instances)r�r��_astuple_inner)r�rrrrr
r�r
cs�t|�rg}t|�D]}tt||j���}|�|�q
�|�St|t�r6t|d�r6t	|��fdd�|D��St|t
tf�rJt	|��fdd�|D��St|t�r^t	|��fdd�|��D��St
�|�S)Nr�cr�r�rr�rrrrk(r�z"_astuple_inner.<locals>.<listcomp>c3rr"r	r�rrrr`-rvz!_astuple_inner.<locals>.<genexpr>c3rr"r	rrrrr`/s��)r�rrrPr$r�r=rbr�r;r�r�r�rr)r�rr1r_rrrrrs
�
rr)�bases�	namespacerEr>rVrWrXrYr�rHr�cs�duri�t�}
i�i�|D]^}t|t�r|}d}n"t|�dkr&|\}}nt|�dkr6|\}}}|�|<ntd|����t|t�rF|��sMtd|����t�|�rYtd|����||
vrdtd|����|
�|�|�|<q���fd	d
�}t	�
||i|�}t|||||||	|
||d�
S)a�Return a new dynamically created dataclass.

    The dataclass name will be 'cls_name'.  'fields' is an iterable
    of either (name), (name, type) or (name, type, Field) objects. If type is
    omitted, use the string 'typing.Any'.  Field objects are created by
    the equivalent of calling 'field(name, type [, Field-info])'.

      C = make_dataclass('C', ['x', ('y', int), ('z', int, field(init=False))], bases=(Base,))

    is equivalent to:

      @dataclass
      class C(Base):
          x: 'typing.Any'
          y: int
          z: int = field(init=False)

    For the bases and namespace parameters, see the builtin type() function.

    The parameters init, repr, eq, order, unsafe_hash, and frozen are passed to
    dataclass().
    Nz
typing.Anyr��zInvalid field: z'Field names must be valid identifiers: z"Field names must not be keywords: zField name duplicated: cs |���|����|d<dS)Nr�)r�)r|�Zannotations�defaultsrrr�exec_body_callbackns

z*make_dataclass.<locals>.exec_body_callbackr�)r6r=r��lenr��isidentifier�keyword�	iskeywordr.rK�	new_classr)�cls_namerr
rrEr>rVrWrXrYr�rHr��seen�itemr$�tp�specrr?rr
rr5s:






�rcKs�t|�std��t|t���D];}|jturq|js)|j|vr(t	d|j�d���q|j|vrJ|jt
urA|jturAt	d|j�d���t||j�||j<q|j
di|��S)a,Return a new object replacing specified fields with new values.

    This is especially useful for frozen classes.  Example usage:

      @dataclass(frozen=True)
      class C:
          x: int
          y: int

      c = C(1, 2)
      c1 = replace(c, x=3)
      assert c1.x == 3 and c1.y == 2
      z1replace() should be called on dataclass instancesr�zC is declared with init=False, it cannot be specified with replace()zInitVar z! must be specified with replace()Nr)r�r�rPr�r�rIr)rEr$r[r*rBr
�	__class__)r�Zchangesr_rrrr}s


�rr")K�rer�rrKr�r�builtinsr7r�r,rr�__all__r�rrr�rr
rr	rLrJr r(r)r*r�r�r��compiler�r9rrrTrrdror}r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�rrr�rr�rr�rbr
rrrrrrr�<module>s�

@�	�<<;_��������	�
���
���h
"�)�H