ok

Mini Shell

Direktori : /opt/alt/python38/lib64/python3.8/__pycache__/
Upload File :
Current File : //opt/alt/python38/lib64/python3.8/__pycache__/dataclasses.cpython-38.opt-1.pyc

U

.��c5��@s�ddlZddlZddlZddlZddlZddlZddlZddlZddlZdddddddd	d
ddd
gZ	Gdd�de
�ZGdd�d�Ze�Z
Gdd�d�Ze�Ze�i�ZGdd�d�Zed�Zed�Zed�ZdZdZdZe�d�ZGdd�de�ZGdd�ded�ZGd d�d�ZGd!d"�d"�Zeed#d#dd#dd$�d%d�Z d&d'�Z!d(d)�Z"dded*�d+d,�Z#d-d.�Z$d/d0�Z%d1d2�Z&d3d4�Z'd5d6�Z(d7d8�Z)d9d:�Z*d;d<�Z+d=d>�Z,d?d@�Z-dAdB�Z.dCdD�Z/dEdF�Z0dGdH�Z1dIdJ�Z2dKdL�Z3dddde1de2de2e3e2e3e2e3e2e3dM�Z4dNdO�Z5ddd#d#d#dPdPdPdQ�dRd�Z6dSd�Z7dTdU�Z8dVd
�Z9e:dW�dXd	�Z;dYdZ�Z<e=d[�d\d
�Z>d]d^�Z?d_dd#d#d#dPdPdPd`�dad�Z@dbd�ZAdceA_BdS)e�N�	dataclass�field�Field�FrozenInstanceError�InitVar�MISSING�fields�asdict�astuple�make_dataclass�replace�is_dataclassc@seZdZdS)rN��__name__�
__module__�__qualname__�rr�0/opt/alt/python38/lib64/python3.8/dataclasses.pyr�sc@seZdZdd�ZdS)�_HAS_DEFAULT_FACTORY_CLASScCsdS)Nz	<factory>r��selfrrr�__repr__�sz#_HAS_DEFAULT_FACTORY_CLASS.__repr__N)rrrrrrrrr�src@seZdZdS)�
_MISSING_TYPENrrrrrr�src@seZdZdd�Zdd�ZdS)�_FIELD_BASEcCs
||_dS�N��name�rrrrr�__init__�sz_FIELD_BASE.__init__cCs|jSrrrrrrr�sz_FIELD_BASE.__repr__N)rrrrrrrrrr�sr�_FIELD�_FIELD_CLASSVAR�_FIELD_INITVARZ__dataclass_fields__Z__dataclass_params__Z
__post_init__z^(?:\s*(\w+)\s*\.)?\s*(\w+)c@seZdZdd�ZdS)�_InitVarMetacCst|�Sr)r)rZparamsrrr�__getitem__�sz_InitVarMeta.__getitem__N)rrrr#rrrrr"�sr"c@s eZdZdZdd�Zdd�ZdS)r��typecCs
||_dSrr$)rr%rrrr�szInitVar.__init__cCs,t|jt�r|jj}n
t|j�}d|�d�S)Nzdataclasses.InitVar[�])�
isinstancer%r�repr)rZ	type_namerrrr�s

zInitVar.__repr__N�rrr�	__slots__rrrrrrr�s)�	metaclassc@s(eZdZdZdd�Zdd�Zdd�ZdS)	r)
rr%�default�default_factoryr(�hash�init�compare�metadata�_field_typecCsRd|_d|_||_||_||_||_||_||_|dkr<tnt	�
|�|_d|_dSr)
rr%r,r-r/r(r.r0�_EMPTY_METADATA�types�MappingProxyTyper1r2)rr,r-r/r(r.r0r1rrrr�s��zField.__init__cCsVd|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
,_field_type=�))
rr%r,r-r/r(r.r0r1r2rrrrrszField.__repr__cCs(tt|j�dd�}|r$||j||�dS)N�__set_name__)�getattrr%r,)r�ownerr�funcrrrr8szField.__set_name__N)rrrr*rrr8rrrrr�sc@s eZdZdZdd�Zdd�ZdS)�_DataclassParams�r/r(�eq�order�unsafe_hash�frozencCs(||_||_||_||_||_||_dSrr=)rr/r(r>r?r@rArrrr*sz_DataclassParams.__init__c
Cs6d|j�d|j�d|j�d|j�d|j�d|j�d�
S)Nz_DataclassParams(init=r6z,eq=z,order=z
,unsafe_hash=z,frozen=r7r=rrrrr2sz_DataclassParams.__repr__Nr)rrrrr<!sr<T�r,r-r/r(r.r0r1cCs,|tk	r|tk	rtd��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.

    It is an error to specify both default and default_factory.
    z/cannot specify both default and default_factory)r�
ValueErrorrrBrrrr@s
�cs(|sdSdd��fdd�|D���d�S)N�()�(�,csg|]}��d|j���qS)�.r��.0�f��obj_namerr�
<listcomp>_sz_tuple_str.<locals>.<listcomp>�,))�join)rLrrrKr�
_tuple_strVsrPcs"t��t�����fdd��}|S)Nc	sDt|�t��f}|�krdS��|�z�|�}W5��|�X|S)Nz...)�id�_thread�	get_ident�add�discard)r�key�result��repr_running�
user_functionrr�wrapperis
z _recursive_repr.<locals>.wrapper)�set�	functools�wraps)rZr[rrXr�_recursive_reprds
r_)�globals�locals�return_typec
Cs�|dkri}d|krt|d<d}|tk	r4||d<d}d�|�}d�dd�|D��}d	|�d
|�d|�d|��}d
�|���}d|�d|�d|��}i}	t|||	�|	df|�S)NZBUILTINS�Z_return_typez->_return_typerF�
css|]}d|��VqdS)z  Nr)rI�brrr�	<genexpr>�sz_create_fn.<locals>.<genexpr>z def rEr7z:
�, zdef __create_fn__(z):
z	
 return Z
__create_fn__)�builtinsrrO�keys�exec)
r�argsZbodyr`rarbZreturn_annotationZtxtZ
local_vars�nsrrr�
_create_fnws 
rmcCs0|rd|�d|�d|�d�S|�d|�d|��S)NzBUILTINS.object.__setattr__(rFr7rG�=r)rAr�value�	self_namerrr�
_field_assign�srqcCs�d|j��}|jtk	rV|jr@|j||<|�d|j�d|j��}q�|j||<|�d�}n8|jr�|jtkrn|j}q�|jtk	r�|j||<|j}ndS|jtkr�dSt||j||�S)NZ_dflt_z() if z is _HAS_DEFAULT_FACTORY else rD)rr-rr/r,r2r!rq)rJrAr`rpZdefault_namerorrr�_field_init�s"






rrcCsV|jtkr|jtkrd}n&|jtk	r2d|j��}n|jtk	r@d}|j�d|j�|��S)Nrcz=_dflt_z=_HAS_DEFAULT_FACTORYz:_type_)r,rr-r)rJr,rrr�_init_param�s

rscCs�d}|D]:}|jr|jtkr&|jtks,d}q|rtd|j�d���qdd�|D�}|�ttd��g}|D] }t||||�}	|	rj|�	|	�qj|r�d�
d	d
�|D��}
|�	|�dt�d|
�d
��|s�dg}td|gdd�|D�|||dd�S)NFTznon-default argument z follows default argumentcSsi|]}d|j��|j�qS)Z_type_)rr%rHrrr�
<dictcomp>�s
z_init_fn.<locals>.<dictcomp>)r�_HAS_DEFAULT_FACTORYrFcss|]}|jtkr|jVqdSr)r2r!rrHrrrrf	s
�z_init_fn.<locals>.<genexpr>rGrEr7�passrcSsg|]}|jrt|��qSr)r/rsrHrrrrMsz_init_fn.<locals>.<listcomp>)rar`rb)
r/r,rr-�	TypeErrorr�updaterurr�appendrO�_POST_INIT_NAMErm)rrA�
has_post_initrpr`Zseen_defaultrJraZ
body_lines�lineZ
params_strrrr�_init_fn�s:��r}cCs2tdddd�dd�|D��dg|d�}t|�S)	Nrrz(return self.__class__.__qualname__ + f"(rgcSs g|]}|j�d|j�d��qS)z={self.z!r}rrHrrrrMs�z_repr_fn.<locals>.<listcomp>z)"�r`)rmrOr_)rr`�fnrrr�_repr_fns
����r�cCsp|td�}|r,dd�dd�|D��d}nd}tdd	d
|�d�dd
f||d�tddd
|�d�ddf||d�fS)N)�clsrrErFcss|]}t|j�VqdSr)r(rrHrrrrf(sz'_frozen_get_del_attr.<locals>.<genexpr>rNrD�__setattr__)rrroz 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))rar`�__delattr__rz; raise FrozenInstanceError(f"cannot delete field {name!r}")z"super(cls, self).__delattr__(name))rrOrm)r�rr`raZ
fields_strrrr�_frozen_get_del_attr$s2�
��
���r�cCs$t|ddd|�|�|��dg|d�S)N)r�otherz%if other.__class__ is self.__class__:z return zreturn NotImplementedr~)rm)r�op�
self_tuple�other_tupler`rrr�_cmp_fn=s��r�cCs$td|�}tddd|�d�g|d�S)Nr�__hash__rzreturn hash(r7r~)rPrm)rr`r�rrr�_hash_fnKs
�r�cCs$||jkp"t|�|jko"|j|jkSr)�ClassVarr%Z
_GenericAliasZ
__origin__)�a_type�typingrrr�_is_classvarSs

�r�cCs||jkpt|�|jkSr)rr%)r��dataclassesrrr�_is_initvar[s
�r�c	Cs�t�|�}|r�d}|�d�}|s2tj�|j�j}n2tj�|j�}|rd|j�|�|krdtj�|j�j}|r�||�|�d��|�r�dSdS)N��TF)�_MODULE_IDENTIFIER_RE�match�group�sys�modules�getr�__dict__)	Z
annotationr�Za_moduler�Zis_type_predicater�rlZmodule_name�modulerrr�_is_typebs)

r�cCs8t||t�}t|t�r|}nt|tj�r,t}t|d�}||_||_t	|_
tj�
d�}|r�t||�s�t|jt�r�t|j|||jt�r�t|_
|j
t	kr�tjt}t||�s�t|jt�r�t|j|||jt�r�t|_
|j
ttfkr�|jtk	r�td|j�d���|j
t	k�r4t|jtttf��r4tdt|j��d|j�d���|S)N)r,r��field z cannot have a default factoryzmutable default z for field z$ is not allowed: use default_factory)r9rr'rr4�MemberDescriptorTyperrr%rr2r�r�r�r��strr�r�r rr�rr!r-rwr,�list�dictr\rC)r�Za_namer�r,rJr�r�rrr�
_get_field�sF



���



���
	 r�cCs||jkrdSt|||�dS)NTF)r��setattr)r�rrorrr�_set_new_attribute�s
r�cCsdSrr�r�rr`rrr�_hash_set_none�sr�cCsdd�|D�}t||�S)NcSs(g|] }|jdkr|jrn|jr|�qSr)r.r0rHrrrrMs

z_hash_add.<locals>.<listcomp>)r�)r�rr`�fldsrrr�	_hash_addsr�cCstd|j����dS)Nz-Cannot overwrite attribute __hash__ in class )rwrr�rrr�_hash_exceptionsr�))FFFF)FFFT)FFTF)FFTT)FTFF)FTFT)FTTF)FTTT)TFFF)TFFT)TFTF)TFTT)TTFF)TTFT)TTTF)TTTTcs�i}�jtjkr tj�jj}ni}t�tt||||||��d}	d}
�jddd�D]D}t|t	d�}|dk	rVd}
|�
�D]}
|
||
j<qzt|t�jrVd}	qV�j�
di�}�fdd�|��D�}|D]L}
|
||
j<tt�|
jd�t�r�|
jtk�rt�|
j�q�t�|
j|
j�qĈj��D].\}}t|t��r||k�rt|�d����q|
�rz|	�rf|�sftd	��|	�sz|�rztd
��t�t	|��j�
dt�}|tk�p�|dk�o�d�jk}|�r�|�s�td
��|�rt�t�}dd�|�
�D�}t�dt|||d|k�rdnd|��dd�|�
�D�}|�rHdd�|D�}t�dt||��|�r�dd�|D�}td|�}td|�}t�dtdd|||d��|�r�dd�|D�}td|�}td|�}dD]>\}}t�|t|||||d���r�td|�d�j�d����q�|�r8t�||�D].}t�|j|��rtd|j�d�j�����qtt |�t |�t |�|f}|�rh|�||��_!t�d��s��jt"t#�$����%dd ��_&�S)!NF���rT�__annotations__csg|]\}}t�||��qSr)r�)rIrr%�r�rrrM]s�z"_process_class.<locals>.<listcomp>z& 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|]}|jttfkr|�qSr)r2rr!rHrrrrM�s�rrZ__dataclass_self__cSsg|]}|jtkr|�qSr�r2rrHrrrrM�s
cSsg|]}|jr|�qSr)r(rHrrrrM�srcSsg|]}|jr|�qSr�r0rHrrrrM�sr�z==r~cSsg|]}|jr|�qSrr�rHrrrrM�s))�__lt__�<)�__le__z<=)�__gt__�>)�__ge__z>=zCannot overwrite attribute z
 in class z). Consider using functools.total_ordering�__doc__z -> Nonerc)'rr�r�r�r��_PARAMSr<�__mro__r9�_FIELDS�valuesrrAr��itemsr'rr,r�delattrrwrC�hasattrrzr�r}r�rPr�rr��_hash_action�boolr�r��inspectZ	signaturerr�)r�r/r(r>r?r@rArr`Zany_frozen_baseZhas_dataclass_basesreZbase_fieldsrJZcls_annotationsZ
cls_fieldsrroZ
class_hashZhas_explicit_hashr{r�Z
field_listr�r�r�rZhash_actionrr�r�_process_class's��
�

�
��

��


����r�Fr=cs*������fdd�}|dkr"|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.
    cst|�������Sr)r�r��r>rAr/r?r(r@rr�wrap�szdataclass.<locals>.wrapNr)r�r/r(r>r?r@rAr�rr�rr�scCsBzt|t�}Wntk
r*td��YnXtdd�|��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 instancecss|]}|jtkr|VqdSrr�rHrrrrf
s
zfields.<locals>.<genexpr>)r9r��AttributeErrorrw�tupler�)Zclass_or_instancerrrrr�s
cCstt|�t�S)z2Returns True if obj is an instance of a dataclass.)r�r%r�)�objrrr�_is_dataclass_instancesr�cCs t|t�r|nt|�}t|t�S)zEReturns True if obj is a dataclass or an instance of a
    dataclass.)r'r%r�r�)r�r�rrrr
s��dict_factorycCst|�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�rw�
_asdict_inner)r�r�rrrr	scs�t|�rDg}t|�D]&}tt||j���}|�|j|f�q�|�St|t�rrt|d�rrt	|��fdd�|D��St|t
tf�r�t	|��fdd�|D��St|t�r�t	|��fdd�|��D��St
�|�SdS)N�_fieldscsg|]}t|���qSr�r��rI�vr�rrrMOsz!_asdict_inner.<locals>.<listcomp>c3s|]}t|��VqdSrr�r�r�rrrfTsz _asdict_inner.<locals>.<genexpr>c3s&|]\}}t|��t|��fVqdSrr��rI�kr�r�rrrfVs��)r�rr�r9rryr'r�r�r%r�r�r��copy�deepcopy)r�r�rWrJrorr�rr�4s
�r���
tuple_factorycCst|�std��t||�S)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�rw�_astuple_inner)r�r�rrrr
]scs�t|�r>g}t|�D] }tt||j���}|�|�q�|�St|t�rlt|d�rlt	|��fdd�|D��St|t
tf�r�t	|��fdd�|D��St|t�r�t	|��fdd�|��D��St
�|�SdS)Nr�csg|]}t|���qSr�r�r�r�rrrM�sz"_astuple_inner.<locals>.<listcomp>c3s|]}t|��VqdSrr�r�r�rrrf�sz!_astuple_inner.<locals>.<genexpr>c3s&|]\}}t|��t|��fVqdSrr�r�r�rrrf�s�)r�rr�r9rryr'r�r�r%r�r�r�r�r�)r�r�rWrJrorr�rr�us
�r�r)�bases�	namespacer/r(r>r?r@rAc	s�dkri�n����t�}
i}|D]�}t|t�r<|}
d}nDt|�dkrR|\}
}n.t|�dkrr|\}
}}|�|
<ntd|����t|
t�r�|
��s�td|
����t�|
�r�td|
����|
|
kr�td|
����|
�	|
�|||
<q$|�d	<t
�||i�fd
d��}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: r�cs
|���Sr)rx)rl�r�rr�<lambda>��z make_dataclass.<locals>.<lambda>r=)
r�r\r'r��lenrw�isidentifier�keyword�	iskeywordrTr4�	new_classr)Zcls_namerr�r�r/r(r>r?r@rA�seenZanns�itemr�tp�specr�rr�rr�s:






�cOst|�dkr tdt|��d���|r,|\}n4d|krX|�d�}ddl}|jdtdd	�ntd
��t|�sptd��t|t��	�D]v}|j
tkr�q~|js�|j
|kr~td|j
�d
���q~|j
|kr~|j
tkr�|jtkr�td|j
�d���t||j
�||j
<q~|jf|�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
      r�z*replace() takes 1 positional argument but z were givenr�rNz/Passing 'obj' as keyword argument is deprecatedr�)�
stacklevelz7replace() missing 1 required positional argument: 'obj'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())r�rw�pop�warnings�warn�DeprecationWarningr�r9r�r�r2r r/rrCr!r,r�	__class__)rkZchangesr�r�rJrrrr�s4
�


z(obj, /, **kwargs))N)C�rer�r�r4r�r�rhr]rR�__all__r�rrrurrr5r3rrr r!r�r�rz�compiler�r%r"rrr<rrPr_rmrqrrrsr}r�r�r�r�r�r�r�r�r�r�r�r�r�r�rrr�r
r�r	r�r�r
r�rr�__text_signature__rrrr�<module>s��

:��62;R�>
�)�B<

Zerion Mini Shell 1.0