_next_gen
These are Python 3.6+-only and keyword-only APIs that call attr.s
and attr.ib
with different default values.
define(maybe_cls=None, *, these=None, repr=None, hash=None, init=None, slots=True, frozen=False, weakref_slot=True, str=False, auto_attribs=None, kw_only=False, cache_hash=False, auto_exc=True, eq=None, order=False, auto_detect=True, getstate_setstate=None, on_setattr=None, field_transformer=None)
The only behavioral differences are the handling of the auto_attribs option:
: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:
- If any attributes are annotated and no unannotated
attr.ib
\ s are found, it assumes auto_attribs=True. - Otherwise it assumes auto_attribs=False and tries to collect
attr.ib
\ s.
and that mutable classes (frozen=False
) validate on __setattr__
.
.. versionadded:: 20.1.0
Source code in client/ayon_fusion/vendor/attr/_next_gen.py
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 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 |
|
field(*, default=NOTHING, validator=None, repr=True, hash=None, init=True, metadata=None, converter=None, factory=None, kw_only=False, eq=None, order=None, on_setattr=None)
Identical to attr.ib
, except keyword-only and with some arguments removed.
.. versionadded:: 20.1.0
Source code in client/ayon_fusion/vendor/attr/_next_gen.py
124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 |
|