>QgzddlZddlZddlZddlZddlZddlZddlmZddlm Z m Z m Z ddl m Z m Z mZmZddlmZmZmZmZejZdZdZd Zd ZejiZeZe je j e j!Z"Gd d ej#Z$e$j%Z% Gd de&Z'e%ddddddddddddddfdZ(dOdZ)dZ*dZ+e+dgdZ,dZ-dZ.dZ/dZ0dZ1dZ2dZ3dZ4Gd d!Z5d"Z6d#Z7 dPd$Z8 dQd%Z9e9Z: d&Z;d'Zd*Z?d+Z@d,ZAdRd-ZBd.ZCdSd/ZDd0ZEd1ZFd2Z!d3ZGd4ZHd5ZId6ZJd7ZKd8ZLd9ZMd:ZNd;eOdd?ZQd@eQjRDZSe>eBeDeQeSAdBeSDAdCeSDAZQGdDdEZTeBeDeTZTGdFdGZUdHeUjRDZVe>eBeDeUeVAeVAeVAZUeffdIZWe9ddJGdKdLZXdMZYdNZdS)TN) itemgetter)_compat_configsetters)PY310_AnnotationExtractorget_generic_baseset_closure_cell)DefaultAlreadySetErrorFrozenInstanceErrorNotAnAttrsClassErrorUnannotatedAttributeErrorz__attr_converter_%sz__attr_factory_%s)ztyping.ClassVarz t.ClassVarClassVarztyping_extensions.ClassVar_attrs_cached_hashc<eZdZdZejZdZdZdS)_NothingaH Sentinel to indicate the lack of a value when ``None`` is ambiguous. If extending attrs, you can use ``typing.Literal[NOTHING]`` to show that a value may be ``NOTHING``. .. versionchanged:: 21.1.0 ``bool(NOTHING)`` is now False. .. versionchanged:: 22.2.0 ``NOTHING`` is now an ``enum.Enum`` variant. cdS)NNOTHINGselfs j/builddir/build/BUILD/imunify360-venv-2.5.0/opt/imunify360/venv/lib/python3.11/site-packages/attr/_make.py__repr__z_Nothing.__repr__AsycdS)NFrrs r__bool__z_Nothing.__bool__DsurN) __name__ __module__ __qualname____doc__enumautorrrrrrrr4sKdikkGrrc0eZdZdZeddfdZdS)_CacheHashWrappera An integer subclass that pickles / copies as None This is used for non-slots classes with ``cache_hash=True``, to avoid serializing a potentially (even likely) invalid hash value. Since ``None`` is the default value for uncalculated hashes, whenever this is copied, the copy's value for the hash should automatically reset. See GH #613 for more details. Nrc ||fSNr)r_none_constructor_argss r __reduce__z_CacheHashWrapper.__reduce__Zs  %''r)rrr r!typer*rrrr%r%NsA  ,04::R((((((rr%TFc\t|| | d\} }} }||dur|durtd| E|turtdt | stdt | }|i}t | ttfrtj | } |r%t |ttfr t|}|r%t |ttfr t|}tdid|d|d |d dd |d |d |d|d|d| d| d|d| d|d| d|S)a Create a new attribute on a class. .. warning:: Does *not* do anything unless the class is also decorated with `attr.s` / `attrs.define` / et cetera! Please consider using `attrs.field` in new code (``attr.ib`` will *never* go away, though). :param default: A value that is used if an *attrs*-generated ``__init__`` is used and no value is passed while instantiating or the attribute is excluded using ``init=False``. If the value is an instance of `attrs.Factory`, its callable will be used to construct a new value (useful for mutable data types like lists or dicts). If a default is not set (or set manually to `attrs.NOTHING`), a value *must* be supplied when instantiating; otherwise a `TypeError` will be raised. The default can also be set using decorator notation as shown below. :type default: Any value :param callable factory: Syntactic sugar for ``default=attr.Factory(factory)``. :param validator: `callable` that is called by *attrs*-generated ``__init__`` methods after the instance has been initialized. They receive the initialized instance, the :func:`~attrs.Attribute`, and the passed value. The return value is *not* inspected so the validator has to throw an exception itself. If a `list` is passed, its items are treated as validators and must all pass. Validators can be globally disabled and re-enabled using `attrs.validators.get_disabled` / `attrs.validators.set_disabled`. The validator can also be set using decorator notation as shown below. :type validator: `callable` or a `list` of `callable`\ s. :param repr: Include this attribute in the generated ``__repr__`` method. If ``True``, include the attribute; if ``False``, omit it. By default, the built-in ``repr()`` function is used. To override how the attribute value is formatted, pass a ``callable`` that takes a single value and returns a string. Note that the resulting string is used as-is, i.e. it will be used directly *instead* of calling ``repr()`` (the default). :type repr: a `bool` or a `callable` to use a custom function. :param eq: If ``True`` (default), include this attribute in the generated ``__eq__`` and ``__ne__`` methods that check two instances for equality. To override how the attribute value is compared, pass a ``callable`` that takes a single value and returns the value to be compared. :type eq: a `bool` or a `callable`. :param order: If ``True`` (default), include this attributes in the generated ``__lt__``, ``__le__``, ``__gt__`` and ``__ge__`` methods. To override how the attribute value is ordered, pass a ``callable`` that takes a single value and returns the value to be ordered. :type order: a `bool` or a `callable`. :param cmp: Setting *cmp* is equivalent to setting *eq* and *order* to the same value. Must not be mixed with *eq* or *order*. :type cmp: a `bool` or a `callable`. :param Optional[bool] hash: Include this attribute in the generated ``__hash__`` method. If ``None`` (default), mirror *eq*'s value. This is the correct behavior according the Python spec. Setting this value to anything else than ``None`` is *discouraged*. :param bool init: Include this attribute in the generated ``__init__`` method. It is possible to set this to ``False`` and set a default value. In that case this attributed is unconditionally initialized with the specified default value or factory. :param callable converter: `callable` that is called by *attrs*-generated ``__init__`` methods to convert attribute's value to the desired format. It is given the passed-in value, and the returned value will be used as the new value of the attribute. The value is converted before being passed to the validator, if any. :param metadata: An arbitrary mapping, to be used by third-party components. See `extending-metadata`. :param type: The type of the attribute. Nowadays, the preferred method to specify the type is using a variable annotation (see :pep:`526`). This argument is provided for backward compatibility. Regardless of the approach used, the type will be stored on ``Attribute.type``. Please note that *attrs* doesn't do anything with this metadata by itself. You can use it as part of your own code or for `static type checking `. :param kw_only: Make this attribute keyword-only in the generated ``__init__`` (if ``init`` is ``False``, this parameter is ignored). :param on_setattr: Allows to overwrite the *on_setattr* setting from `attr.s`. If left `None`, the *on_setattr* value from `attr.s` is used. Set to `attrs.setters.NO_OP` to run **no** `setattr` hooks for this attribute -- regardless of the setting in `attr.s`. :type on_setattr: `callable`, or a list of callables, or `None`, or `attrs.setters.NO_OP` :param Optional[str] alias: Override this attribute's parameter name in the generated ``__init__`` method. If left `None`, default to ``name`` stripped of leading underscores. See `private-attributes`. .. versionadded:: 15.2.0 *convert* .. versionadded:: 16.3.0 *metadata* .. versionchanged:: 17.1.0 *validator* can be a ``list`` now. .. versionchanged:: 17.1.0 *hash* is ``None`` and therefore mirrors *eq* by default. .. versionadded:: 17.3.0 *type* .. deprecated:: 17.4.0 *convert* .. versionadded:: 17.4.0 *converter* as a replacement for the deprecated *convert* to achieve consistency with other noun-based arguments. .. versionadded:: 18.1.0 ``factory=f`` is syntactic sugar for ``default=attr.Factory(f)``. .. versionadded:: 18.2.0 *kw_only* .. versionchanged:: 19.2.0 *convert* keyword argument removed. .. versionchanged:: 19.2.0 *repr* also accepts a custom callable. .. deprecated:: 19.2.0 *cmp* Removal on or after 2021-06-01. .. versionadded:: 19.2.0 *eq* and *order* .. versionadded:: 20.1.0 *on_setattr* .. versionchanged:: 20.3.0 *kw_only* backported to Python 2 .. versionchanged:: 21.1.0 *eq*, *order*, and *cmp* also accept a custom callable .. versionchanged:: 21.1.0 *cmp* undeprecated .. versionadded:: 22.2.0 *alias* TNF6Invalid value for hash. Must be True, False, or None.z=The `default` and `factory` arguments are mutually exclusive.z*The `factory` argument must be a callable.default validatorreprcmphashinit convertermetadatar+kw_onlyeqeq_keyorder order_key on_setattraliasr) _determine_attrib_eq_order TypeErrorr ValueErrorcallableFactory isinstancelisttuplerpipeand_ _CountingAttr)r.r/r0r1r2r3r5r+r4factoryr6r7r9r;r<r8r:s rattribrI^sp$> R$$ By D,,U1B1B D    ' ! !    KIJJ J'""*tUm,,/\:. %Z D%=99%)$ %Z D%=99%)$     ) T  D   T   T  )  T   2 v e ) :  e! rcJt||d}t|||dS)zU "Exec" the script with the given global (globs) and local (locs) variables. execN)compileeval)scriptglobslocsfilenamebytecodes r_compile_and_evalrT*s-vx00H5$rc i}d}|} t|d|d|f}tj||}||krn|ddd|d}|dz }ct ||||||S)zO Create the method with the script given and return the method object. rTN->)len splitlines linecachecache setdefaultrT) namerOrRrPrQcount base_filenamelinecache_tupleold_vals r _make_methodrc2s D EM  KK    d # #    /,,XGG o % % ',77u777H QJE feT8444 :rc"|d}d|ddg}|r2t|D]!\}}|d|d|d"n|dttd }t d ||||S) z Create a tuple subclass to hold `Attribute`s for an `attrs` class. The subclass is a bare tuple with properties for names. class MyClassAttributes(tuple): __slots__ = () x = property(itemgetter(0)) Attributeszclass z(tuple):z __slots__ = () z% = _attrs_property(_attrs_itemgetter())z pass)_attrs_itemgetter_attrs_property ) enumerateappendrpropertyrTjoin)cls_name attr_namesattr_class_nameattr_class_templatei attr_namerPs r_make_attr_tuple_classruOs"---O****/%j11  LAy  & &LyLLqLLL      "":...", J JEdii 344e<<<  !!r _Attributes)attrs base_attrsbase_attrs_mapct|}|dr|dr |dd}|tS)z Check whether *annot* is a typing.ClassVar. The string comparison hack is used to avoid evaluating all string annotations which would put attrs-based classes at a performance disadvantage compared to plain old classes. )'"rrV)str startswithendswith_classvar_prefixes)annots r _is_class_varrys\ JJE  ##z(B(Bad    . / //rct||t}|turdS|jddD]}t||d}||urdSdS)zR Check whether *cls* defines *attrib_name* (and doesn't just inherit it). FrNT)getattr _sentinel__mro__)cls attrib_nameattrbase_clsas r_has_own_attributersk 3 Y / /D yuKO Hk4 0 0 19955  4rc4t|dr|jSiS)z$ Get annotations for *cls*. __annotations__)rrrs r_get_annotationsrs%#011#"" Ircg}i}t|jddD]\}t|dgD]H}|js |j|vr|d}|||||j<I]g}t}t|D]<}|j|vr |d|| |j=||fS)zQ Collect attr.ibs from base classes of *cls*, except *taken_attr_names*. rrV__attrs_attrs__T inheritedr) reversedrrrr^evolverlsetinsertadd)rtaken_attr_namesrx base_attr_maprrfilteredseens r_collect_base_attrsrsJMS[2.//--#4b99 - -A{ af(8884((A   a $,M!& ! !  -H 55D j ! ! 6T>> 1  ] ""rcg}i}|jddD]o}t|dgD][}|j|vr |d}||j|||||j<\p||fS)a- Collect attr.ibs from base classes of *cls*, except *taken_attr_names*. N.B. *taken_attr_names* will be mutated. Adhere to the old incorrect behavior. Notably it collects from the front and considers inherited attributes which leads to the buggy behavior reported in #428. rrVrTr)rrr^rrrl)rrrxrrrs r_collect_base_attrs_brokenrsJMK"%--#4b99 - -Av)))4((A   ( ( (   a $,M!& ! ! - } $$rc L|jt|| d|D}nb|dur/dD}g}t}D]\} } t | r|| | t} t| ts(| turt} nt| } | | | f||z } t| dkr:tddt| fd  zd zn.td Dd }fd|D} |rt!|d| D\}}nt#|d| D\}}|rd| D} d|D}|| z}d}d|DD]:} |dur | jturt'd| |dur| jturd};| |||}d|D}d|D}t)|j|}t-||||fS)a0 Transform all `_CountingAttr`s on a class into `Attribute`s. If *these* is passed, use that and don't look for them on the class. *collect_by_mro* is True, collect them in the correct MRO order, otherwise use the old -- incorrect -- order. See #428. Return an `_Attributes`. Ncg|] \}}||f Srr).0r^cas r z$_transform_attrs..s <<<($D":<<z#_transform_attrs..s<   d$ ..    rr.rz1The following `attr.ib`s lack a type annotation: , c8|jSr')getcounter)ncds rz"_transform_attrs.. sbffQii6Gr)key.c3NK|] \}}t|t||fV!dSr'rrs r z#_transform_attrs..sN  D$dM22 t       rc|djSNr)r)es rrz"_transform_attrs..s !A$,rc vg|]5\}}t|||6S))r^rr+) Attributefrom_counting_attrr)rrtrannss rrz$_transform_attrs..sW Ir $$r(;(; %  rch|] }|j Srr^rrs rrz#_transform_attrs..",,,Q!&,,,rch|] }|j Srrrs rrz#_transform_attrs..&rrc:g|]}|dST)r6rrs rrz$_transform_attrs..*s&???QXXdX++???rc:g|]}|dSrrrs rrz$_transform_attrs..+s&AAAahhth,,AAArFc3>K|]}|jdu |jdu|VdS)FN)r3r6rs rrz#_transform_attrs..4s: M MA!&"5"5!)u:L:La:L:L:L:L M MrzlNo mandatory attributes allowed after an attribute with a default value or factory. Attribute in question: cpg|]3}|js(|t|jn|4S))r<)r<r_default_init_alias_forr^rs rrz$_transform_attrs..DsO    @AwM.qv66777A   rcg|] }|j Srrrs rrz$_transform_attrs..Ks(((Q!&(((r)__dict__ritemsrrrrrrBrGrIrlrYrrnsortedrrr.r?rurrv)rthese auto_attribsr6collect_by_mrofield_transformerca_listca_names annot_namesrtr+r unannotated own_attrsrxrrw had_defaultrp AttrsClassrrs @@r_transform_attrsrs B C D < * * * *, {  a  +C));,G,G,G,GHHH     "$((**    '&    % I $7 ,,),,,% % ! MM%? ,,),,,% % ! MB??Y??? AAjAAA  "E K M M M M M $  19#7#7KEFKK  %  AIW$<$<K$!!#u--      E)(%(((J' jAAJ  5)):}E F FFrct|tr"|dvrt|||dSt)z4 Attached to frozen classes as __setattr__. ) __cause__ __context__ __traceback__N)rB BaseException __setattr__r rr^values r_frozen_setattrsrQsR$ &&44,, !!$e444   rct)z4 Attached to frozen classes as __delattr__. r )rr^s r_frozen_delattrsr`s   rceZdZdZdZdZdZerddlZdZ ndZ d Z d Z d Z d Z d ZdZdZdZdZdZdZdZdZdZdS) _ClassBuilderz( Iteratively build *one* class. ) _attr_names_attrs_base_attr_map _base_names _cache_hash_cls _cls_dict_delete_attribs_frozen _has_pre_init_has_post_init_is_exc _on_setattr_slots _weakref_slot_wrote_own_setattr_has_custom_setattrct||||| |\}}}||_|rt|jni|_||_d|D|_||_td|D|_ ||_ ||_ ||_ | |_ tt|dd|_tt|dd|_t| |_| |_| |_| |_d|_|j|jd<|r&t.|jd<t0|jd<d |_n{| t2t4jt4jfvr[dx}}|D]}|jd }|jd }|r|rn| t2kr|s|r$| t4jkr|r| t4jkr |sd|_|r)|\|jd <|jd <dSdS) Nch|] }|j Srrrs rrz)_ClassBuilder.__init__..s777qAF777rc3$K|] }|jV dSr'rrs rrz)_ClassBuilder.__init__..s$ 7 7A 7 7 7 7 7 7r__attrs_pre_init__F__attrs_post_init__rr __delattr__T __getstate__ __setstate__) rrdictrrrrrrDrrrrrboolrrrrrrrrrr_ng_default_on_setattrrvalidateconvertr/r4_make_getstate_setstate)rrrslotsfrozen weakref_slotgetstate_setstaterr6 cache_hashis_excrr;has_custom_setattrrrwrxbase_map has_validator has_converterrs r__init__z_ClassBuilder.__init__sP"'7       ' ' #z8 /4<cl+++" 77J777& 7 7 7 7 777  )%!'#/CU"K"KLL"730Eu#M#MNN#';; %#5 "',0K()  (,)rrrs rrz_ClassBuilder.__repr__s;TY%7;;;;rrNc|jdur|S|j|Sz Finalize class based on the accumulated configuration. Builder cannot be used after calling this method. T)r_create_slots_classabcupdate_abstractmethods_patch_original_classrs r build_classz_ClassBuilder.build_classsL {d""//111822**,, rcd|jdur|S|Sr)rrrrs rrz_ClassBuilder.build_classs5 {d""//111--// /rc|j}|j}|jrM|jD]E}||vr?t ||t t ur" t ||5#t$rYAwxYwF|j D]\}}t||||j s+t |ddrd|_ |j s t|_|S)zA Apply accumulated methods and return the class. __attrs_own_setattr__F)rrrrrrdelattrAttributeErrorrrsetattrrrr _obj_setattrr)rr base_namesr^rs rrz#_ClassBuilder._patch_original_classsi%    (   **T955YFFT****)  >//11 & &KD% Cu % % % %& /7 (%, ,  /).C %+ /". sA AAc t fdjD}jsBd|d<js6jjD]) jddr t|d<n*t}d}jj ddD]O jddd }| fd t d gDPtj j}jr#dtjd d vr d|vr|s|d z } fd|D fd|D fd D | jr t&t) |d <jj|d<t-jjjjj|}|jD]}t3|t4t6frt|jdd}n=t3|t:rt|jdd}nt|dd}|su|D]3} |jju} | rtA||$#tB$rY0wxYw|S)zL Build and return a new class with a `__slots__` attribute. cNi|]!\}}|tjdzv||"S))r __weakref__)rDr)rkvrs r z5_ClassBuilder._create_slots_class..sE   1d.//2MMMM qMMMrFrrrrVr#NTc2i|]}|t|Srr)rr^rs rr&z5_ClassBuilder._create_slots_class..>s5'(D11r __slots__r)r#cg|]}|v| Srr)rr^r s rrz5_ClassBuilder._create_slots_class..Qs#GGGtJ0F0Fd0F0F0Frc$i|] \}}|v || Srr)rslotslot_descriptor slot_namess rr&z5_ClassBuilder._create_slots_class..Vs4   %oz!! /!!!rcg|]}|v| Srr)rr^ reused_slotss rrz5_ClassBuilder._create_slots_class..[s#NNNtT5M5Md5M5M5Mrr __closure__)"rrrrr __bases__rrrrrupdaterrrrrrrl_hash_cache_fieldrDr r+rvaluesrB classmethod staticmethod__func__rmfget cell_contentsr r?)rrexisting_slotsweakref_inheritednamesritem closure_cellscellmatchrr r0r.s` @@@@rrz!_ClassBuilder._create_slots_classs    ,,..   & */B& '+  $ 3H(,,-DeLL,8=) ! )!B$/  H $$]D99E$(!  ! ! '+r B B    )**     &WTY R%H%HHHU**%+ % %EHGGGuGGG     )7)=)=)?)?   ONNNzNNN  ,   1   / 0 0 0 ++;!Y3>d49oodi0$)2ErJJL'')) 4 4D$l ;<< C!( }d K K D(++ C!( =$ G G 'mT B B   % 4 44 .$);E4(s333 "D 4 sJ'' J43J4cr|t|j||j|jd<|S)Nr)_add_method_dunders _make_reprrrr)rnss radd_reprz_ClassBuilder.add_reprs8%)%=%= t{B 2 2& & z" rc|jd}|tdd}|||jd<|S)Nrz3__str__ can only be generated if a __repr__ exists.c*|Sr'rrs r__str__z&_ClassBuilder.add_str..__str__s==?? "rrJ)rrr?rC)rr0rJs radd_strz_ClassBuilder.add_strsa~!!*-- <E  # # #%)$<$.s5! ! R=-@-@B-@-@-@-@! ! rc"fdDS)9 Automatically created by attrs. c2i|]}|t|Srr(rr^rs rr&zQ_ClassBuilder._make_getstate_setstate..slots_getstate..s%KKK$D'$--KKKrr)rstate_attr_namess`rslots_getstatez=_ClassBuilder._make_getstate_setstate..slots_getstates"LKKK:JKKK Krc t|}t|tr#t |D]\}}|||nD]}||vr||||r|t ddSdS)rPN)r__get__rBrDzipr4)rstate_ClassBuilder__bound_setattrr^rhash_caching_enabledrSs rslots_setstatez=_ClassBuilder._make_getstate_setstate..slots_setstates+22488O%'' ;$''7#?#?11KD%#OD%00001-;;Du}}'eDk::: $ 9 1488888 9 9r)rDrr)rrTr[rZrSs @@rrz%_ClassBuilder._make_getstate_setstates !! ! )! ! !    L L L L L $/ 9 9 9 9 9 9,~--rcd|jd<|S)N__hash__)rrs rmake_unhashablez_ClassBuilder.make_unhashables%)z" rc|t|j|j|j|j|jd<|S)Nrr r])rC _make_hashrrrrrrs radd_hashz_ClassBuilder.add_hashsL%)%=%=   |+    & & z" rc|t|j|j|j|j|j|j|j|j |j |j d |j d<|S)NF attrs_initr rC _make_initrrrrrrrrrrrrs radd_initz_ClassBuilder.add_initsq%)%=%=   "#   #      & & z"  rcRtd|jD|jd<dS)Nc3@K|]}|j |j|jVdSr')r3r6r^)rfields rrz/_ClassBuilder.add_match_args..sL1 1 z1 #(-1 J1 1 1 1 1 1 r__match_args__)rDrrrs radd_match_argsz_ClassBuilder.add_match_argss=+01 1 1 1 1 , , '(((rc|t|j|j|j|j|j|j|j|j |j |j d |j d<|S)NTrd__attrs_init__rfrs radd_attrs_initz_ClassBuilder.add_attrs_initsr+/+C+C   "#   #     , , '(  rc|j}|t|j|j|d<|t |d<|S)N__eq____ne__)rrC_make_eqrr_make_nerrs radd_eqz_ClassBuilder.add_eqsU ^// TY , ,  8 // ;;8  rcj}fdtjjD\|d<|d<|d<|d<S)Nc3BK|]}|VdSr')rC)rmethrs rrz*_ClassBuilder.add_order.. sMB B   $ $T * *B B B B B B r__lt____le____gt____ge__)r _make_orderrrrvs` r add_orderz_ClassBuilder.add_ordersg ^B B B B #DIt{;;B B B >8 blBxL"X,  rc |jr|Si|jD],}|jp|j}|r|tjur ||f|j<-s|S|jrtdfd}d|j d<| ||j d<d|_ |S)Nz7Can't combine custom __setattr__ with on_setattr hooks.c |\}}||||}n#t$r|}YnwxYwt|||dSr')KeyErrorr)rr^valrhooknvalsa_attrss rrz._ClassBuilder.add_setattr..__setattr__&sl *"4.4tD!S))     tT * * * * *s  ++Trr) rrr;rrNO_OPr^rr?rrCr)rrr;rrs @r add_setattrz_ClassBuilder.add_setattrs < K 1 1A9)9J 1j ==#$j=  K  # I   + + + + +37./(,(@(@(M(M}%"& rc |jj|_n#t$rYnwxYw d|jj|jf|_n#t$rYnwxYw d|jjd|_n#t$rYnwxYw|S)zL Add __module__ and __qualname__ to a *method* if possible. rz$Method generated by attrs for class )rrrrnr rr!)rmethods rrCz!_ClassBuilder._add_method_dunders6s  $ 4F      D  "%(('9##F      D  -9)--- NN    D  s/ !!+A AA"A88 BB)rrr r!r)rrrrrrrrFrKrr^rbrhrmrprwrrrCrrrrrgsVI(S/S/S/j<<< 0      0 0 0$$$LhhhT   '.'.'.R   &   &"""Hrrc|$t|du|dufrtd|||fS||}||}|dur|durtd||fS) Validate the combination of *cmp*, *eq*, and *order*. Derive the effective values of eq and order. If *eq* is None, set it to *default_eq*. N&Don't mix `cmp` with `eq' and `order`.FT-`order` can only be True if `eq` is True too.anyr?)r1r7r9 default_eqs r_determine_attrs_eq_orderrQs  3$T0ABCCABBB Cx z  } U{{u}}HIII u9rc|$t|du|dufrtdd}|||\}}||||fS||d}}n||\}}|||}}n||\}}|dur|durtd||||fS)rNrc6t|rd|}}nd}||fS)z8 Decide whether a key function is used. TN)r@)rrs rdecide_callable_or_booleanz>_determine_attrib_eq_order..decide_callable_or_booleanss, E?? u3EECczrFTrr)r1r7r9rrcmp_keyr8r:s rr=r=ks  3$T0ABCCABBB 11#66 WGS')) zF//33 F }vy55e<<y U{{u}}HIII vui ''rcZ|dus|dur|S||dur|S|D]}t||rdS|S)ap Check whether we should implement a set of methods for *cls*. *flag* is the argument passed into @attr.s like 'init', *auto_detect* the same as passed into @attr.s and *dunders* is a tuple of attribute names whose presence signal that the user has implemented it themselves. Return *default* if no reason for either for or against is found. TF)r)rflag auto_detectdundersr.dunders r_determine_whether_to_implementrsd t||tu}}  | u,, c6 * * 55  Nrc t|||d\||tttfrt j     fd}||S||S)a4 A class decorator that adds :term:`dunder methods` according to the specified attributes using `attr.ib` or the *these* argument. Please consider using `attrs.define` / `attrs.frozen` in new code (``attr.s`` will *never* go away, though). :param these: A dictionary of name to `attr.ib` mappings. This is useful to avoid the definition of your attributes within the class body because you can't (e.g. if you want to add ``__repr__`` methods to Django models) or don't want to. If *these* is not ``None``, *attrs* will *not* search the class body for attributes and will *not* remove any attributes from it. The order is deduced from the order of the attributes inside *these*. :type these: `dict` of `str` to `attr.ib` :param str repr_ns: When using nested classes, there's no way in Python 2 to automatically detect that. Therefore it's possible to set the namespace explicitly for a more meaningful ``repr`` output. :param bool auto_detect: Instead of setting the *init*, *repr*, *eq*, *order*, and *hash* arguments explicitly, assume they are set to ``True`` **unless any** of the involved methods for one of the arguments is implemented in the *current* class (i.e. it is *not* inherited from some base class). So for example by implementing ``__eq__`` on a class yourself, *attrs* will deduce ``eq=False`` and will create *neither* ``__eq__`` *nor* ``__ne__`` (but Python classes come with a sensible ``__ne__`` by default, so it *should* be enough to only implement ``__eq__`` in most cases). .. warning:: If you prevent *attrs* from creating the ordering methods for you (``order=False``, e.g. by implementing ``__le__``), it becomes *your* responsibility to make sure its ordering is sound. The best way is to use the `functools.total_ordering` decorator. Passing ``True`` or ``False`` to *init*, *repr*, *eq*, *order*, *cmp*, or *hash* overrides whatever *auto_detect* would determine. :param bool repr: Create a ``__repr__`` method with a human readable representation of *attrs* attributes.. :param bool str: Create a ``__str__`` method that is identical to ``__repr__``. This is usually not necessary except for `Exception`\ s. :param Optional[bool] eq: If ``True`` or ``None`` (default), add ``__eq__`` and ``__ne__`` methods that check two instances for equality. They compare the instances as if they were tuples of their *attrs* attributes if and only if the types of both classes are *identical*! :param Optional[bool] order: If ``True``, add ``__lt__``, ``__le__``, ``__gt__``, and ``__ge__`` methods that behave like *eq* above and allow instances to be ordered. If ``None`` (default) mirror value of *eq*. :param Optional[bool] cmp: Setting *cmp* is equivalent to setting *eq* and *order* to the same value. Must not be mixed with *eq* or *order*. :param Optional[bool] unsafe_hash: If ``None`` (default), the ``__hash__`` method is generated according how *eq* and *frozen* are set. 1. If *both* are True, *attrs* will generate a ``__hash__`` for you. 2. If *eq* is True and *frozen* is False, ``__hash__`` will be set to None, marking it unhashable (which it is). 3. If *eq* is False, ``__hash__`` will be left untouched meaning the ``__hash__`` method of the base class will be used (if base class is ``object``, this means it will fall back to id-based hashing.). Although not recommended, you can decide for yourself and force *attrs* to create one (e.g. if the class is immutable even though you didn't freeze it programmatically) by passing ``True`` or not. Both of these cases are rather special and should be used carefully. See our documentation on `hashing`, Python's documentation on `object.__hash__`, and the `GitHub issue that led to the default \ behavior `_ for more details. :param Optional[bool] hash: Alias for *unsafe_hash*. *unsafe_hash* takes precedence. :param bool init: Create a ``__init__`` method that initializes the *attrs* attributes. Leading underscores are stripped for the argument name. If a ``__attrs_pre_init__`` method exists on the class, it will be called before the class is initialized. If a ``__attrs_post_init__`` method exists on the class, it will be called after the class is fully initialized. If ``init`` is ``False``, an ``__attrs_init__`` method will be injected instead. This allows you to define a custom ``__init__`` method that can do pre-init work such as ``super().__init__()``, and then call ``__attrs_init__()`` and ``__attrs_post_init__()``. :param bool slots: Create a :term:`slotted class ` that's more memory-efficient. Slotted classes are generally superior to the default dict classes, but have some gotchas you should know about, so we encourage you to read the :term:`glossary entry `. :param bool frozen: Make instances immutable after initialization. If someone attempts to modify a frozen instance, `attrs.exceptions.FrozenInstanceError` is raised. .. note:: 1. This is achieved by installing a custom ``__setattr__`` method on your class, so you can't implement your own. 2. True immutability is impossible in Python. 3. This *does* have a minor a runtime performance `impact ` when initializing new instances. In other words: ``__init__`` is slightly slower with ``frozen=True``. 4. If a class is frozen, you cannot modify ``self`` in ``__attrs_post_init__`` or a self-written ``__init__``. You can circumvent that limitation by using ``object.__setattr__(self, "attribute_name", value)``. 5. Subclasses of a frozen class are frozen too. :param bool weakref_slot: Make instances weak-referenceable. This has no effect unless ``slots`` is also enabled. :param bool auto_attribs: If ``True``, collect :pep:`526`-annotated attributes from the class body. In this case, you **must** annotate every field. If *attrs* encounters a field that is set to an `attr.ib` but lacks a type annotation, an `attr.exceptions.UnannotatedAttributeError` is raised. Use ``field_name: typing.Any = attr.ib(...)`` if you don't want to set a type. If you assign a value to those attributes (e.g. ``x: int = 42``), that value becomes the default value like if it were passed using ``attr.ib(default=42)``. Passing an instance of `attrs.Factory` also works as expected in most cases (see warning below). Attributes annotated as `typing.ClassVar`, and attributes that are neither annotated nor set to an `attr.ib` are **ignored**. .. warning:: For features that use the attribute name to create decorators (e.g. :ref:`validators `), you still *must* assign `attr.ib` to them. Otherwise Python will either not find the name or try to use the default value to call e.g. ``validator`` on it. These errors can be quite confusing and probably the most common bug report on our bug tracker. :param bool kw_only: Make all attributes keyword-only in the generated ``__init__`` (if ``init`` is ``False``, this parameter is ignored). :param bool cache_hash: Ensure that the object's hash code is computed only once and stored on the object. If this is set to ``True``, hashing must be either explicitly or implicitly enabled for this class. If the hash code is cached, avoid any reassignments of fields involved in hash code computation or mutations of the objects those fields point to after object creation. If such changes occur, the behavior of the object's hash code is undefined. :param bool auto_exc: If the class subclasses `BaseException` (which implicitly includes any subclass of any exception), the following happens to behave like a well-behaved Python exceptions class: - the values for *eq*, *order*, and *hash* are ignored and the instances compare and hash by the instance's ids (N.B. *attrs* will *not* remove existing implementations of ``__hash__`` or the equality methods. It just won't add own ones.), - all attributes that are either passed into ``__init__`` or have a default value are additionally available as a tuple in the ``args`` attribute, - the value of *str* is ignored leaving ``__str__`` to base classes. :param bool collect_by_mro: Setting this to `True` fixes the way *attrs* collects attributes from base classes. The default behavior is incorrect in certain cases of multiple inheritance. It should be on by default but is kept off for backward-compatibility. See issue `#428 `_ for more details. :param Optional[bool] getstate_setstate: .. note:: This is usually only interesting for slotted classes and you should probably just set *auto_detect* to `True`. If `True`, ``__getstate__`` and ``__setstate__`` are generated and attached to the class. This is necessary for slotted classes to be pickleable. If left `None`, it's `True` by default for slotted classes and ``False`` for dict classes. If *auto_detect* is `True`, and *getstate_setstate* is left `None`, and **either** ``__getstate__`` or ``__setstate__`` is detected directly on the class (i.e. not inherited), it is set to `False` (this is usually what you want). :param on_setattr: A callable that is run whenever the user attempts to set an attribute (either by assignment like ``i.x = 42`` or by using `setattr` like ``setattr(i, "x", 42)``). It receives the same arguments as validators: the instance, the attribute that is being modified, and the new value. If no exception is raised, the attribute is set to the return value of the callable. If a list of callables is passed, they're automatically wrapped in an `attrs.setters.pipe`. :type on_setattr: `callable`, or a list of callables, or `None`, or `attrs.setters.NO_OP` :param Optional[callable] field_transformer: A function that is called with the original class object and all fields right before *attrs* finalizes the class. You can use this, e.g., to automatically add converters or validators to fields based on their types. See `transform-fields` for more details. :param bool match_args: If `True` (default), set ``__match_args__`` on the class to support :pep:`634` (Structural Pattern Matching). It is a tuple of all non-keyword-only ``__init__`` parameter names on Python 3.10 and later. Ignored on older Python versions. .. versionadded:: 16.0.0 *slots* .. versionadded:: 16.1.0 *frozen* .. versionadded:: 16.3.0 *str* .. versionadded:: 16.3.0 Support for ``__attrs_post_init__``. .. versionchanged:: 17.1.0 *hash* supports ``None`` as value which is also the default now. .. versionadded:: 17.3.0 *auto_attribs* .. versionchanged:: 18.1.0 If *these* is passed, no attributes are deleted from the class body. .. versionchanged:: 18.1.0 If *these* is ordered, the order is retained. .. versionadded:: 18.2.0 *weakref_slot* .. deprecated:: 18.2.0 ``__lt__``, ``__le__``, ``__gt__``, and ``__ge__`` now raise a `DeprecationWarning` if the classes compared are subclasses of each other. ``__eq`` and ``__ne__`` never tried to compared subclasses to each other. .. versionchanged:: 19.2.0 ``__lt__``, ``__le__``, ``__gt__``, and ``__ge__`` now do not consider subclasses comparable anymore. .. versionadded:: 18.2.0 *kw_only* .. versionadded:: 18.2.0 *cache_hash* .. versionadded:: 19.1.0 *auto_exc* .. deprecated:: 19.2.0 *cmp* Removal on or after 2021-06-01. .. versionadded:: 19.2.0 *eq* and *order* .. versionadded:: 20.1.0 *auto_detect* .. versionadded:: 20.1.0 *collect_by_mro* .. versionadded:: 20.1.0 *getstate_setstate* .. versionadded:: 20.1.0 *on_setattr* .. versionadded:: 20.3.0 *field_transformer* .. versionchanged:: 21.1.0 ``init=False`` injects ``__attrs_init__`` .. versionchanged:: 21.1.0 Support for ``__attrs_pre_init__`` .. versionchanged:: 21.1.0 *cmp* undeprecated .. versionadded:: 21.3.0 *match_args* .. versionadded:: 22.2.0 *unsafe_hash* as an alias for *hash* (for :pep:`681` compliance). Nc pt|}duot|t}ot|d}|r|rt dt ||t |d | | }t |dr|dur|t | d}|s|dur| |s&t |dr| | durt|d rd durd urtd d us|d us|r rtd nHdus |dur|dur| n% rtd |t |d r|n%| rtdt"r&r$t|ds||S)NTrz/Can't freeze a class with a custom __setattr__.)rrrrI)rrrs)r{r|r}r~r]Fr-zlInvalid value for cache_hash. To use hash caching, hashing must be either explicitly or implicitly enabled.)rzFInvalid value for cache_hash. To use hash caching, init must be True.rl)_has_frozen_base_class issubclassrrr?rrrFrKrwrrr>rbr^rhrprrmr)r is_frozenr has_own_setattrbuilderr7rrauto_excr req_rrr r2r3r6 match_argsr;order_r0repr_nsrr}rrs rwrapzattrs..wrapsP94S99 T!Djm&D&D% *< + +   Py PNOO O      +!0            )  , + {M   &   W % % % $;; OO    , k#7   "** NN    9 &N          Lt##"3 33$D t  E 1 1d6FH U]]t|e     T\\ LR4ZZI,=,=          # # % % % * {M           " " $ $ $ *  % %'s,<== %  " " $ $ $""$$$r)rrBrCrDrrE) maybe_clsrrr0r1r2r3rrrr}rr6r rr7r9rrr r;rr unsafe_hashrrrs ``` `````````` `````` @@rrwrwst,CUDAAKC*tUm,,/\:. k%k%k%k%k%k%k%k%k%k%k%k%k%k%k%k%k%k%k%k%k%k%k%k%k%^ tIrc|jtuS)zV Check whether *cls* has a frozen ancestor by looking at its __setattr__. )rrrs rrrMs ?. ..rc Ld|d|jdt|d|jdS)zF Create a "filename" suitable for a function being generated. z.`sAAFdNNqv~!$$,,,,,,r r2zdef __hash__(selfzhash((rgz):z, *zC, _cache_wrapper=__import__('attr._make')._make._CacheHashWrapper):z_cache_wrapper()c T||zz|d dzgD]d}|jr:d|jd}|j|<|d|d|jdzC|d|jdze|dzzd S) z Generate the code for actually computing the hash code. Below this will either be returned directly or used to compute a value which is then cached, depending on the value of cache_hash r,__key(self.), self.rfN)extendr8r^rl) prefixindentrcmp_namerwclosing_bracesrP hash_func method_lines type_hashs rappend_hash_computation_linesz1_make_hash..append_hash_computation_lines|s )+0I0000     H HAx H+qv+++"#(h##BBBBBBB##F-FQV-F-F-F$FGGGGFVOn<=====rzif self.z is None:zobject.__setattr__(self, '', self. = z return self.zreturn rjr])rDrr2rlr4rnrc)rrwrr tabunique_filenamehash_defrrOrrPrrrs ` @@@@@rrara_s   E C/V<>>>>>>>>>4 6C"I->"I"I"IIJJJ   ) )C->CCCS1W      a# . . . . ) ).)...a    C"D1B"D"DDEEEE%%i555 YY| $ $F  FOU C CCrc6t||dd|_|S)z% Add a hash method to *cls*. Fr`)rar]rrws r _add_hashrs!c55IIICL Jrc d}|S)z Create __ne__ method. cR||}|turtS| S)zj Check equality and either forward a NotImplemented or return the result negated. )rrNotImplemented)rotherresults rrsz_make_ne..__ne__s. U## ^ # #! !zrr)rss rrurus    MrcFd|D}t|d}gd}i}|r|ddg}|D]}|jrXd|jd}|j||<|d|d |jd |d|d |jd a|d |jd |d|jd ||dgzz }n|dd|}t d|||S)z6 Create __eq__ method for *cls* with *attrs*. c g|] }|j | Sr)r7rs rrz_make_eq..s & & &1 &Q & & &rr7)zdef __eq__(self, other):z- if other.__class__ is not self.__class__:z return NotImplementedz return (z ) == (rrrrrz(other.rrz other.z )z return Truerjrr)rrlr8r^rnrc) rrwrlinesrPothersrrrOs rrtrtsx ' & & & &E/T::O   E E ( _%%% : :Ax :+qv+++#$(h BBBBBBCCC DDD!&DDDEEEE 6QV666777 8qv8889999 7)## &''' YYu  F &/5 A AArc\dDfdfd}fd}fd}fd}||||fS)z9 Create ordering methods for *cls* with *attrs*. c g|] }|j | Sr)r9rs rrz_make_order..s ) ) )1 )Q ) ) )rcPtdfdDDS)z& Save us some typing. c3:K|]\}}|r ||n|VdSr'r)rrrs rrz6_make_order..attrs_to_tuple..sK  s (CCJJJ5      rc3PK|] }t|j|jfV!dSr')rr^r:)rrobjs rrz6_make_order..attrs_to_tuple..sG89af%%q{3r)rD)rrws`rattrs_to_tuplez#_make_order..attrs_to_tuplesW  =B      rc^|j|jur||kStSz1 Automatically created by attrs.  __class__rrrrs rr{z_make_order..__lt__9 ?dn , ,!>$''..*?*?? ?rc^|j|jur||kStSrrrs rr|z_make_order..__le__9 ?dn , ,!>$''>>%+@+@@ @rc^|j|jur||kStSrrrs rr}z_make_order..__gt__rrc^|j|jur||kStSrrrs rr~z_make_order..__ge__rrr)rrwr{r|r}r~rs ` @rrrs * ) ) ) )E       666 ))rch||j}t|||_t|_|S)z5 Add equality methods to *cls* with *attrs*. )rrtrrrursrs r_add_eqr$s2 }##u%%CJCJ Jrct|d}td|D}d|D}t|d<t|d<t|d<g}|D]H\}}} | rd|znd|zd z} |t kr|d | d n |d |d | d } || Id|} |d} n|dz} ddddddddddddd| d| ddd g}td!d"|||#S)$Nr0c3pK|]1}|jdu |j|jdurtn|j|jfV2dS)FTN)r0r^r3rs rrz_make_repr..6sV"" 6   !&D..$$afqv>    ""rc8i|]\}}}|tk|dz|S)_repr)r0)rr^rrs rr&z_make_repr..;s0   (dAqQ$YYwYYYrrrrrzgetattr(self, "z ", NOTHING)z={z!r}z_repr(z)}rz1{self.__class__.__qualname__.rsplit(">.", 1)[-1]}z.{self.__class__.__name__}zdef __repr__(self):z try:z: already_repring = _compat.repr_context.already_repringz except AttributeError:z! already_repring = {id(self),}z: _compat.repr_context.already_repring = already_repringz else:z# if id(self) in already_repring:z return '...'z else:z# already_repring.add(id(self))z return f'(z)'z finally:z$ already_repring.remove(id(self))rrj)rP) rrDrrrr0rlrnrc)rwrErrattr_names_with_reprsrPattribute_fragmentsr^rrsaccessorfragment repr_fragmentcls_name_fragmentrs rrDrD1s/V<rrr)r generic_baserws rfieldsrus&$C((LJsD$9$98999 C*D 1 1E }  #L*;TBBE ',# "c#N#N#NOOO Lrct|tstdt|dd}|t |dd|DS)aX Return an ordered dictionary of *attrs* attributes for a class, whose keys are the attribute names. :param type cls: Class to introspect. :raise TypeError: If *cls* is not a class. :raise attrs.exceptions.NotAnAttrsClassError: If *cls* is not an *attrs* class. :rtype: dict .. versionadded:: 18.1.0 rrNrci|] }|j| Srrrs rr&zfields_dict..s % % %!AFA % % %r)rBr+r>rrrs r fields_dictrsg c4 :8999 C*D 1 1E }"c#N#N#NOOO % %u % % %%rc tjdurdSt|jD]+}|j}| |||t ||j,dS)z Validate all attributes on *inst* that have a validator. Leaves all exceptions through. :param inst: Instance of a class with *attrs* attributes. FN)r_run_validatorsrrr/rr^)instrr%s rrrsg%'' DN # #.. K = AdAwtQV,, - - -..rcd|jvS)Nr))rrs r _is_slot_clsrs #, &&rc4||vot||S)z> Check if the attribute name comes from a slot class. )r)a_namers r _is_slot_attrr s! ] " J|M&4I'J'JJrc | duo | tju} |r| rtd|p|} g} i}|D]k}|js|jt ur| ||||j<|j|durtdd} T| r|jtjurd} lt|d}t| |||||||| | | \}}}|j tj vr/|tj |j j|t |d| rt j|d<t%| rdnd|||}||_|S)Nz$Frozen classes can't use on_setattr.Tr3)r attr_dict_cached_setattr_getror)rrr?r3r.rrlr^r;r_attrs_to_init_scriptrsysmodulesr3rrrVrcr)rrwpre_init post_initrrr rr cls_on_setattrrehas_cls_on_setattrneeds_cached_setattrfiltered_attrsr rrrOrP annotationsr3s rrgrgs d"J~W]'JA$A?@@@%/NI  ( (v !)w.. a    !& < #~~ !GHHH#'  (AL $E$E#' /V<>><(4';#$ &6J   D 'D Krcd|d|dS)zJ Use the cached object.setattr to set *attr_name* to *value_var*. _setattr('rrrrt value_varhas_on_setattrs r_setattrrs 3 2 2i 2 2 22rc,d|dt|fzd|dS)zk Use the cached object.setattr to set *attr_name* to *value_var*, but run its converter first. rrrrg)_init_converter_patrs r_setattr_with_converterr"s.  yl***  rc8|rt||dSd|d|S)zo Unless *attr_name* has an on_setattr hook, use normal assignment. Otherwise relegate to _setattr. Trr)r)rtrrs r_assignr!.s4 0 5$/// (9 ( ( ( ((rcR|rt||dSd|dt|fzd|dS)z Unless *attr_name* has an on_setattr hook, use normal assignment after conversion. Otherwise relegate to _setattr_with_converter. Trrrr)rrrs r_assign_with_converterr#9sO C&y)TBBBC  yl***  rc  g} |r| d|r| d|dur3|durt} t} n.| dfd} fd} nt} t} g}g}g}i}ddi}|D]s}|jr|||j}|jdup|jtj uo| }|j }t|j t}|r|j jrd }nd }|jd ur|rt |jfz}|jB| | ||d |d z|t$|jfz}|j||<n'| | ||d |d z||j j||<n|j@| | |d|d|t$|jfz}|j||<n| | |d|d|n|j t(ur|s|d|d}|jr||n|||j:| | ||||j|t$|jfz<n| | |||n|rX|d}|jr||n||| d|dt |jfz}|j}| d| |||z| d| d| ||d z|zd z|z|j|t$|jfz<nd| d| |||z| d| d| ||d z|zd z|z|j j||<n|jr||n|||j9| | ||||j|t$|jfz<n | | ||||jdurN|j|j |j||<?|j-t/|j}|r|||<u|rkt2|d<| d|D]I}d|jz}d|jz}| d|d|d|jd |j||<|||<J|r| d|r+|r|rd}nd}nd}| |t4d fz|r8d!d"|D}| d#|d d$|}|r!||rd$nd d%d$|z }d&| rd'nd(d|d)| rd*| nd+d,||fS)-z Return a script of an initializer for *attrs* and a dict of globals. The globals are expected by the generated script. If *frozen* is True, we cannot set the attributes directly so we use a cached ``object.__setattr__``. zself.__attrs_pre_init__()z$_setattr = _cached_setattr_get(self)Tz_inst_dict = self.__dict__cVt|rt|||Sd|d|S)N _inst_dict[''] = )r rrtrrrs r fmt_setterz)_attrs_to_init_script..fmt_setterts> M::J#Iy.IIIAiAAiAAArct|st|rt|||Sd|dt|fzd|dS)Nr&r'rr)r rrr(s rfmt_setter_with_converterz8_attrs_to_init_script..fmt_setter_with_converterzsf"]9m%L%L2!9n II'9,666IIrreturnNrrJFrrz attr_dict['z '].defaultz =attr_dict['z=NOTHINGzif z is not NOTHING:rfzelse:rz#if _config._run_validators is True:__attr_validator___attr_z(self, z, self.zself.__attrs_post_init__()z_setattr('%s', %s)z_inst_dict['%s'] = %sz self.%s = %sNonerc38K|]}|j d|jVdS)rN)r3r^rs rrz(_attrs_to_init_script..J s4BBQ16B(((BBBBBBrzBaseException.__init__(self, rz*, zdef rorz): z passrj)rlrrr!r#r/r^r;rrr<rBr.rA takes_selfr3_init_factory_patr4rrHrr6r+r get_first_param_typerr4rn) rwrrrrr rr rrrerr)r+args kw_only_argsattrs_to_validatenames_for_globalsrrrtrarg_name has_factory maybe_selfinit_factory_name conv_nameargtval_nameinit_hash_cachevalss ` rr r Hs* E2 0111   3    ~~ D==!J(? % % LL5 6 6 6 B B B B B        $:! DLT"K Q.Q. ; (  $ $Q ' ' 'F T1 L - D2D  7 G44  19/ JJJ 6U??' $5 $A!;*LL11%-0AJ0A0A0AA*!4qvi ?I34;%i00LL" %-0AJ0A0A0AA*89y7H!"344;*LL11%?)???*!4qvi ?I34;%i00LL" %?)???*Yg % %k %@@9@@@Cy !##C(((( C   {& --!8^K"'16)3 ZZ 8^LLMMMM : N'''Cy !##C(((( C   LL9x999 : : : 1QVI = {& //!8^  W%%% //!)C/*>v!ak&9() H%%((55JJLL.,-K)-'.)$ :;;;" - -A*QV3H!AF*I LLLLLLL16LLL M M M*++ h '+, i ( (3 1222 D  - :"6#:,O _(96'BBCCC>xxBB%BBBBB `. Instances of this class are frequently used for introspection purposes like: - `fields` returns a tuple of them. - Validators get them passed as the first argument. - The :ref:`field transformer ` hook receives a list of them. - The ``alias`` property exposes the __init__ parameter name of the field, with any overrides and default private-attribute handling applied. .. versionadded:: 20.1.0 *inherited* .. versionadded:: 20.1.0 *on_setattr* .. versionchanged:: 20.2.0 *inherited* is not taken into account for equality checks and hashing anymore. .. versionadded:: 21.1.0 *eq_key* and *order_key* .. versionadded:: 22.2.0 *alias* For the full version history of the fields, see `attr.ib`. )r^r.r/r0r7r8r9r:r2r3r5r+r4r6rr;r<NFcXt||p| |p|d\} }}}t|}|d||d||d||d||d| |d||d||d ||d ||d ||d | |d | r!tjt | nt |d| |d| |d||d||d|dS)NTr^r.r/r0r7r8r9r:r2r3r4r5r+r6rr;r<)r=rrVtypesMappingProxyTyper_empty_metadata_singleton)rr^r.r/r0r1r2r3rr5r+r4r6r7r8r9r:r;r< bound_setattrs rrzAttribute.__init__ s*(B 2y1E4( ( $FE9 %,,T22   fd### i))) k9--- fd### dB h''' gu%%% k9--- fd### fd### k9--- /&tH~~666.      fd### i))) k9--- lJ/// gu%%%%%rctr'rrs rrzAttribute.__setattr__ s!###rc |j}njtdfdtjD}|d|jj|ddd|S)Nz8Type annotation and type argument cannot both be presentc:i|]}|dv|t|S))r^r/r.r+rr()rr$rs rr&z0Attribute.from_counting_attr.. sE     wr1~~rF)r^r/r.r+r1rr)r+r?rr) _validator_default)rr^rr+ inst_dicts ` rrzAttribute.from_counting_attr s <7DD W J      (    s mK      rc |tj|}|||S)z Copy *self* and apply *changes*. This works similarly to `attrs.evolve` but that function does not work with `Attribute`. It is mainly meant to be used for `transform-fields`. .. versionadded:: 20.3.0 )copy _setattrsr)rchangesnews rrzAttribute.evolve s0ioo gmmoo&&& rcDtfdjDS)( Play nice with pickle. c3lK|].}|dkrt|ntjV/dS)r5N)rrr5rRs rrz)Attribute.__getstate__.. sZ  $(:#5#5GD$   4 ;N;N      rrDr)rs`rrzAttribute.__getstate__ s?          rcV|t|j|dSrWN)rSrWr))rrXs rrzAttribute.__setstate__! s( s4>51122222rc t|}|D]L\}}|dkr ||||||r!tjt |nt MdS)Nr5)rrVrGrHrrI)rname_values_pairsrJr^rs rrSzAttribute._setattrs' s$,,T22 ,  KD%z!! dE**** 3E*4;;7772   r) NNNFNNNNNNr') rrr r!r)rrr6rrrrrSrrrrrl s))VI<  '5&5&5&5&n$$$   [ >$   333     rrcng|]2}t|tddddd|dkddt| 3S)NTFr5) r^r.r/r0r1r7r9r2r3rr<)rrrrr^s rrr5 sg     j %d++   r)rwc(g|]}|jdk |Srrrs rrrI s$666Q+ 5 5q 5 5 5rc6g|]}|j |jdk|Sr)r2r^rs rrrK s+ = = =AF =qv'<'<1'<'<'j s|$ # )$//   r) rrOr0r7r9r2r3r;r<r5NTFrdrc$txjdz c_tj|_||_||_||_||_| |_| |_| |_ ||_ ||_ ||_ ||_ | |_| |_||_||_dSr)rG cls_counterrrOrNr4r0r7r8r9r:r2r3r5r+r6r;r<)rr.r/r0r1r2r3r4r5r+r6r7r8r9r:r;r<s rrz_CountingAttr.__init__ s& !!Q&!!$0  #"   "      $ rcX|j||_nt|j||_|S)z Decorator that adds *meth* to the list of validators. Returns *meth* unchanged. .. versionadded:: 17.1.0 )rNrFrrzs rr/z_CountingAttr.validator s- ? ""DOO"4?D99DO rcj|jturtt|d|_|S)z Decorator that allows to set the default for an attribute. Returns *meth* unchanged. :raises DefaultAlreadySetError: If default has been set before. .. versionadded:: 17.1.0 T)r2)rOrr rArhs rr.z_CountingAttr.default s6 = ' '(** *666  r) rrr r!r)rDrrrfrr/r.rrrrGrGO sI$e$  %<      ;/O`K###J   rrGc*eZdZdZdZddZdZdZdS) rAa Stores a factory callable. If passed as the default value to `attrs.field`, the factory is used to generate a new value. :param callable factory: A callable that takes either none or exactly one mandatory positional argument depending on *takes_self*. :param bool takes_self: Pass the partially initialized instance that is being initialized as a positional argument. .. versionadded:: 17.1.0 *takes_self* rHr2Fc"||_||_dSr'rk)rrHr2s rrzFactory.__init__ s $rcDtfdjDS)rWc38K|]}t|VdSr'r(rRs rrz'Factory.__getstate__.. s-DDTWT4((DDDDDDrrYrs`rrzFactory.__getstate__ s*DDDDT^DDDDDDrc^t|j|D]\}}t|||dSr[)rWr)r)rrXr^rs rrzFactory.__setstate__ sBt~u55 ' 'KD% D$ & & & & ' 'rN)F)rrr r!r)rrrrrrrArA sZ  *I%%%%EEE '''''rrAcJg|] }t|tdddddddd !S)NTF) r^r.r/r0r1r7r9r2r3r)rrr_s rrr sW          rc  t|tr|}n8t|ttfr d|D}nt d|dd}|dd}|dd}i || d<|| d<|| d<t j||i fd} tj dj d d |_ n#ttf$rYnwxYw|d d} t| | d | d d\|d <|d <t!dd|i||S)a A quick way to create a new class called *name* with *attrs*. :param str name: The name for the new class. :param attrs: A list of names or a dictionary of mappings of names to `attr.ib`\ s / `attrs.field`\ s. The order is deduced from the order of the names or attributes inside *attrs*. Otherwise the order of the definition of the attributes is used. :type attrs: `list` or `dict` :param tuple bases: Classes that the new class will subclass. :param attributes_arguments: Passed unmodified to `attr.s`. :return: A new class with *attrs*. :rtype: type .. versionadded:: 17.1.0 *bases* .. versionchanged:: 18.1.0 If *attrs* is ordered, the order is retained. c,i|]}|tSr)rIrs rr&zmake_class..5 s///AAvxx///rz(attrs argument must be a dict or a list.rNrrc.|Sr')r3)rEbodys rrzmake_class..E s $rrr__main__r1r7r9Trr)rBrrCrDr>poprG new_classr _getframe f_globalsrrrr?rr) r^rwbasesattributes_argumentscls_dictrr user_inittype_r1rts @r make_classr s0%D ED%= ) )D/////BCCC||0$77H 2D99I Z..I D%- !"&/ "#$Z OD%-G-G-G-G H HE  =++599     J '       " "5$ / /C "   &&  ))   T"W% :6 9 9 9$8 9 9% @ @@s2C99D  D )rr2c,eZdZdZeZdZdS) _AndValidatorz2 Compose many validators to a single one. c4|jD]}||||dSr') _validators)rrrrr%s r__call__z_AndValidator.__call__m s5! ! !A AdD%  ! !rN)rrr r!rIrrrrrrre s:&((K!!!!!rrcg}|D]4}|t|tr|jn|g5tt |S)z A validator that composes multiple validators into one. When called on a value, it runs all wrapped validators. :param callables validators: Arbitrary number of validators. .. versionadded:: 17.1.0 )rrBrrrD) validatorsrBr/s rrFrFr sh D   )]33 I ! !    t % %%rc fd}stjd}||d|_nftd}|r ||jd<td}|r ||jd<|S)aY A converter that composes multiple converters into one. When called on a value, it runs all wrapped converters, returning the *last* value. Type annotations will be inferred from the wrapped converters', if they have any. :param callables converters: Arbitrary number of converters. .. versionadded:: 20.1.0 c(D] }||}|Sr'r)rr4 converterss rpipe_converterzpipe..pipe_converter s&# ! !I)C..CC rA)rr,rrrVr,)typingTypeVarrr r4get_return_type)rrrr?rts` rrErE s  : N3  12a)@)@&& !A / / D D F F  645N *5 1"*R. 1 1 A A C C  :79N *8 4 r)NrJ)T)NNNNNNNFFTFFFFFNNFFNNNTNr')NN)ZrRr"r[rrGroperatorrrJrrrrr r r exceptionsr r rrobjectrrrr3rr4rHrIrrErrrEnumrrintr%rIrTrcrurvrrrrrrrrrrr=rrwrrrrarrurtrrrDrrrrr rgrrr!r#r r}rrr)_arGrA_frrrFrrrrs7  (''''''''' ! +')2E2266 FHH %gow7GHHty(   ( ( ( ( ( ( ( ("        IIIIX    :""":%$   000"    ###>%%%8oGoGoGd       ggggggggT4&(&(&(T.26         1UUUUp  ///GDGDGDT&%B%B%BP5*5*5*p    666r%%%P&&&...."'''KKKHHHV333   )))   VVVr##FFFFFFFFR#" I G )2&&&66"666 > =b = = =     OOOOOOOOd -0011  ' ' ' ' ' ' ' 'F! )GGIIgR888CCC2 N N N$*)DADADADAVT ! ! ! ! ! ! ! !&&&*$$$$$r