/usr/lib/python3.10/__pycache__
NameSizeModeActions
abc.cpython-310.pyc67510644editdlrm
aifc.cpython-310.pyc246850644editdlrm
antigravity.cpython-310.pyc8220644editdlrm
argparse.cpython-310.pyc635390644editdlrm
ast.cpython-310.pyc557390644editdlrm
asynchat.cpython-310.pyc70250644editdlrm
asyncore.cpython-310.pyc160020644editdlrm
base64.cpython-310.pyc171620644editdlrm
bdb.cpython-310.pyc258320644editdlrm
binhex.cpython-310.pyc128700644editdlrm
bisect.cpython-310.pyc25880644editdlrm
bz2.cpython-310.pyc108700644editdlrm
calendar.cpython-310.pyc263030644editdlrm
cgi.cpython-310.pyc267230644editdlrm
cgitb.cpython-310.pyc99980644editdlrm
chunk.cpython-310.pyc48600644editdlrm
cmd.cpython-310.pyc127070644editdlrm
code.cpython-310.pyc99570644editdlrm
codecs.cpython-310.pyc332190644editdlrm
codeop.cpython-310.pyc55950644editdlrm
colorsys.cpython-310.pyc32650644editdlrm
compileall.cpython-310.pyc127330644editdlrm
configparser.cpython-310.pyc454580644editdlrm
contextlib.cpython-310.pyc208950644editdlrm
contextvars.cpython-310.pyc2460644editdlrm
copy.cpython-310.pyc69960644editdlrm
copyreg.cpython-310.pyc46830644editdlrm
cProfile.cpython-310.pyc51130644editdlrm
crypt.cpython-310.pyc35500644editdlrm
csv.cpython-310.pyc117980644editdlrm
dataclasses.cpython-310.pyc265780644editdlrm
datetime.cpython-310.pyc565330644editdlrm
decimal.cpython-310.pyc3620644editdlrm
difflib.cpython-310.pyc589050644editdlrm
dis.cpython-310.pyc156560644editdlrm
doctest.cpython-310.pyc761750644editdlrm
enum.cpython-310.pyc260630644editdlrm
filecmp.cpython-310.pyc87490644editdlrm
fileinput.cpython-310.pyc140720644editdlrm
fnmatch.cpython-310.pyc42440644editdlrm
fractions.cpython-310.pyc186000644editdlrm
ftplib.cpython-310.pyc290340644editdlrm
functools.cpython-310.pyc283350644editdlrm
genericpath.cpython-310.pyc39070644editdlrm
getopt.cpython-310.pyc63390644editdlrm
getpass.cpython-310.pyc42100644editdlrm
gettext.cpython-310.pyc182210644editdlrm
glob.cpython-310.pyc58520644editdlrm
graphlib.cpython-310.pyc76160644editdlrm
gzip.cpython-310.pyc185460644editdlrm
hashlib.cpython-310.pyc68450644editdlrm
heapq.cpython-310.pyc138650644editdlrm
hmac.cpython-310.pyc69730644editdlrm
imaplib.cpython-310.pyc423120644editdlrm
imghdr.cpython-310.pyc39050644editdlrm
imp.cpython-310.pyc97860644editdlrm
inspect.cpython-310.pyc851530644editdlrm
io.cpython-310.pyc36630644editdlrm
ipaddress.cpython-310.pyc626700644editdlrm
keyword.cpython-310.pyc9270644editdlrm
linecache.cpython-310.pyc41420644editdlrm
locale.cpython-310.pyc461540644editdlrm
lzma.cpython-310.pyc121000644editdlrm
mailbox.cpython-310.pyc600910644editdlrm
mailcap.cpython-310.pyc73200644editdlrm
mimetypes.cpython-310.pyc176190644editdlrm
modulefinder.cpython-310.pyc161660644editdlrm
netrc.cpython-310.pyc39330644editdlrm
nntplib.cpython-310.pyc316230644editdlrm
ntpath.cpython-310.pyc147040644editdlrm
nturl2path.cpython-310.pyc17470644editdlrm
numbers.cpython-310.pyc118660644editdlrm
opcode.cpython-310.pyc54470644editdlrm
operator.cpython-310.pyc135080644editdlrm
optparse.cpython-310.pyc477540644editdlrm
os.cpython-310.pyc315990644editdlrm
pathlib.cpython-310.pyc420520644editdlrm
pdb.cpython-310.pyc474400644editdlrm
pickle.cpython-310.pyc468820644editdlrm
pickletools.cpython-310.pyc677600644editdlrm
pipes.cpython-310.pyc77690644editdlrm
pkgutil.cpython-310.pyc183610644editdlrm
platform.cpython-310.pyc274290644editdlrm
plistlib.cpython-310.pyc237650644editdlrm
poplib.cpython-310.pyc135730644editdlrm
posixpath.cpython-310.pyc105600644editdlrm
pprint.cpython-310.pyc178750644editdlrm
profile.cpython-310.pyc143910644editdlrm
pstats.cpython-310.pyc236210644editdlrm
pty.cpython-310.pyc41430644editdlrm
pyclbr.cpython-310.pyc97750644editdlrm
pydoc.cpython-310.pyc856450644editdlrm
py_compile.cpython-310.pyc73390644editdlrm
queue.cpython-310.pyc107920644editdlrm
quopri.cpython-310.pyc57940644editdlrm
random.cpython-310.pyc227480644editdlrm
re.cpython-310.pyc142270644editdlrm
reprlib.cpython-310.pyc52500644editdlrm
rlcompleter.cpython-310.pyc59540644editdlrm
runpy.cpython-310.pyc94110644editdlrm
sched.cpython-310.pyc61150644editdlrm
secrets.cpython-310.pyc21750644editdlrm
selectors.cpython-310.pyc171050644editdlrm
shelve.cpython-310.pyc94920644editdlrm
shlex.cpython-310.pyc77820644editdlrm
shutil.cpython-310.pyc385360644editdlrm
signal.cpython-310.pyc29350644editdlrm
site.cpython-310.pyc179220644editdlrm
sitecustomize.cpython-310.pyc2250644editdlrm
smtpd.cpython-310.pyc261470644editdlrm
smtplib.cpython-310.pyc357660644editdlrm
sndhdr.cpython-310.pyc69620644editdlrm
socket.cpython-310.pyc289630644editdlrm
socketserver.cpython-310.pyc253470644editdlrm
sre_compile.cpython-310.pyc151940644editdlrm
sre_constants.cpython-310.pyc63570644editdlrm
sre_parse.cpython-310.pyc217550644editdlrm
ssl.cpython-310.pyc452710644editdlrm
stat.cpython-310.pyc42730644editdlrm
statistics.cpython-310.pyc370510644editdlrm
string.cpython-310.pyc71020644editdlrm
stringprep.cpython-310.pyc170750644editdlrm
struct.cpython-310.pyc3070644editdlrm
subprocess.cpython-310.pyc447410644editdlrm
sunau.cpython-310.pyc164820644editdlrm
symtable.cpython-310.pyc128350644editdlrm
sysconfig.cpython-310.pyc181510644editdlrm
tabnanny.cpython-310.pyc69500644editdlrm
tarfile.cpython-310.pyc715780644editdlrm
telnetlib.cpython-310.pyc185060644editdlrm
tempfile.cpython-310.pyc273390644editdlrm
textwrap.cpython-310.pyc138120644editdlrm
this.cpython-310.pyc12640644editdlrm
threading.cpython-310.pyc449690644editdlrm
timeit.cpython-310.pyc117690644editdlrm
token.cpython-310.pyc27380644editdlrm
tokenize.cpython-310.pyc171940644editdlrm
trace.cpython-310.pyc198700644editdlrm
traceback.cpython-310.pyc217120644editdlrm
tracemalloc.cpython-310.pyc175250644editdlrm
tty.cpython-310.pyc10790644editdlrm
turtle.cpython-310.pyc1288570644editdlrm
types.cpython-310.pyc95250644editdlrm
typing.cpython-310.pyc852770644editdlrm
uu.cpython-310.pyc38670644editdlrm
uuid.cpython-310.pyc224980644editdlrm
warnings.cpython-310.pyc136460644editdlrm
wave.cpython-310.pyc175940644editdlrm
weakref.cpython-310.pyc203430644editdlrm
webbrowser.cpython-310.pyc174630644editdlrm
xdrlib.cpython-310.pyc78800644editdlrm
zipapp.cpython-310.pyc60130644editdlrm
zipfile.cpython-310.pyc618450644editdlrm
zipimport.cpython-310.pyc170330644editdlrm
_aix_support.cpython-310.pyc28790644editdlrm
_bootsubprocess.cpython-310.pyc22940644editdlrm
_collections_abc.cpython-310.pyc329250644editdlrm
_compat_pickle.cpython-310.pyc58720644editdlrm
_compression.cpython-310.pyc45120644editdlrm
_distutils_system_mod.cpython-310.pyc54220644editdlrm
_markupbase.cpython-310.pyc75720644editdlrm
_osx_support.cpython-310.pyc115350644editdlrm
_pydecimal.cpython-310.pyc1577360644editdlrm
_pyio.cpython-310.pyc736540644editdlrm
_py_abc.cpython-310.pyc46830644editdlrm
_sitebuiltins.cpython-310.pyc35470644editdlrm
_strptime.cpython-310.pyc159450644editdlrm
_sysconfigdata__linux_x86_64-linux-gnu.cpython-310.pyc353850644editdlrm
_sysconfigdata__x86_64-linux-gnu.cpython-310.pyc353790644editdlrm
_threading_local.cpython-310.pyc65390644editdlrm
_weakrefset.cpython-310.pyc76080644editdlrm
__future__.cpython-310.pyc41310644editdlrm
__phello__.foo.cpython-310.pyc1300644editdlrm
Edit: /usr/lib/python3.10/__pycache__/dataclasses.cpython-310.pyc (26578B)
o 9jF @sddlZddlZddlZddlZddlZddlZddlZddlZddlZddl Z ddlm Z m Z gdZ Gddde ZGdddZeZGdd d ZeZGd d d ZeZeiZGd d d ZedZedZedZdZdZdZedZddZ GdddZ!GdddZ"GdddZ#eedddddeddd Z$d!d"Z%d#d$Z&dded%d&d'Z'd(d)Z(d*d+Z)d,d-Z*d.d/Z+d0d1Z,d2d3Z-d4d5Z.d6d7Z/d8d9Z0d:d;Z1dd?Z3d@dAZ4dBdCZ5dDdEZ6dFdGZ7dHdIZ8dJdKZ9idLddMddNddOddPe7dQddRe8dSddTe8dUe9dVe8dWe9dXe8dYe9dZe8d[e9Z:d\d]Z;d^d_Zd~ddddddddddddddde dfdgZ?dhdiZ@djdkZAdldmZBeCdndodpZDdqdrZEeFdsdtduZGdvdwZHdxddddddddddddddddy dzd{ZId|d}ZJdS)N) FunctionType GenericAlias) dataclassfieldFieldFrozenInstanceErrorInitVarKW_ONLYMISSINGfieldsasdictastuplemake_dataclassreplace is_dataclassc@ eZdZdS)rN__name__ __module__ __qualname__rr"/usr/lib/python3.10/dataclasses.pyrs rc@seZdZddZdS)_HAS_DEFAULT_FACTORY_CLASScCsdS)Nz rselfrrr__repr__z#_HAS_DEFAULT_FACTORY_CLASS.__repr__N)rrrrrrrrrs rc@r) _MISSING_TYPENrrrrrrrc@r) _KW_ONLY_TYPENrrrrrrrrc@seZdZddZddZdS) _FIELD_BASEcC ||_dSNnamerr$rrr__init__ z_FIELD_BASE.__init__cCs|jSr"r#rrrrrsz_FIELD_BASE.__repr__N)rrrr&rrrrrr s r _FIELD_FIELD_CLASSVAR_FIELD_INITVAR__dataclass_fields____dataclass_params__ __post_init__z^(?:\s*(\w+)\s*\.)?\s*(\w+)cs"ttfdd}|S)Nc sLt|tf}|vrdS|z |}W||S|w)Nz...)id_thread get_identadddiscard)rkeyresult repr_running user_functionrrwrappers    z _recursive_repr..wrapper)set functoolswraps)r7r8rr5r_recursive_reprs r<c@s(eZdZdZddZddZddZdS) rtypecCr!r"r=)rr>rrrr&r'zInitVar.__init__cCs8t|jtrt|jts|jj}nt|j}d|dS)Nzdataclasses.InitVar[]) isinstancer>rrrepr)r type_namerrrrs   zInitVar.__repr__cCst|Sr")r)clsr>rrr__class_getitem__szInitVar.__class_getitem__N)rrr __slots__r&rrDrrrrrs  rc@s4eZdZdZddZeddZddZee Z dS) r) r$r>defaultdefault_factoryrAhashinitcomparemetadatakw_only _field_typec CsXd|_d|_||_||_||_||_||_||_|durtnt ||_ ||_ d|_ dSr")r$r>rFrGrIrArHrJ_EMPTY_METADATAtypesMappingProxyTyperKrLrM) rrFrGrIrArHrJrKrLrrrr&s zField.__init__cCs^d|jd|jd|jd|jd|jd|jd|jd|jd |jd |j d |j d S) Nz Field(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>rFrGrIrArHrJrKrLrMrrrrr.s.   zField.__repr__cCs,tt|jdd}|r||j||dSdS)N __set_name__)getattrr>rF)rownerr$funcrrrrSFszField.__set_name__N) rrrrEr&r<rrS classmethodrrDrrrrrs   rc@s eZdZdZddZddZdS)_DataclassParamsrIrAeqorder unsafe_hashfrozencCs(||_||_||_||_||_||_dSr"rY)rrIrArZr[r\r]rrrr&Ys  z_DataclassParams.__init__c Cs6d|jd|jd|jd|jd|jd|jd S)Nz_DataclassParams(init=rQz,eq=z,order=z ,unsafe_hash=z,frozen=rRrYrrrrrasz_DataclassParams.__repr__N)rrrrEr&rrrrrrXPs rXTrFrGrIrArHrJrKrLc Cs.|tur |tur tdt||||||||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. 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 ValueErrorrr^rrrros rcCs$tdd|Dtdd|DfS)Ncss |] }|jr|js|VqdSr"rIrL.0frrr z(_fields_in_init_order..css |] }|jr|jr|VqdSr"r`rarrrrdre)tupler rrr_fields_in_init_ordersrhcs(|sdSddfdd|DdS)N()(,csg|] }d|jqS).r#raobj_namerr z_tuple_str..,))join)rnr rrmr _tuple_strs rs)globalslocals return_typec Cs|duri}d}|tur||d<d}d|}ddd|D}d|d |d |d |}d |}d |d|d|}i} t||| | ddi|S)N _return_typez->_return_typerk css|]}d|VqdS)z Nr)rbbrrrrdz_create_fn..z def rjrRz: , zdef __create_fn__(z): z return __create_fn__r)r rrkeysexec) r$argsbodyrtrurvreturn_annotationtxt local_varsnsrrr _create_fns  rcCs0|rd|d|d|dS|d|d|S)Nz*__dataclass_builtins_object__.__setattr__(rkrRrl=r)r]r$value self_namerrr _field_assignsrcCsd|j}|jtur+|jr |j||<|d|jd|j}n6|j||<|d}n+|jrE|jtur7|j}n|jturD|j||<|j}n|rT|jturT|j||<|}ndS|jtur]dSt||j||S)N_dflt_z() if z is _HAS_DEFAULT_FACTORY else ri)r$rGr rIrFrMr*r)rcr]rtrslots default_namerrrr _field_inits2          rcCsV|jtur |jtur d}n|jturd|j}n|jtur d}|jd|j|S)Nrwz=_dflt_z=_HAS_DEFAULT_FACTORYz:_type_)rFr rGr$)rcrFrrr _init_params  rcCsd}|D]} | jr!| jtur| jtusd}q|r!td| jdqdd|D} | tttdg} |D]} t | || ||} | rG| | q6|rbd d d |D} | |d t d | d | sgdg} dd|D}|r~|dg7}|dd|D7}t d|g|| | |ddS)NFTznon-default argument z follows default argumentcSsi|] }d|j|jqS)_type_)r$r>rarrr #rpz_init_fn..)r _HAS_DEFAULT_FACTORY__dataclass_builtins_object__rkcss |] }|jtur|jVqdSr")rMr*r$rarrrrd4s  z_init_fn..rlrjrRpasscSg|]}t|qSrrrarrrro<z_init_fn..*cSrrrrarrrroBrr&)rurtrv)rIrFr rG TypeErrorr$updaterobjectrappendrr_POST_INIT_NAMEr)r std_fieldskw_only_fieldsr] has_post_initrrtr seen_defaultrcru body_linesline params_str _init_paramsrrr_init_fnsH   rcCs2tdddddd|Ddg|d}t|S) Nrrz(return self.__class__.__qualname__ + f"(r|cSs g|] }|jd|jdqS)z={self.z!r}r#rarrrroOsz_repr_fn..z)"rt)rrrr<)r rtfnrrr_repr_fnKs rcCsp|td}|rdddd|Dd}nd}tdd d |d d d f||dtddd |d ddf||dfS)N)rCrrjrkcss|]}t|jVqdSr")rAr$rarrrrdZr{z'_frozen_get_del_attr..rqri __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))rurt __delattr__r%z; raise FrozenInstanceError(f"cannot delete field {name!r}")z"super(cls, self).__delattr__(name))rrrr)rCr rtru fields_strrrr_frozen_get_del_attrVs2  rcCs$t|ddd|||dg|dS)N)rotherz%if other.__class__ is self.__class__:z return zreturn NotImplementedr)r)r$op self_tuple other_tuplertrrr_cmp_fnosrcCs$td|}tddd|dg|dS)Nr__hash__rz return hash(rRr)rsr)r rtrrrr_hash_fn}s  rcCs$||jupt||juo|j|juSr")ClassVarr> _GenericAlias __origin__)a_typetypingrrr _is_classvars  rcCs||jup t||juSr")rr>r dataclassesrrr _is_initvars  rcCs ||juSr")r rrrr _is_kw_onlyr'rc Cst|}|rAd}|d}|stj|jj}ntj|j}|r2|j||ur2tj|jj}|rA|||d|rAdSdS)NTF)_MODULE_IDENTIFIER_REmatchgroupsysmodulesgetr__dict__) annotationrCa_moduleris_type_predicaterr module_namemodulerrr_is_types ) rcCs~t||t}t|tr|}n t|tjrt}t|d}||_||_t |_ t j d}|rDt||sAt|jtrDt|j|||jtrDt|_ |j t urft j t}t||sct|jtrft|j|||jtrft|_ |j ttfvr{|jtur{td|jd|j t tfvr|jtur||_n|j tusJ|jturtd|jd|j t urt|jtttfrtdt|jd|jd|S) N)rFrfield z cannot have a default factoryz$ is a ClassVar but specifies kw_onlyzmutable default z for field z$ is not allowed: use default_factory)rTr r@rrOMemberDescriptorTyperr$r>r(rMrrrrstrrrr)rrrr*rGrrLrFlistdictr9r_)rCa_namerdefault_kw_onlyrFrcrrrrr _get_fieldsX               rcCs"t|tr|jd|j|_|S)Nrl)r@rrr)rCrrrr _set_qualname1s rcCs(||jvrdSt||t|||dS)NTF)rrsetattr)rCr$rrrr_set_new_attribute8s   rcCsdSr"rrCr rtrrr_hash_set_noneGrrcCsdd|D}t|t||S)NcSs(g|]}|jdur |jrn|jr|qSr")rHrJrarrrroKs(z_hash_add..)rr)rCr rtfldsrrr _hash_addJsrcCstd|j)Nz-Cannot overwrite attribute __hash__ in class )rrrrrr_hash_exceptionNsr)FFFF)FFFT)FFTF)FFTT)FTFF)FTFT)FTTF)FTTT)TFFF)TFFT)TFTF)TFTT)TTFF)TTFT)TTTF)TTTTc % Cs0i} |jtjvrtj|jj} ni} t|tt||||||d} d} |jdddD]"}t|t d}|durMd} | D]}|| |j <q=t|tj rMd} q+|j di}g}d}tjt}|D]/\}}t||syt|trt||||jtr|rt|dd}d}qb|t||||qb|D]%}|| |j <tt||j dtr|jturt||j qt||j |jq|jD]\}}t|tr||vrt|dq| r| r|std| s|rtd t|t | |j d t}|tup|duod |jv }|r |s td d d| D}t|\}}|r8t|t}t |dt!|||||d| vr2dnd| | dd| D}|rTdd|D}t |dt"|| |rudd|D}t#d|} t#d|}!t |d t$d d| |!| d|rdd|D}t#d|} t#d|}!dD]\}}"t ||t$||"| |!| drtd|d|jdq|rt%||| D]}#t ||#j|#rtd|#jd|jqt&t'|t'|t'||f}$|$r|$||| |_(t|ds|jtt)*|+dd |_,|r t |d!t-d"d#|D| rt.||}t/0||S)$NFrT__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)rMr(r*rarrrrosz"_process_class..r&r__dataclass_self__cSsg|] }|jtur|qSrrMr(rarrrroscSg|]}|jr|qSr)rArarrrrorcSrrrJrarrrrorrz==rcSrrrrarrrro#r))__lt__<)__le__z<=)__gt__>)__ge__z>=zCannot overwrite attribute z in class z). Consider using functools.total_ordering__doc__z -> Nonerw__match_args__cs|]}|jVqdSr"r#rarrrrdJz!_process_class..)1rrrrr_PARAMSrX__mro__rT_FIELDSvaluesr$r]rritemsrr@rrr rrrrrFr delattrr_rhhasattrrrrrrsrr _hash_actionboolrinspect signaturerrrf _add_slotsabcupdate_abstractmethods)%rCrIrArZr[r\r] match_argsrLrr rtany_frozen_basehas_dataclass_basesrz base_fieldsrccls_annotations cls_fields KW_ONLY_seenrr$r>r class_hashhas_explicit_hashall_init_fieldsstd_init_fieldskw_only_init_fieldsr field_listrrrrr hash_actionrrr_process_classqs                         r csfddtDS)Ncsg|]}t|jqSr)rTr$rarrrroYsz'_dataclass_getstate..rgrrrr_dataclass_getstateXsrcCs,tt||D] \}}t||j|qdSr")zipr rrr$)rstaterrrrr_dataclass_setstate\srcCsd|jvr t|jdt|j}tddt|D}||d<|D]}||dq#|ddt|dd}t||j|j |}|durI||_ |rQt |_ t |_|S)NrEz already specifies __slots__csrr"r#rarrrrdlrz_add_slots..rr)rrrrrfr poprTr> __bases__rr __getstate__r __setstate__)rC is_frozencls_dict field_names field_namequalnamerrrrbs    rF rIrArZr[r\r]rrLrc s0f dd} |dur| 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. 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. c st| Sr")r )rC rZr]rIrLrr[rArr\rrwrapszdataclass..wrapNr) rCrIrArZr[r\r]rrLrrrrrrsrcCs>zt|t}Wn tytddwtdd|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 instanceNcss|] }|jtur|VqdSr"rrarrrrdszfields..)rTrAttributeErrorrrfr)class_or_instancer rrrr s   r cCstt|tS)z2Returns True if obj is an instance of a dataclass.)rr>r)objrrr_is_dataclass_instancesr!cCs*t|tr t|ts |nt|}t|tS)zEReturns True if obj is a dataclass or an instance of a dataclass.)r@r>rrr)r rCrrrrs  r dict_factorycCt|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)r!r _asdict_inner)r r#rrrr  r cst|r"g}t|D]}tt||j}||j|fq |St|tr9t|dr9t |fdd|DSt|t tfrMt |fdd|DSt|t rat |fdd| DSt |S)N_fieldscg|]}t|qSrr%rbvr"rrrorz!_asdict_inner..c3|]}t|VqdSr"r)r*r"rrrdr{z _asdict_inner..c3(|]\}}t|t|fVqdSr"r)rbkr+r"rrrds  )r!r r%rTr$rr@rfrr>rrrcopydeepcopy)r r#r4rcrrr"rr%s   r% tuple_factorycCr$)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)r!r_astuple_inner)r r3rrrr r&r cst|rg}t|D]}tt||j}||q |St|tr6t|dr6t |fdd|DSt|t tfrJt |fdd|DSt|t r^t |fdd| DSt |S)Nr'cr(rr4r*r2rrro(rz"_astuple_inner..c3r,r"r5r*r2rrrd-r{z!_astuple_inner..c3r-r"r5r.r2rrrd/s)r!r r4rTr$rr@rfrr>rrrr0r1)r r3r4rcrrr2rr4s    r4r) bases namespacerIrArZr[r\r]rrLrc  sdurit} ii|D]^}t|tr|}d}n"t|dkr&|\}}nt|dkr6|\}}}||<ntd|t|trF|sMtd|t|rYtd||| vrdtd|| |||<qfd d }t ||i|}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: cs |||d<dS)Nr)r)r annotationsdefaultsr7rrexec_body_callbackns   z*make_dataclass..exec_body_callbackr) r9r@rlenr isidentifierkeyword iskeywordr1rO new_classr)cls_namer r6r7rIrArZr[r\r]rrLrseenitemr$tpspecr<rCrr9rr5s:          rcKst|stdt|tD];}|jturq|js)|j|vr(t d|jdq|j|vrJ|jt urA|j t urAt d|jdt||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 instancesrzC is declared with init=False, it cannot be specified with replace()zInitVar z! must be specified with replace()Nr)r!rrTrrrMr)rIr$r_r*rFr __class__)r changesrcrrrr}s   rr")Krerr0rOrr?builtinsr:rr/rr__all__rrrrrr rr rPrNr r(r)r*rrrcompilerr<rrrXrrhrsrrrrrrrrrrrrrrrrrrrrr rrrrr r!rrr r%rfr r4rrrrrrs  @     << ;_     h " ) H