/usr/local/lib/python3.6/site-packages/__pycache__
NameSizeModeActions
dataclasses.cpython-36.pyc217030644editdlrm
idna_ssl.cpython-36.pyc9480644editdlrm
six.cpython-36.pyc275270644editdlrm
typing_extensions.cpython-36.pyc957310644editdlrm
zipp.cpython-36.pyc100530644editdlrm
Edit: /usr/local/lib/python3.6/site-packages/__pycache__/dataclasses.cpython-36.pyc (21703B)
3 `TBg"@sddlZddlZddlZddlZddlZddlZdddddddd d d d d g ZGdddeZGdddZ e Z GdddZ e Z ej iZGdddZedZedZedZdZdZdZejdZGdddeZGdddedZGd ddZGd!d"d"Ze e d#d#dd#dd$d%dZd&d'Zdde d(d)d*Zd+d,Z d-d.Z!d/d0Z"d1d2Z#d3d4Z$d5d6Z%d7d8Z&d9d:Z'd;d<Z(d=d>Z)d?d@Z*dAdBZ+dCdDZ,dEdFZ-dGdHZ.dIdJZ/d_dd`ddaddbddce-ddddee.dfddge.dhe/die.dje/dke.dle/dme.dne/iZ0dLdMZ1dod#d#d#dKdKdKdNdOdZ2dPdZ3dQdRZ4dSd Z5e6dTdUd Z7dVdWZ8e9dXdYd Z:dZd[Z;fdd#d#d#dKdKdKd\d]d Zr)selfrrr__repr__sz#_HAS_DEFAULT_FACTORY_CLASS.__repr__N)rrrrrrrrrsrc@s eZdZdS) _MISSING_TYPEN)rrrrrrrrsrc@seZdZddZddZdS) _FIELD_BASEcCs ||_dS)N)name)rrrrr__init__sz_FIELD_BASE.__init__cCs|jS)N)r)rrrrrsz_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) _InitVarMetacCs|S)Nr)rparamsrrr __getitem__sz_InitVarMeta.__getitem__N)rrrrrrrrrsrc@s eZdZdS)rN)rrrrrrrrs) metaclassc @s(eZdZdZd d Zd dZddZdS)rrtypedefaultdefault_factoryreprhashinitcomparemetadata _field_typecCs^d|_d|_||_||_||_||_||_||_|dksDt|dkrHt nt j ||_ d|_ dS)Nr)rr!r"r#r&r$r%r'len_EMPTY_METADATAtypesMappingProxyTyper(r))rr"r#r&r$r%r'r(rrrrs zField.__init__cCsVd|jd|jd|jd|jd|jd|jd|jd|jd |jd |j d S) Nz Field(name=z,type=z ,default=z,default_factory=z,init=z,repr=z,hash=z ,compare=z ,metadata=z ,_field_type=)) rr!r"r#r&r$r%r'r(r))rrrrrszField.__repr__cCs(tt|jdd}|r$||j||dS)N __set_name__)getattrr!r")rownerrfuncrrrr/ szField.__set_name__N) rr!r"r#r$r%r&r'r(r))rrr __slots__rrr/rrrrrsc@s eZdZd ZddZd d Zd S) _DataclassParamsr&r$eqorder unsafe_hashfrozencCs(||_||_||_||_||_||_dS)N)r&r$r5r6r7r8)rr&r$r5r6r7r8rrrrs z_DataclassParams.__init__c Cs6d|jd|jd|jd|jd|jd|jd S)Nz_DataclassParams(init=z,repr=z,eq=z,order=z ,unsafe_hash=z,frozen=r.)r&r$r5r6r7r8)rrrrr#sz_DataclassParams.__repr__N)r&r$r5r6r7r8)rrrr3rrrrrrr4sr4T)r"r#r&r$r%r'r(cCs,|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 ValueErrorr)r"r#r&r$r%r'r(rrrr1scs(|sdSddjfdd|DdS)Nz()(,csg|]}d|jqS).)r).0f)obj_namerr Psz_tuple_str..z,))join)r?rr)r?r _tuple_strGsrB)globalslocals return_typecCsr|dkr i}d}|tk r$||d<d}dj|}djdd|D}d|d |d |d |}t|||||S) NZ _return_typez->_return_typer; css|]}d|VqdS) Nr)r=brrr _sz_create_fn..zdef r:r.z: )rrAexec)rargsbodyrCrDrEZreturn_annotationtxtrrr _create_fnSs  rOcCs0|rd|d|d|dS|d|d|S)Nzobject.__setattr__(r;r.r<=r)r8rvalue self_namerrr _field_assignhsrScCsd|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 z())rr#rr&r"r)rrS)r>r8rCrR default_namerQrrr _field_initts"         rUcCsV|jtkr|jtkrd}n&|jtk r2d|j}n|jtk r@d}|jd|j|S)NrFz=_dflt_z=_HAS_DEFAULT_FACTORYz:_type_)r"rr#r)r>r"rrr _init_params  rVc Csd}xB|D]:}|jr |jtko&|jtks.d}q |r td|jdq Wttd}g}x(|D] }t||||}|r\|j|q\W|rdj dd|D} |j|d t d | d |sd g}d d|D} t d|gdd|D|| |ddS)NFTznon-default argument z follows default argument)r_HAS_DEFAULT_FACTORYr;css|]}|jtkr|jVqdS)N)r)rr)r=r>rrrrJsz_init_fn..r<r:r.passcSsi|]}|jd|jqS)_type_)r!r)r=r>rrr sz_init_fn..rcSsg|]}|jrt|qSr)r&rV)r=r>rrrr@sz_init_fn..)rDrCrE) r&r"rr# TypeErrorrrWrUappendrA_POST_INIT_NAMErO) rr8 has_post_initrRZ seen_defaultr>rCZ body_lineslineZ params_strrDrrr_init_fns4  r`cCs&tddddjdd|DdgS) Nrrz(return self.__class__.__qualname__ + f"(z, cSs g|]}|jd|jdqS)z={self.z!r})r)r=r>rrrr@sz_repr_fn..z)")r)rOrA)rrrr_repr_fnsracCsl|td}|r,ddjdd|Dd}nd}tddd |d ddf|dtddd |d ddf|dfS)N)clsrr:r;css|]}t|jVqdS)N)r$r)r=r>rrrrJsz'_frozen_get_del_attr..z,)z() __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))rC __delattr__z; raise FrozenInstanceError(f"cannot delete field {name!r}")z"super(cls, self).__delattr__(name))rrrQ)rr)rrArO)rbrrCZ fields_strrrr_frozen_get_del_attrs"  rfcCs t|ddd|||dgS)Nrotherz%if other.__class__ is self.__class__:z return zreturn NotImplemented)rrg)rO)rop self_tuple other_tuplerrr_cmp_fns rkcCs td|}tddd|dgS)Nr__hash__z return hash(r.)r)rBrO)rrirrr_hash_fns rmcCst||jkS)N)r!Z _ClassVar)a_typetypingrrr _is_classvar#srpcCs ||jkS)N)r)rn dataclassesrrr _is_initvar)srrc Cstj|}|rd}|jd}|s2tjj|jj}n2tjj|j}|rd|jj||krdtjj|jj}|r||j|jd|rdSdS)NTF)_MODULE_IDENTIFIER_REmatchgroupsysmodulesgetr__dict__) Z annotationrbZa_modulernZis_type_predicatervns module_namemodulerrr_is_type/s)  rcCs8t||t}t|tr|}nt|tjr,t}t|d}||_||_t |_ t j j d}|rt||st|jtrt|j|||jtrt|_ |j t krt j t}t||st|jtrt|j|||jtrt|_ |j ttfkr|jtk rtd|jd|j t kr4t|jtttfr4tdt|jd|jd|S)N)r"rozfield z cannot have a default factoryzmutable default z for field z$ is not allowed: use default_factory)r0r isinstancerr,MemberDescriptorTyperrr!rr)rxryrzrpstrrZClassVarrrrrrrr#r[r"listdictsetr9)rbZa_namernr"r>rorqrrr _get_fieldjs:             rcCs||jkrdSt|||dS)NTF)r{setattr)rbrrQrrr_set_new_attributes  rcCsdS)Nr)rbrrrr_hash_set_nonesrcCsdd|D}t|S)NcSs&g|]}|jdkr|jn|jr|qS)N)r%r')r=r>rrrr@sz_hash_add..)rm)rbrfldsrrr _hash_addsrcCstd|jdS)Nz-Cannot overwrite attribute __hash__ in class )r[r)rbrrrr_hash_exceptionsrFc s~i}ttt||||||d}d} xXjd'dd(D]D} t| td} | r8d} x| jD]} | || j<qZWt| tjr8d}q8Wj j di} fdd| j D}xR|D]J} | || j<t t| jdt r| jtkrt| jqt| j| jqWx<j j D].\}}t |t r|| krt|dqW| rh|rR| rRtd | rh|rhtd tt|j j d t}|tkp|dkod j k }|r| rtd |rtt}dd|jD}tdt|||d|krdnddd|jD}|r4dd|D}tdt||rrdd|D}td|}td|}td td d|||rdd|D}td|}td|}xBd-D]:\}}t|t||||rtd!|d"jd#qW|r"x.z& is a field but has no type annotationz5cannot inherit non-frozen dataclass from a frozen onez5cannot inherit frozen dataclass from a non-frozen onerl__eq__z eq must be true if order is truecSsg|]}|jttfkr|qSr)r)rr)r=r>rrrr@]srrZ__dataclass_self__cSsg|]}|jtkr|qSr)r)r)r=r>rrrr@lscSsg|]}|jr|qSr)r$)r=r>rrrr@osrcSsg|]}|jr|qSr)r')r=r>rrrr@usrgz==cSsg|]}|jr|qSr)r')r=r>rrrr@~s__lt__<__le__<=__gt__>__ge__>=zCannot overwrite attribute z in class z). Consider using functools.total_ordering__doc__z -> NonerFrrrrrrrrr)rrrr)$r_PARAMSr4__mro__r0_FIELDSvaluesrr8r{rzitemsrrr"rdelattrr[r9hasattrr]rr`rarBrkrrf _hash_actionboolrlrinspect signaturer r)rbr&r$r5r6r7r8rZany_frozen_baseZhas_dataclass_basesrIZ base_fieldsr>Zcls_annotationsZ cls_fieldsrrQZ class_hashZhas_explicit_hashr^rZ field_listrirjrhfnZ hash_actionr)rbr_process_classs                   r)r&r$r5r6r7r8cs*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|S)N)r)rb)r5r8r&r6r$r7rrwrapszdataclass..wrapNr)_clsr&r$r5r6r7r8rr)r5r8r&r6r$r7rrsc CsByt|t}Wntk r*tdYnXtdd|jDS)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|VqdS)N)r)r)r=r>rrrrJszfields..)r0rAttributeErrorr[tupler)Zclass_or_instancerrrrrs cCst|t ot|tS)z2Returns True if obj is an instance of a dataclass.)rr!rr)objrrr_is_dataclass_instancesrcCs t|tS)zEReturns True if obj is a dataclass or an instance of a dataclass.)rr)rrrrr 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)rr[ _asdict_inner)rrrrrr scst|rHg}x2t|D]&}tt||j}|j|j|fqW|St|ttfrpt |fdd|DSt|t rt |fdd|j DSt j |SdS)Nc3s|]}t|VqdS)N)r)r=v)rrrrJsz _asdict_inner..c3s&|]\}}t|t|fVqdS)N)r)r=kr)rrrrJs)rrrr0rr\rrrr!rrcopydeepcopy)rrresultr>rQr)rrrs 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)rr[_astuple_inner)rrrrrr scst|rBg}x,t|D] }tt||j}|j|qW|St|ttfrjt |fdd|DSt|t rt |fdd|j DSt j |SdS)Nc3s|]}t|VqdS)N)r)r=r)rrrrJ&sz!_astuple_inner..c3s&|]\}}t|t|fVqdS)N)r)r=rr)rrrrJ(s)rrrr0rr\rrrr!rrrr)rrrr>rQr)rrrs r)bases namespacer&r$r5r6r7r8c s dkrinjt} i} x|D]} t| tr>| } d}nDt| dkrT| \} }n.t| dkrt| \} }}|| <ntd| t| t s| j rtd| tj| rtd| | | krtd| | j | || | <q&W| d <t j ||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.AnyrtzInvalid field: z&Field names must be valid identifers: z"Field names must not be keywords: zField name duplicated: rcs |jS)N)update)r|)rrrksz make_dataclass..)r&r$r5r6r7r8) rrrrr*r[ isidentifierkeyword iskeywordaddr, new_classr)Zcls_namerrrr&r$r5r6r7r8seenZannsitemrtpspecrbr)rrr .s6           cKst|stdx~t|tjD]l}|jtkr0q |jsT|j|kr t d|jdq |j|kr |jt krzt d|jdt||j||j<q W|j f|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 instanceszfield zC is declared with init=False, it cannot be specified with replace()zInitVar z! must be specified with replace()) rr[r0rrr)rr&rr9r __class__)rZchangesr>rrrr ps    )FFFF)FFFT)FFTF)FFTT)FTFF)FTFT)FTTF)FTTT)TFFF)TFFT)TFTF)TFTT)TTFF)TTFT)TTTF)TTTT)N)>rerxrr,rr__all__rrrrWrrr-r+rrrrrrr]compilerur!rrrr4rrBrOrSrUrVr`rarfrkrmrprrrrrrrrrrrrrr rr rrr rr r rrrrs  :  60  ;R4 @