zmc
2023-10-12 ed135d79df12a2466b52dae1a82326941211dcc9
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
U
L±dã@sòdZddlmZddlmZddlmZddlmZ    ddl
m Z m Z m Z mZmZddlmZdd    d    d    d    d    d
d d
d d    d d d
d    d d
d    d    d    d
d œd d„ZeZeed
d    dZe d    d
d    d
d    d    d    d    d d    d    d    d    dœdd„Zd
d    d    dœdd„Zd
d    dœdd„Zd    S)z]
These are keyword-only APIs that call `attr.s` and `attr.ib` with different
default values.
é)Úpartialé)Úsetters)Úasdict)Úastuple)ÚNOTHINGÚ_frozen_setattrsÚ_ng_default_on_setattrÚattribÚattrs)ÚUnannotatedAttributeErrorNTF)ÚtheseÚreprÚ unsafe_hashÚhashÚinitÚslotsÚfrozenÚ weakref_slotÚstrÚ auto_attribsÚkw_onlyÚ
cache_hashÚauto_excÚeqÚorderÚ auto_detectÚgetstate_setstateÚ
on_setattrÚfield_transformerÚ
match_argscsZ‡‡‡‡‡‡‡‡    ‡
‡ ‡ ‡ ‡‡‡‡‡‡‡fdd„‰‡‡‡‡ fdd„}|dkrN|S||ƒSdS)aå
    Define an *attrs* class.
 
    Differences to the classic `attr.s` that it uses underneath:
 
    - Automatically detect whether or not *auto_attribs* should be `True` (c.f.
      *auto_attribs* parameter).
    - If *frozen* is `False`, run converters and validators when setting an
      attribute by default.
    - *slots=True*
 
      .. caution::
 
         Usually this has only upsides and few visible effects in everyday
         programming. But it *can* lead to some suprising behaviors, so please
         make sure to read :term:`slotted classes`.
    - *auto_exc=True*
    - *auto_detect=True*
    - *order=False*
    - Some options that were only relevant on Python 2 or were kept around for
      backwards-compatibility have been removed.
 
    Please note that these are all defaults and you can change them as you
    wish.
 
    :param Optional[bool] auto_attribs: If set to `True` or `False`, it behaves
       exactly like `attr.s`. If left `None`, `attr.s` will try to guess:
 
       1. If any attributes are annotated and no unannotated `attrs.fields`\ s
          are found, it assumes *auto_attribs=True*.
       2. Otherwise it assumes *auto_attribs=False* and tries to collect
          `attrs.fields`\ s.
 
    For now, please refer to `attr.s` for the rest of the parameters.
 
    .. versionadded:: 20.1.0
    .. versionchanged:: 21.3.0 Converters are also run ``on_setattr``.
    .. versionadded:: 22.2.0
       *unsafe_hash* as an alias for *hash* (for :pep:`681` compliance).
    cs4t|ˆˆ ˆˆˆˆˆˆˆ|ˆ    ˆˆˆˆ ˆdˆˆ ˆˆ
dS)NT)Ú    maybe_clsr rrrrrrrrrrrrrrrZcollect_by_mrorrrr )r )Úclsr)rrrrrrrrrrr rrrrrr rr©úEd:\z\workplace\vscode\pyvenv\venv\Lib\site-packages\attr/_next_gen.pyÚdo_itYs0êzdefine.<locals>.do_itcsˆdtjfk}ˆdkr"ˆdkr"t‰|jD]$}|jtkr(|rBtdƒ‚tj‰qNq(ˆdk    r`ˆ|ˆƒSz ˆ|dƒWStk
rŠˆ|dƒYSXdS)z—
        Making this a wrapper ensures this code runs during class creation.
 
        We also ensure that frozen-ness of classes is inherited.
        NFz@Frozen classes can't use on_setattr (frozen-ness was inherited).T)rZNO_OPr    Ú    __bases__Ú __setattr__rÚ
ValueErrorr )r"Zhad_on_setattrZbase_cls)rr%rrr#r$Úwrapss"
 
ÿ
 zdefine.<locals>.wrapNr#)r!r rrrrrrrrrrrrrrrrrrr r)r#)rrrrr%rrrrrrrr rrrrrr rrr$Údefines
A0%r*)rr©ÚdefaultZ    validatorrrrÚmetadataÚtypeÚ    converterÚfactoryrrrrÚaliascCs$t||||||||||    |
| | | dS)a,
    Identical to `attr.ib`, except keyword-only and with some arguments
    removed.
 
    .. versionadded:: 23.1.0
       The *type* parameter has been re-added; mostly for
       {func}`attrs.make_class`. Please note that type checkers ignore this
       metadata.
    .. versionadded:: 20.1.0
    r+)r
r+r#r#r$Úfield¢s òr2)ÚrecurseÚfilterÚvalue_serializercCst||||ddS)zŸ
    Same as `attr.asdict`, except that collections types are always retained
    and dict is always used as *dict_factory*.
 
    .. versionadded:: 21.3.0
    T)Úinstr3r4r5Úretain_collection_types)Ú_asdict)r6r3r4r5r#r#r$rÏsûr)r3r4cCst|||ddS)z¨
    Same as `attr.astuple`, except that collections types are always retained
    and `tuple` is always used as the *tuple_factory*.
 
    .. versionadded:: 21.3.0
    T)r6r3r4r7)Ú_astuple)r6r3r4r#r#r$rßs ÿr)N)Ú__doc__Ú    functoolsrÚrZ_funcsrr8rr9Ú_makerrr    r
r Ú
exceptionsr r*Zmutablerr2r#r#r#r$Ú<module>sb     ÿê ñ -