%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /usr/local/lib/python3.8/__pycache__/
Upload File :
Create Path :
Current File : //usr/local/lib/python3.8/__pycache__/dataclasses.cpython-38.pyc

U

na5@sddlZddlZddlZddlZddlZddlZddlZddlZddlZdddddddd	d
ddd
gZ	Gddde
ZGdddZeZ
GdddZeZeiZGdddZedZedZedZdZdZdZedZGdddeZGdddedZGd ddZGd!d"d"Zeed#d#dd#dd$d%dZ d&d'Z!d(d)Z"dded*d+d,Z#d-d.Z$d/d0Z%d1d2Z&d3d4Z'd5d6Z(d7d8Z)d9d:Z*d;d<Z+d=d>Z,d?d@Z-dAdBZ.dCdDZ/dEdFZ0dGdHZ1dIdJZ2dKdLZ3dddde1de2de2e3e2e3e2e3e2e3dMZ4dNdOZ5ddd#d#d#dPdPdPdQdRdZ6dSdZ7dTdUZ8dVd
Z9e:dWdXd	Z;dYdZZ<e=d[d\d
Z>d]d^Z?d_dd#d#d#dPdPdPd`dadZ@dbdZAdceA_BdS)eN	dataclassfieldFieldFrozenInstanceErrorInitVarMISSINGfieldsasdictastuplemake_dataclassreplaceis_dataclassc@seZdZdS)rN__name__
__module____qualname__rr'/usr/local/lib/python3.8/dataclasses.pyrsc@seZdZddZdS)_HAS_DEFAULT_FACTORY_CLASScCsdS)Nz	<factory>rselfrrr__repr__sz#_HAS_DEFAULT_FACTORY_CLASS.__repr__N)rrrrrrrrrsrc@seZdZdS)
_MISSING_TYPENrrrrrrsrc@seZdZddZddZdS)_FIELD_BASEcCs
||_dSNnamerrrrr__init__sz_FIELD_BASE.__init__cCs|jSrrrrrrrsz_FIELD_BASE.__repr__N)rrrrrrrrrrsr_FIELD_FIELD_CLASSVAR_FIELD_INITVARZ__dataclass_fields__Z__dataclass_params__Z
__post_init__z^(?:\s*(\w+)\s*\.)?\s*(\w+)c@seZdZddZdS)_InitVarMetacCst|Sr)r)rparamsrrr__getitem__sz_InitVarMeta.__getitem__N)rrrr$rrrrr"sr"c@s eZdZdZddZddZdS)rtypecCs
||_dSrr%)rr&rrrrszInitVar.__init__cCs,t|jtr|jj}n
t|j}d|dS)Nzdataclasses.InitVar[])
isinstancer&rrepr)r	type_namerrrrs

zInitVar.__repr__Nrrr	__slots__rrrrrrrs)	metaclassc@s(eZdZdZddZddZddZdS)	r)
rr&defaultdefault_factoryr)hashinitcomparemetadata_field_typecCsRd|_d|_||_||_||_||_||_||_|dkr<tnt	
||_d|_dSr)
rr&r.r/r1r)r0r2_EMPTY_METADATAtypesMappingProxyTyper3r4)rr.r/r1r)r0r2r3rrrrszField.__init__cCsVd|jd|jd|jd|jd|jd|jd|jd|jd	|jd
|j	dS)NzField(name=z,type=z	,default=z,default_factory=z,init=,repr=z,hash=z	,compare=z
,metadata=z
,_field_type=))
rr&r.r/r1r)r0r2r3r4rrrrrszField.__repr__cCs(tt|jdd}|r$||j||dS)N__set_name__)getattrr&r.)rownerrfuncrrrr:szField.__set_name__N)rrrr,rrr:rrrrrsc@s eZdZdZddZddZdS)_DataclassParamsr1r)eqorderunsafe_hashfrozencCs(||_||_||_||_||_||_dSrr?)rr1r)r@rArBrCrrrr*sz_DataclassParams.__init__c
Cs6d|jd|jd|jd|jd|jd|jd
S)Nz_DataclassParams(init=r8z,eq=z,order=z
,unsafe_hash=z,frozen=r9r?rrrrr2sz_DataclassParams.__repr__Nr+rrrrr>!sr>Tr.r/r1r)r0r2r3cCs,|tk	r|tk	rtdt|||||||S)aReturn 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
ValueErrorrrDrrrr@s
cs(|sdSddfdd|DdS)N()(,csg|]}d|jqS).r.0fobj_namerr
<listcomp>_sz_tuple_str.<locals>.<listcomp>,))join)rNrrrMr
_tuple_strVsrRcs"ttfdd}|S)Nc	sDt|tf}|krdS|z|}W5|X|S)Nz...)id_thread	get_identadddiscard)rkeyresultrepr_running
user_functionrrwrapperis
z _recursive_repr.<locals>.wrapper)set	functoolswraps)r\r]rrZr_recursive_reprds
ra)globalslocalsreturn_typec
Cs|dkri}d|krt|d<d}|tk	r4||d<d}d|}ddd|D}d	|d
|d|d|}d
|}d|d|d|}i}	t|||	|	df|S)NZBUILTINSZ_return_typez->_return_typerH
css|]}d|VqdS)z  Nr)rKbrrr	<genexpr>sz_create_fn.<locals>.<genexpr>z def rGr9z:
, zdef __create_fn__(z):
z	
 return Z
__create_fn__)builtinsrrQkeysexec)
rargsZbodyrbrcrdZreturn_annotationZtxtZ
local_varsnsrrr
_create_fnws 
rocCs0|rd|d|d|dS|d|d|S)NzBUILTINS.object.__setattr__(rHr9rI=r)rCrvalue	self_namerrr
_field_assignsrscCsd|j}|jtk	rV|jr@|j||<|d|jd|j}q|j||<|d}n8|jr|jtkrn|j}q|jtk	r|j||<|j}ndS|jtkrdSt||j||S)NZ_dflt_z() if z is _HAS_DEFAULT_FACTORY else rF)rr/rr1r.r4r!rs)rLrCrbrrZdefault_namerqrrr_field_inits"






rtcCsV|jtkr|jtkrd}n&|jtk	r2d|j}n|jtk	r@d}|jd|j|S)Nrez=_dflt_z=_HAS_DEFAULT_FACTORYz:_type_)r.rr/r)rLr.rrr_init_params

rucCsd}|D]:}|jr|jtkr&|jtks,d}q|rtd|jdqdd|D}|ttdg}|D] }t||||}	|	rj|	|	qj|rd
d	d
|D}
|	|dtd|
d
|sdg}td|gdd|D|||ddS)NFTznon-default argument z follows default argumentcSsi|]}d|j|jqS)Z_type_)rr&rJrrr
<dictcomp>s
z_init_fn.<locals>.<dictcomp>)r_HAS_DEFAULT_FACTORYrHcss|]}|jtkr|jVqdSr)r4r!rrJrrrrh	s
z_init_fn.<locals>.<genexpr>rIrGr9passrcSsg|]}|jrt|qSr)r1rurJrrrrOsz_init_fn.<locals>.<listcomp>)rcrbrd)
r1r.rr/	TypeErrorrupdaterwrtappendrQ_POST_INIT_NAMEro)rrC
has_post_initrrrbZseen_defaultrLrcZ
body_lineslineZ
params_strrrr_init_fns:rcCs2tdddddd|Ddg|d}t|S)	Nrrz(return self.__class__.__qualname__ + f"(ricSs g|]}|jd|jdqS)z={self.z!r}rrJrrrrOsz_repr_fn.<locals>.<listcomp>z)"rb)rorQra)rrbfnrrr_repr_fns
rcCsp|td}|r,dddd|Dd}nd}tdd	d
|ddd
f||dtddd
|dddf||dfS)N)clsrrGrHcss|]}t|jVqdSr)r)rrJrrrrh(sz'_frozen_get_del_attr.<locals>.<genexpr>rPrF__setattr__)rrrqz 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))rcrb__delattr__rz; raise FrozenInstanceError(f"cannot delete field {name!r}")z"super(cls, self).__delattr__(name))rrQro)rrrbrcZ
fields_strrrr_frozen_get_del_attr$s2

rcCs$t|ddd|||dg|dS)N)rotherz%if other.__class__ is self.__class__:z return zreturn NotImplementedr)ro)rop
self_tupleother_tuplerbrrr_cmp_fn=srcCs$td|}tddd|dg|dS)Nr__hash__rzreturn hash(r9r)rRro)rrbrrrr_hash_fnKs
rcCs$||jkp"t||jko"|j|jkSr)ClassVarr&Z
_GenericAliasZ
__origin__)a_typetypingrrr_is_classvarSs

rcCs||jkpt||jkSr)rr&)rdataclassesrrr_is_initvar[s
rc	Cst|}|rd}|d}|s2tj|jj}n2tj|j}|rd|j||krdtj|jj}|r|||d|rdSdS)NTF)_MODULE_IDENTIFIER_REmatchgroupsysmodulesgetr__dict__)	Z
annotationrZa_modulerZis_type_predicaterrnmodule_namemodulerrr_is_typebs)

rcCs8t||t}t|tr|}nt|tjr,t}t|d}||_||_t	|_
tj
d}|rt||st|jtrt|j|||jtrt|_
|j
t	krtjt}t||st|jtrt|j|||jtrt|_
|j
ttfkr|jtk	rtd|jd|j
t	kr4t|jtttfr4tdt|jd|jd|S)N)r.rfield z cannot have a default factoryzmutable default z for field z$ is not allowed: use default_factory)r;rr(rr6MemberDescriptorTyperrr&rr4rrrrstrrrr rrrr!r/ryr.listdictr^rE)rZa_namerr.rLrrrrr
_get_fieldsF








	 rcCs||jkrdSt|||dS)NTF)rsetattr)rrrqrrr_set_new_attributes
rcCsdSrrrrrbrrr_hash_set_nonesrcCsdd|D}t||S)NcSs(g|] }|jdkr|jrn|jr|qSr)r0r2rJrrrrOs

z_hash_add.<locals>.<listcomp>)r)rrrbfldsrrr	_hash_addsrcCstd|jdS)Nz-Cannot overwrite attribute __hash__ in class )ryrrrrr_hash_exceptionsr))FFFF)FFFT)FFTF)FFTT)FTFF)FTFT)FTTF)FTTT)TFFF)TFFT)TFTF)TFTT)TTFF)TTFT)TTTF)TTTTcsi}jtjkr tjjj}ni}ttt||||||d}	d}
jdddD]D}t|t	d}|dk	rVd}
|
D]}
|
||
j<qzt|tjrVd}	qVj
di}fdd|D}|D]L}
|
||
j<tt|
jdtr|
jtkrt|
jqt|
j|
jqĈjD].\}}t|tr||krt|dq|
rz|	rf|sftd	|	sz|rztd
tt	|j
dt}|tkp|dkodjk}|r|std
|rtt}dd|
D}tdt|||d|krdnd|dd|
D}|rHdd|D}tdt|||rdd|D}td|}td|}tdtdd|||d|rdd|D}td|}td|}dD]>\}}t|t|||||drtd|djdq|r8t||D].}t|j|rtd|jdjqtt |t |t ||f}|rh|||_!tdsjt"t#$%dd _&S)!NFrT__annotations__csg|]\}}t||qSr)r)rKrr&rrrrO]sz"_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)r4rr!rJrrrrOsrrZ__dataclass_self__cSsg|]}|jtkr|qSrr4rrJrrrrOs
cSsg|]}|jr|qSr)r)rJrrrrOsrcSsg|]}|jr|qSrr2rJrrrrOsrz==rcSsg|]}|jr|qSrrrJrrrrOs))__lt__<)__le__z<=)__gt__>)__ge__z>=zCannot overwrite attribute z
 in class z). Consider using functools.total_ordering__doc__z -> Nonere)'rrrrr_PARAMSr>__mro__r;_FIELDSvaluesrrCritemsr(rr.rdelattrryrEhasattrr|rrrrRrrr_hash_actionboolrrinspectZ	signaturerr)rr1r)r@rArBrCrrbZany_frozen_baseZhas_dataclass_basesrgZbase_fieldsrLZcls_annotationsZ
cls_fieldsrrqZ
class_hashZhas_explicit_hashr}rZ
field_listrrrrZhash_actionrrr_process_class's








rFr?cs*fdd}|dkr"|S||S)aReturns 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)rrr@rCr1rAr)rBrrwrapszdataclass.<locals>.wrapNr)rr1r)r@rArBrCrrrrrscCsBzt|t}Wntk
r*tdYnXtdd|DS)zReturn 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|VqdSrrrJrrrrh
s
zfields.<locals>.<genexpr>)r;rAttributeErrorrytupler)Zclass_or_instancerrrrrs
cCstt|tS)z2Returns True if obj is an instance of a dataclass.)rr&r)objrrr_is_dataclass_instancesrcCs t|tr|nt|}t|tS)zEReturns True if obj is a dataclass or an instance of a
    dataclass.)r(r&rr)rrrrrr
sdict_factorycCst|stdt||S)aReturn 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)rry
_asdict_inner)rrrrrr	scst|rDg}t|D]&}tt||j}||j|fq|St|trrt|drrt	|fdd|DSt|t
tfrt	|fdd|DSt|trt	|fdd|DSt
|SdS)N_fieldscsg|]}t|qSrrrKvrrrrOOsz!_asdict_inner.<locals>.<listcomp>c3s|]}t|VqdSrrrrrrrhTsz _asdict_inner.<locals>.<genexpr>c3s&|]\}}t|t|fVqdSrrrKkrrrrrhVs)rrrr;rr{r(rrr&rrrcopydeepcopy)rrrYrLrqrrrr4s
r
tuple_factorycCst|stdt||S)aReturn 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)rry_astuple_inner)rrrrrr
]scst|r>g}t|D] }tt||j}||q|St|trlt|drlt	|fdd|DSt|t
tfrt	|fdd|DSt|trt	|fdd|DSt
|SdS)Nrcsg|]}t|qSrrrrrrrOsz"_astuple_inner.<locals>.<listcomp>c3s|]}t|VqdSrrrrrrrhsz!_astuple_inner.<locals>.<genexpr>c3s&|]\}}t|t|fVqdSrrrrrrrhs)rrrr;rr{r(rrr&rrrrr)rrrYrLrqrrrrus
rr)bases	namespacer1r)r@rArBrCc	sdkrint}
i}|D]}t|tr<|}
d}nDt|dkrR|\}
}n.t|dkrr|\}
}}||
<ntd|t|
tr|
std|
t|
rtd|
|
|
krtd|
|
	|
|||
<q$|d	<t
||ifd
d}t|||||||	dS)
aReturn 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.AnyrzInvalid field: z'Field names must be valid identifiers: z"Field names must not be keywords: zField name duplicated: rcs
|Sr)rz)rnrrr<lambda>z make_dataclass.<locals>.<lambda>r?)
rr^r(rlenryisidentifierkeyword	iskeywordrVr6	new_classr)Zcls_namerrrr1r)r@rArBrCseenZannsitemrtpspecrrrrrs:






cOst|dkr tdt|d|r,|\}n4d|krX|d}ddl}|jdtdd	ntd
t|sptdt|t	D]v}|j
tkrq~|js|j
|kr~td|j
d
q~|j
|kr~|j
tkr|jtkrtd|j
dt||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
      rz*replace() takes 1 positional argument but z were givenrrNz/Passing 'obj' as keyword argument is deprecatedr)
stacklevelz7replace() missing 1 required positional argument: 'obj'z1replace() should be called on dataclass instancesrzC is declared with init=False, it cannot be specified with replace()zInitVar z! must be specified with replace())rrypopwarningswarnDeprecationWarningrr;rrr4r r1rrEr!r.r	__class__)rmZchangesrrrLrrrrs4



z(obj, /, **kwargs))N)Crerrr6rrrjr_rT__all__rrrrwrrr7r5rrr r!rrr|compilerr&r"rrr>rrRrarorsrtrurrrrrrrrrrrrrrrrrrr
rr	rrr
rrr__text_signature__rrrr<module>s

:62;R>
)B<

Zerion Mini Shell 1.0