{
    "content": [
        {
            "type": "text",
            "text": "# attr (pydoc)\n\n**Summary:** attr - Classes Without Boilerplate <https://www.attrs.org/>\n\n## Section Outline\n\n- **NAME** (2 lines)\n- **PACKAGE CONTENTS** (13 lines)\n- **CLASSES** (4 lines) — 2 subsections\n  - class Attribute (107 lines)\n  - class Factory (44 lines)\n- **FUNCTIONS** (1 lines) — 15 subsections\n  - asdict (31 lines)\n  - assoc (15 lines)\n  - astuple (154 lines)\n  - attrib (376 lines)\n  - attrs (247 lines)\n  - cmp_using (26 lines)\n  - evolve (14 lines)\n  - fields (16 lines)\n  - fields_dict (16 lines)\n  - get_run_validators (2 lines)\n  - has (136 lines)\n  - make_class (23 lines)\n  - resolve_types (279 lines)\n  - set_run_validators (2 lines)\n  - validate (6 lines)\n- **DATA** (11 lines)\n- **VERSION** (2 lines)\n- **AUTHOR** (2 lines)\n- **FILE** (3 lines)\n\n## Full Content\n\n### NAME\n\nattr - Classes Without Boilerplate <https://www.attrs.org/>\n\n### PACKAGE CONTENTS\n\ncmp\ncompat\nconfig\nfuncs\nmake\nnextgen\nversioninfo\nconverters\nexceptions\nfilters\nsetters\nvalidators\n\n### CLASSES\n\nbuiltins.object\nattr.make.Attribute\nattr.make.Factory\n\n#### class Attribute\n\n|  Attribute(name, default, validator, repr, cmp, hash, init, inherited, metadata=None, type=None, converter=None, kwonly=False, eq=None, eqkey=None, order=None, orderkey=None, onsetattr=None)\n|\n|  *Read-only* representation of an attribute.\n|\n|  Instances of this class are frequently used for introspection purposes\n|  like:\n|\n|  - `fields` returns a tuple of them.\n|  - Validators get them passed as the first argument.\n|  - The *field transformer* hook receives a list of them.\n|\n|  :attribute name: The name of the attribute.\n|  :attribute inherited: Whether or not that attribute has been inherited from\n|      a base class.\n|\n|  Plus *all* arguments of `attr.ib` (except for ``factory``\n|  which is only syntactic sugar for ``default=Factory(...)``.\n|\n|  .. versionadded:: 20.1.0 *inherited*\n|  .. versionadded:: 20.1.0 *onsetattr*\n|  .. versionchanged:: 20.2.0 *inherited* is not taken into account for\n|      equality checks and hashing anymore.\n|  .. versionadded:: 21.1.0 *eqkey* and *orderkey*\n|\n|  For the full version history of the fields, see `attr.ib`.\n|\n|  Methods defined here:\n|\n|  eq(self, other)\n|\n|  getstate(self)\n|      Play nice with pickle.\n|\n|  hash(self)\n|\n|  init(self, name, default, validator, repr, cmp, hash, init, inherited, metadata=None, type=None, converter=None, kwonly=False, eq=None, eqkey=None, order=None, orderkey=None, onsetattr=None)\n|      Initialize self.  See help(type(self)) for accurate signature.\n|\n|  ne(self, other)\n|      Check equality and either forward a NotImplemented or\n|      return the result negated.\n|\n|  repr(self)\n|      Automatically created by attrs.\n|\n|  setattr(self, name, value)\n|      Implement setattr(self, name, value).\n|\n|  setstate(self, state)\n|      Play nice with pickle.\n|\n|  evolve(self, changes)\n|      Copy *self* and apply *changes*.\n|\n|      This works similarly to `attr.evolve` but that function does not work\n|      with ``Attribute``.\n|\n|      It is mainly meant to be used for `transform-fields`.\n|\n|      .. versionadded:: 20.3.0\n|\n|  ----------------------------------------------------------------------\n|  Class methods defined here:\n|\n|  fromcountingattr(name, ca, type=None) from builtins.type\n|\n|  ----------------------------------------------------------------------\n|  Readonly properties defined here:\n|\n|  cmp\n|      Simulate the presence of a cmp attribute and warn.\n|\n|  ----------------------------------------------------------------------\n|  Data descriptors defined here:\n|\n|  converter\n|\n|  default\n|\n|  eq\n|\n|  eqkey\n|\n|  hash\n|\n|  inherited\n|\n|  init\n|\n|  kwonly\n|\n|  metadata\n|\n|  name\n|\n|  onsetattr\n|\n|  order\n|\n|  orderkey\n|\n|  repr\n|\n|  type\n|\n|  validator\n\n#### class Factory\n\n|  Factory(factory, takesself=False)\n|\n|  Stores a factory callable.\n|\n|  If passed as the default value to `attr.ib`, the factory is used to\n|  generate a new value.\n|\n|  :param callable factory: A callable that takes either none or exactly one\n|      mandatory positional argument depending on *takesself*.\n|  :param bool takesself: Pass the partially initialized instance that is\n|      being initialized as a positional argument.\n|\n|  .. versionadded:: 17.1.0  *takesself*\n|\n|  Methods defined here:\n|\n|  eq(self, other)\n|\n|  getstate(self)\n|      Play nice with pickle.\n|\n|  hash(self)\n|\n|  init(self, factory, takesself=False)\n|      `Factory` is part of the default machinery so if we want a default\n|      value here, we have to implement it ourselves.\n|\n|  ne(self, other)\n|      Check equality and either forward a NotImplemented or\n|      return the result negated.\n|\n|  repr(self)\n|      Automatically created by attrs.\n|\n|  setstate(self, state)\n|      Play nice with pickle.\n|\n|  ----------------------------------------------------------------------\n|  Data descriptors defined here:\n|\n|  factory\n|\n|  takesself\n\n### FUNCTIONS\n\n#### asdict\n\nReturn the ``attrs`` attribute values of *inst* as a dict.\n\nOptionally recurse into other ``attrs``-decorated classes.\n\n:param inst: Instance of an ``attrs``-decorated class.\n:param bool recurse: Recurse into classes that are also\n``attrs``-decorated.\n:param callable filter: A callable whose return code determines whether an\nattribute or element is included (``True``) or dropped (``False``).  Is\ncalled with the `attr.Attribute` as the first argument and the\nvalue as the second argument.\n:param callable dictfactory: A callable to produce dictionaries from.  For\nexample, to produce ordered dictionaries instead of normal Python\ndictionaries, pass in ``collections.OrderedDict``.\n:param bool retaincollectiontypes: Do not convert to ``list`` when\nencountering an attribute whose type is ``tuple`` or ``set``.  Only\nmeaningful if ``recurse`` is ``True``.\n:param Optional[callable] valueserializer: A hook that is called for every\nattribute or dict key/value.  It receives the current instance, field\nand value and must return the (updated) value.  The hook is run *after*\nthe optional *filter* has been applied.\n\n:rtype: return type of *dictfactory*\n\n:raise attr.exceptions.NotAnAttrsClassError: If *cls* is not an ``attrs``\nclass.\n\n..  versionadded:: 16.0.0 *dictfactory*\n..  versionadded:: 16.1.0 *retaincollectiontypes*\n..  versionadded:: 20.3.0 *valueserializer*\n\n#### assoc\n\nCopy *inst* and apply *changes*.\n\n:param inst: Instance of a class with ``attrs`` attributes.\n:param changes: Keyword changes in the new copy.\n\n:return: A copy of inst with *changes* incorporated.\n\n:raise attr.exceptions.AttrsAttributeNotFoundError: If *attrname* couldn't\nbe found on *cls*.\n:raise attr.exceptions.NotAnAttrsClassError: If *cls* is not an ``attrs``\nclass.\n\n..  deprecated:: 17.1.0\nUse `evolve` instead.\n\n#### astuple\n\nReturn the ``attrs`` attribute values of *inst* as a tuple.\n\nOptionally recurse into other ``attrs``-decorated classes.\n\n:param inst: Instance of an ``attrs``-decorated class.\n:param bool recurse: Recurse into classes that are also\n``attrs``-decorated.\n:param callable filter: A callable whose return code determines whether an\nattribute or element is included (``True``) or dropped (``False``).  Is\ncalled with the `attr.Attribute` as the first argument and the\nvalue as the second argument.\n:param callable tuplefactory: A callable to produce tuples from.  For\nexample, to produce lists instead of tuples.\n:param bool retaincollectiontypes: Do not convert to ``list``\nor ``dict`` when encountering an attribute which type is\n``tuple``, ``dict`` or ``set``.  Only meaningful if ``recurse`` is\n``True``.\n\n:rtype: return type of *tuplefactory*\n\n:raise attr.exceptions.NotAnAttrsClassError: If *cls* is not an ``attrs``\nclass.\n\n..  versionadded:: 16.2.0\n\nattr = attrib(default=NOTHING, validator=None, repr=True, cmp=None, hash=None, init=True, metadata=None, type=None, converter=None, factory=None, kwonly=False, eq=None, order=None, onsetattr=None)\nCreate a new attribute on a class.\n\n..  warning::\n\nDoes *not* do anything unless the class is also decorated with\n`attr.s`!\n\n:param default: A value that is used if an ``attrs``-generated ``init``\nis used and no value is passed while instantiating or the attribute is\nexcluded using ``init=False``.\n\nIf the value is an instance of `Factory`, its callable will be\nused to construct a new value (useful for mutable data types like lists\nor dicts).\n\nIf a default is not set (or set manually to `attr.NOTHING`), a value\n*must* be supplied when instantiating; otherwise a `TypeError`\nwill be raised.\n\nThe default can also be set using decorator notation as shown below.\n\n:type default: Any value\n\n:param callable factory: Syntactic sugar for\n``default=attr.Factory(factory)``.\n\n:param validator: `callable` that is called by ``attrs``-generated\n``init`` methods after the instance has been initialized.  They\nreceive the initialized instance, the `Attribute`, and the\npassed value.\n\nThe return value is *not* inspected so the validator has to throw an\nexception itself.\n\nIf a `list` is passed, its items are treated as validators and must\nall pass.\n\nValidators can be globally disabled and re-enabled using\n`getrunvalidators`.\n\nThe validator can also be set using decorator notation as shown below.\n\n:type validator: `callable` or a `list` of `callable`\\ s.\n\n:param repr: Include this attribute in the generated ``repr``\nmethod. If ``True``, include the attribute; if ``False``, omit it. By\ndefault, the built-in ``repr()`` function is used. To override how the\nattribute value is formatted, pass a ``callable`` that takes a single\nvalue and returns a string. Note that the resulting string is used\nas-is, i.e. it will be used directly *instead* of calling ``repr()``\n(the default).\n:type repr: a `bool` or a `callable` to use a custom function.\n\n:param eq: If ``True`` (default), include this attribute in the\ngenerated ``eq`` and ``ne`` methods that check two instances\nfor equality. To override how the attribute value is compared,\npass a ``callable`` that takes a single value and returns the value\nto be compared.\n:type eq: a `bool` or a `callable`.\n\n:param order: If ``True`` (default), include this attributes in the\ngenerated ``lt``, ``le``, ``gt`` and ``ge`` methods.\nTo override how the attribute value is ordered,\npass a ``callable`` that takes a single value and returns the value\nto be ordered.\n:type order: a `bool` or a `callable`.\n\n:param cmp: Setting *cmp* is equivalent to setting *eq* and *order* to the\nsame value. Must not be mixed with *eq* or *order*.\n:type cmp: a `bool` or a `callable`.\n\n:param Optional[bool] hash: Include this attribute in the generated\n``hash`` method.  If ``None`` (default), mirror *eq*'s value.  This\nis the correct behavior according the Python spec.  Setting this value\nto anything else than ``None`` is *discouraged*.\n:param bool init: Include this attribute in the generated ``init``\nmethod.  It is possible to set this to ``False`` and set a default\nvalue.  In that case this attributed is unconditionally initialized\nwith the specified default value or factory.\n:param callable converter: `callable` that is called by\n``attrs``-generated ``init`` methods to convert attribute's value\nto the desired format.  It is given the passed-in value, and the\nreturned value will be used as the new value of the attribute.  The\nvalue is converted before being passed to the validator, if any.\n:param metadata: An arbitrary mapping, to be used by third-party\ncomponents.  See `extendingmetadata`.\n:param type: The type of the attribute.  In Python 3.6 or greater, the\npreferred method to specify the type is using a variable annotation\n(see `PEP 526 <https://www.python.org/dev/peps/pep-0526/>`).\nThis argument is provided for backward compatibility.\nRegardless of the approach used, the type will be stored on\n``Attribute.type``.\n\nPlease note that ``attrs`` doesn't do anything with this metadata by\nitself. You can use it as part of your own code or for\n`static type checking <types>`.\n:param kwonly: Make this attribute keyword-only (Python 3+)\nin the generated ``init`` (if ``init`` is ``False``, this\nparameter is ignored).\n:param onsetattr: Allows to overwrite the *onsetattr* setting from\n`attr.s`. If left `None`, the *onsetattr* value from `attr.s` is used.\nSet to `attr.setters.NOOP` to run no `setattr` hooks for this\nattribute -- regardless of the setting in `attr.s`.\n:type onsetattr: `callable`, or a list of callables, or `None`, or\n`attr.setters.NOOP`\n\n.. versionadded:: 15.2.0 *convert*\n.. versionadded:: 16.3.0 *metadata*\n.. versionchanged:: 17.1.0 *validator* can be a ``list`` now.\n.. versionchanged:: 17.1.0\n*hash* is ``None`` and therefore mirrors *eq* by default.\n.. versionadded:: 17.3.0 *type*\n.. deprecated:: 17.4.0 *convert*\n.. versionadded:: 17.4.0 *converter* as a replacement for the deprecated\n*convert* to achieve consistency with other noun-based arguments.\n.. versionadded:: 18.1.0\n``factory=f`` is syntactic sugar for ``default=attr.Factory(f)``.\n.. versionadded:: 18.2.0 *kwonly*\n.. versionchanged:: 19.2.0 *convert* keyword argument removed.\n.. versionchanged:: 19.2.0 *repr* also accepts a custom callable.\n.. deprecated:: 19.2.0 *cmp* Removal on or after 2021-06-01.\n.. versionadded:: 19.2.0 *eq* and *order*\n.. versionadded:: 20.1.0 *onsetattr*\n.. versionchanged:: 20.3.0 *kwonly* backported to Python 2\n.. versionchanged:: 21.1.0\n*eq*, *order*, and *cmp* also accept a custom callable\n.. versionchanged:: 21.1.0 *cmp* undeprecated\n\n#### attrib\n\nCreate a new attribute on a class.\n\n..  warning::\n\nDoes *not* do anything unless the class is also decorated with\n`attr.s`!\n\n:param default: A value that is used if an ``attrs``-generated ``init``\nis used and no value is passed while instantiating or the attribute is\nexcluded using ``init=False``.\n\nIf the value is an instance of `Factory`, its callable will be\nused to construct a new value (useful for mutable data types like lists\nor dicts).\n\nIf a default is not set (or set manually to `attr.NOTHING`), a value\n*must* be supplied when instantiating; otherwise a `TypeError`\nwill be raised.\n\nThe default can also be set using decorator notation as shown below.\n\n:type default: Any value\n\n:param callable factory: Syntactic sugar for\n``default=attr.Factory(factory)``.\n\n:param validator: `callable` that is called by ``attrs``-generated\n``init`` methods after the instance has been initialized.  They\nreceive the initialized instance, the `Attribute`, and the\npassed value.\n\nThe return value is *not* inspected so the validator has to throw an\nexception itself.\n\nIf a `list` is passed, its items are treated as validators and must\nall pass.\n\nValidators can be globally disabled and re-enabled using\n`getrunvalidators`.\n\nThe validator can also be set using decorator notation as shown below.\n\n:type validator: `callable` or a `list` of `callable`\\ s.\n\n:param repr: Include this attribute in the generated ``repr``\nmethod. If ``True``, include the attribute; if ``False``, omit it. By\ndefault, the built-in ``repr()`` function is used. To override how the\nattribute value is formatted, pass a ``callable`` that takes a single\nvalue and returns a string. Note that the resulting string is used\nas-is, i.e. it will be used directly *instead* of calling ``repr()``\n(the default).\n:type repr: a `bool` or a `callable` to use a custom function.\n\n:param eq: If ``True`` (default), include this attribute in the\ngenerated ``eq`` and ``ne`` methods that check two instances\nfor equality. To override how the attribute value is compared,\npass a ``callable`` that takes a single value and returns the value\nto be compared.\n:type eq: a `bool` or a `callable`.\n\n:param order: If ``True`` (default), include this attributes in the\ngenerated ``lt``, ``le``, ``gt`` and ``ge`` methods.\nTo override how the attribute value is ordered,\npass a ``callable`` that takes a single value and returns the value\nto be ordered.\n:type order: a `bool` or a `callable`.\n\n:param cmp: Setting *cmp* is equivalent to setting *eq* and *order* to the\nsame value. Must not be mixed with *eq* or *order*.\n:type cmp: a `bool` or a `callable`.\n\n:param Optional[bool] hash: Include this attribute in the generated\n``hash`` method.  If ``None`` (default), mirror *eq*'s value.  This\nis the correct behavior according the Python spec.  Setting this value\nto anything else than ``None`` is *discouraged*.\n:param bool init: Include this attribute in the generated ``init``\nmethod.  It is possible to set this to ``False`` and set a default\nvalue.  In that case this attributed is unconditionally initialized\nwith the specified default value or factory.\n:param callable converter: `callable` that is called by\n``attrs``-generated ``init`` methods to convert attribute's value\nto the desired format.  It is given the passed-in value, and the\nreturned value will be used as the new value of the attribute.  The\nvalue is converted before being passed to the validator, if any.\n:param metadata: An arbitrary mapping, to be used by third-party\ncomponents.  See `extendingmetadata`.\n:param type: The type of the attribute.  In Python 3.6 or greater, the\npreferred method to specify the type is using a variable annotation\n(see `PEP 526 <https://www.python.org/dev/peps/pep-0526/>`).\nThis argument is provided for backward compatibility.\nRegardless of the approach used, the type will be stored on\n``Attribute.type``.\n\nPlease note that ``attrs`` doesn't do anything with this metadata by\nitself. You can use it as part of your own code or for\n`static type checking <types>`.\n:param kwonly: Make this attribute keyword-only (Python 3+)\nin the generated ``init`` (if ``init`` is ``False``, this\nparameter is ignored).\n:param onsetattr: Allows to overwrite the *onsetattr* setting from\n`attr.s`. If left `None`, the *onsetattr* value from `attr.s` is used.\nSet to `attr.setters.NOOP` to run no `setattr` hooks for this\nattribute -- regardless of the setting in `attr.s`.\n:type onsetattr: `callable`, or a list of callables, or `None`, or\n`attr.setters.NOOP`\n\n.. versionadded:: 15.2.0 *convert*\n.. versionadded:: 16.3.0 *metadata*\n.. versionchanged:: 17.1.0 *validator* can be a ``list`` now.\n.. versionchanged:: 17.1.0\n*hash* is ``None`` and therefore mirrors *eq* by default.\n.. versionadded:: 17.3.0 *type*\n.. deprecated:: 17.4.0 *convert*\n.. versionadded:: 17.4.0 *converter* as a replacement for the deprecated\n*convert* to achieve consistency with other noun-based arguments.\n.. versionadded:: 18.1.0\n``factory=f`` is syntactic sugar for ``default=attr.Factory(f)``.\n.. versionadded:: 18.2.0 *kwonly*\n.. versionchanged:: 19.2.0 *convert* keyword argument removed.\n.. versionchanged:: 19.2.0 *repr* also accepts a custom callable.\n.. deprecated:: 19.2.0 *cmp* Removal on or after 2021-06-01.\n.. versionadded:: 19.2.0 *eq* and *order*\n.. versionadded:: 20.1.0 *onsetattr*\n.. versionchanged:: 20.3.0 *kwonly* backported to Python 2\n.. versionchanged:: 21.1.0\n*eq*, *order*, and *cmp* also accept a custom callable\n.. versionchanged:: 21.1.0 *cmp* undeprecated\n\nattributes = attrs(maybecls=None, these=None, reprns=None, repr=None, cmp=None, hash=None, init=None, slots=False, frozen=False, weakrefslot=True, str=False, autoattribs=False, kwonly=False, cachehash=False, autoexc=False, eq=None, order=None, autodetect=False, collectbymro=False, getstatesetstate=None, onsetattr=None, fieldtransformer=None)\nA class decorator that adds `dunder\n<https://wiki.python.org/moin/DunderAlias>`\\ -methods according to the\nspecified attributes using `attr.ib` or the *these* argument.\n\n:param these: A dictionary of name to `attr.ib` mappings.  This is\nuseful to avoid the definition of your attributes within the class body\nbecause you can't (e.g. if you want to add ``repr`` methods to\nDjango models) or don't want to.\n\nIf *these* is not ``None``, ``attrs`` will *not* search the class body\nfor attributes and will *not* remove any attributes from it.\n\nIf *these* is an ordered dict (`dict` on Python 3.6+,\n`collections.OrderedDict` otherwise), the order is deduced from\nthe order of the attributes inside *these*.  Otherwise the order\nof the definition of the attributes is used.\n\n:type these: `dict` of `str` to `attr.ib`\n\n:param str reprns: When using nested classes, there's no way in Python 2\nto automatically detect that.  Therefore it's possible to set the\nnamespace explicitly for a more meaningful ``repr`` output.\n:param bool autodetect: Instead of setting the *init*, *repr*, *eq*,\n*order*, and *hash* arguments explicitly, assume they are set to\n``True`` unless any of the involved methods for one of the\narguments is implemented in the *current* class (i.e. it is *not*\ninherited from some base class).\n\nSo for example by implementing ``eq`` on a class yourself,\n``attrs`` will deduce ``eq=False`` and will create *neither*\n``eq`` *nor* ``ne`` (but Python classes come with a sensible\n``ne`` by default, so it *should* be enough to only implement\n``eq`` in most cases).\n\n.. warning::\n\nIf you prevent ``attrs`` from creating the ordering methods for you\n(``order=False``, e.g. by implementing ``le``), it becomes\n*your* responsibility to make sure its ordering is sound. The best\nway is to use the `functools.totalordering` decorator.\n\n\nPassing ``True`` or ``False`` to *init*, *repr*, *eq*, *order*,\n*cmp*, or *hash* overrides whatever *autodetect* would determine.\n\n*autodetect* requires Python 3. Setting it ``True`` on Python 2 raises\na `PythonTooOldError`.\n\n:param bool repr: Create a ``repr`` method with a human readable\nrepresentation of ``attrs`` attributes..\n:param bool str: Create a ``str`` method that is identical to\n``repr``.  This is usually not necessary except for\n`Exception`\\ s.\n:param Optional[bool] eq: If ``True`` or ``None`` (default), add ``eq``\nand ``ne`` methods that check two instances for equality.\n\nThey compare the instances as if they were tuples of their ``attrs``\nattributes if and only if the types of both classes are *identical*!\n:param Optional[bool] order: If ``True``, add ``lt``, ``le``,\n``gt``, and ``ge`` methods that behave like *eq* above and\nallow instances to be ordered. If ``None`` (default) mirror value of\n*eq*.\n:param Optional[bool] cmp: Setting *cmp* is equivalent to setting *eq*\nand *order* to the same value. Must not be mixed with *eq* or *order*.\n:param Optional[bool] hash: If ``None`` (default), the ``hash`` method\nis generated according how *eq* and *frozen* are set.\n\n1. If *both* are True, ``attrs`` will generate a ``hash`` for you.\n2. If *eq* is True and *frozen* is False, ``hash`` will be set to\nNone, marking it unhashable (which it is).\n3. If *eq* is False, ``hash`` will be left untouched meaning the\n``hash`` method of the base class will be used (if base class is\n``object``, this means it will fall back to id-based hashing.).\n\nAlthough not recommended, you can decide for yourself and force\n``attrs`` to create one (e.g. if the class is immutable even though you\ndidn't freeze it programmatically) by passing ``True`` or not.  Both of\nthese cases are rather special and should be used carefully.\n\nSee our documentation on `hashing`, Python's documentation on\n`object.hash`, and the `GitHub issue that led to the default \\\nbehavior <https://github.com/python-attrs/attrs/issues/136>` for more\ndetails.\n:param bool init: Create a ``init`` method that initializes the\n``attrs`` attributes. Leading underscores are stripped for the argument\nname. If a ``attrspreinit`` method exists on the class, it will\nbe called before the class is initialized. If a ``attrspostinit``\nmethod exists on the class, it will be called after the class is fully\ninitialized.\n\nIf ``init`` is ``False``, an ``attrsinit`` method will be\ninjected instead. This allows you to define a custom ``init``\nmethod that can do pre-init work such as ``super().init()``,\nand then call ``attrsinit()`` and ``attrspostinit()``.\n:param bool slots: Create a `slotted class <slotted classes>` that's more\nmemory-efficient. Slotted classes are generally superior to the default\ndict classes, but have some gotchas you should know about, so we\nencourage you to read the `glossary entry <slotted classes>`.\n:param bool frozen: Make instances immutable after initialization.  If\nsomeone attempts to modify a frozen instance,\n`attr.exceptions.FrozenInstanceError` is raised.\n\n.. note::\n\n1. This is achieved by installing a custom ``setattr`` method\non your class, so you can't implement your own.\n\n2. True immutability is impossible in Python.\n\n3. This *does* have a minor a runtime performance `impact\n<how-frozen>` when initializing new instances.  In other words:\n``init`` is slightly slower with ``frozen=True``.\n\n4. If a class is frozen, you cannot modify ``self`` in\n``attrspostinit`` or a self-written ``init``. You can\ncircumvent that limitation by using\n``object.setattr(self, \"attributename\", value)``.\n\n5. Subclasses of a frozen class are frozen too.\n\n:param bool weakrefslot: Make instances weak-referenceable.  This has no\neffect unless ``slots`` is also enabled.\n:param bool autoattribs: If ``True``, collect `PEP 526`-annotated\nattributes (Python 3.6 and later only) from the class body.\n\nIn this case, you must annotate every field.  If ``attrs``\nencounters a field that is set to an `attr.ib` but lacks a type\nannotation, an `attr.exceptions.UnannotatedAttributeError` is\nraised.  Use ``fieldname: typing.Any = attr.ib(...)`` if you don't\nwant to set a type.\n\nIf you assign a value to those attributes (e.g. ``x: int = 42``), that\nvalue becomes the default value like if it were passed using\n``attr.ib(default=42)``.  Passing an instance of `Factory` also\nworks as expected in most cases (see warning below).\n\nAttributes annotated as `typing.ClassVar`, and attributes that are\nneither annotated nor set to an `attr.ib` are ignored.\n\n.. warning::\nFor features that use the attribute name to create decorators (e.g.\n`validators <validators>`), you still *must* assign `attr.ib` to\nthem. Otherwise Python will either not find the name or try to use\nthe default value to call e.g. ``validator`` on it.\n\nThese errors can be quite confusing and probably the most common bug\nreport on our bug tracker.\n\n.. `PEP 526`: https://www.python.org/dev/peps/pep-0526/\n:param bool kwonly: Make all attributes keyword-only (Python 3+)\nin the generated ``init`` (if ``init`` is ``False``, this\nparameter is ignored).\n:param bool cachehash: Ensure that the object's hash code is computed\nonly once and stored on the object.  If this is set to ``True``,\nhashing must be either explicitly or implicitly enabled for this\nclass.  If the hash code is cached, avoid any reassignments of\nfields involved in hash code computation or mutations of the objects\nthose fields point to after object creation.  If such changes occur,\nthe behavior of the object's hash code is undefined.\n:param bool autoexc: If the class subclasses `BaseException`\n(which implicitly includes any subclass of any exception), the\nfollowing happens to behave like a well-behaved Python exceptions\nclass:\n\n- the values for *eq*, *order*, and *hash* are ignored and the\ninstances compare and hash by the instance's ids (N.B. ``attrs`` will\n*not* remove existing implementations of ``hash`` or the equality\nmethods. It just won't add own ones.),\n- all attributes that are either passed into ``init`` or have a\ndefault value are additionally available as a tuple in the ``args``\nattribute,\n- the value of *str* is ignored leaving ``str`` to base classes.\n:param bool collectbymro: Setting this to `True` fixes the way ``attrs``\ncollects attributes from base classes.  The default behavior is\nincorrect in certain cases of multiple inheritance.  It should be on by\ndefault but is kept off for backward-compatability.\n\nSee issue `#428 <https://github.com/python-attrs/attrs/issues/428>` for\nmore details.\n\n:param Optional[bool] getstatesetstate:\n.. note::\nThis is usually only interesting for slotted classes and you should\nprobably just set *autodetect* to `True`.\n\nIf `True`, ``getstate`` and\n``setstate`` are generated and attached to the class. This is\nnecessary for slotted classes to be pickleable. If left `None`, it's\n`True` by default for slotted classes and ``False`` for dict classes.\n\nIf *autodetect* is `True`, and *getstatesetstate* is left `None`,\nand either ``getstate`` or ``setstate`` is detected directly\non the class (i.e. not inherited), it is set to `False` (this is usually\nwhat you want).\n\n:param onsetattr: A callable that is run whenever the user attempts to set\nan attribute (either by assignment like ``i.x = 42`` or by using\n`setattr` like ``setattr(i, \"x\", 42)``). It receives the same arguments\nas validators: the instance, the attribute that is being modified, and\nthe new value.\n\nIf no exception is raised, the attribute is set to the return value of\nthe callable.\n\nIf a list of callables is passed, they're automatically wrapped in an\n`attr.setters.pipe`.\n\n:param Optional[callable] fieldtransformer:\nA function that is called with the original class object and all\nfields right before ``attrs`` finalizes the class.  You can use\nthis, e.g., to automatically add converters or validators to\nfields based on their types.  See `transform-fields` for more details.\n\n.. versionadded:: 16.0.0 *slots*\n.. versionadded:: 16.1.0 *frozen*\n.. versionadded:: 16.3.0 *str*\n.. versionadded:: 16.3.0 Support for ``attrspostinit``.\n.. versionchanged:: 17.1.0\n*hash* supports ``None`` as value which is also the default now.\n.. versionadded:: 17.3.0 *autoattribs*\n.. versionchanged:: 18.1.0\nIf *these* is passed, no attributes are deleted from the class body.\n.. versionchanged:: 18.1.0 If *these* is ordered, the order is retained.\n.. versionadded:: 18.2.0 *weakrefslot*\n.. deprecated:: 18.2.0\n``lt``, ``le``, ``gt``, and ``ge`` now raise a\n`DeprecationWarning` if the classes compared are subclasses of\neach other. ``eq`` and ``ne`` never tried to compared subclasses\nto each other.\n.. versionchanged:: 19.2.0\n``lt``, ``le``, ``gt``, and ``ge`` now do not consider\nsubclasses comparable anymore.\n.. versionadded:: 18.2.0 *kwonly*\n.. versionadded:: 18.2.0 *cachehash*\n.. versionadded:: 19.1.0 *autoexc*\n.. deprecated:: 19.2.0 *cmp* Removal on or after 2021-06-01.\n.. versionadded:: 19.2.0 *eq* and *order*\n.. versionadded:: 20.1.0 *autodetect*\n.. versionadded:: 20.1.0 *collectbymro*\n.. versionadded:: 20.1.0 *getstatesetstate*\n.. versionadded:: 20.1.0 *onsetattr*\n.. versionadded:: 20.3.0 *fieldtransformer*\n.. versionchanged:: 21.1.0\n``init=False`` injects ``attrsinit``\n.. versionchanged:: 21.1.0 Support for ``attrspreinit``\n.. versionchanged:: 21.1.0 *cmp* undeprecated\n\n#### attrs\n\nA class decorator that adds `dunder\n<https://wiki.python.org/moin/DunderAlias>`\\ -methods according to the\nspecified attributes using `attr.ib` or the *these* argument.\n\n:param these: A dictionary of name to `attr.ib` mappings.  This is\nuseful to avoid the definition of your attributes within the class body\nbecause you can't (e.g. if you want to add ``repr`` methods to\nDjango models) or don't want to.\n\nIf *these* is not ``None``, ``attrs`` will *not* search the class body\nfor attributes and will *not* remove any attributes from it.\n\nIf *these* is an ordered dict (`dict` on Python 3.6+,\n`collections.OrderedDict` otherwise), the order is deduced from\nthe order of the attributes inside *these*.  Otherwise the order\nof the definition of the attributes is used.\n\n:type these: `dict` of `str` to `attr.ib`\n\n:param str reprns: When using nested classes, there's no way in Python 2\nto automatically detect that.  Therefore it's possible to set the\nnamespace explicitly for a more meaningful ``repr`` output.\n:param bool autodetect: Instead of setting the *init*, *repr*, *eq*,\n*order*, and *hash* arguments explicitly, assume they are set to\n``True`` unless any of the involved methods for one of the\narguments is implemented in the *current* class (i.e. it is *not*\ninherited from some base class).\n\nSo for example by implementing ``eq`` on a class yourself,\n``attrs`` will deduce ``eq=False`` and will create *neither*\n``eq`` *nor* ``ne`` (but Python classes come with a sensible\n``ne`` by default, so it *should* be enough to only implement\n``eq`` in most cases).\n\n.. warning::\n\nIf you prevent ``attrs`` from creating the ordering methods for you\n(``order=False``, e.g. by implementing ``le``), it becomes\n*your* responsibility to make sure its ordering is sound. The best\nway is to use the `functools.totalordering` decorator.\n\n\nPassing ``True`` or ``False`` to *init*, *repr*, *eq*, *order*,\n*cmp*, or *hash* overrides whatever *autodetect* would determine.\n\n*autodetect* requires Python 3. Setting it ``True`` on Python 2 raises\na `PythonTooOldError`.\n\n:param bool repr: Create a ``repr`` method with a human readable\nrepresentation of ``attrs`` attributes..\n:param bool str: Create a ``str`` method that is identical to\n``repr``.  This is usually not necessary except for\n`Exception`\\ s.\n:param Optional[bool] eq: If ``True`` or ``None`` (default), add ``eq``\nand ``ne`` methods that check two instances for equality.\n\nThey compare the instances as if they were tuples of their ``attrs``\nattributes if and only if the types of both classes are *identical*!\n:param Optional[bool] order: If ``True``, add ``lt``, ``le``,\n``gt``, and ``ge`` methods that behave like *eq* above and\nallow instances to be ordered. If ``None`` (default) mirror value of\n*eq*.\n:param Optional[bool] cmp: Setting *cmp* is equivalent to setting *eq*\nand *order* to the same value. Must not be mixed with *eq* or *order*.\n:param Optional[bool] hash: If ``None`` (default), the ``hash`` method\nis generated according how *eq* and *frozen* are set.\n\n1. If *both* are True, ``attrs`` will generate a ``hash`` for you.\n2. If *eq* is True and *frozen* is False, ``hash`` will be set to\nNone, marking it unhashable (which it is).\n3. If *eq* is False, ``hash`` will be left untouched meaning the\n``hash`` method of the base class will be used (if base class is\n``object``, this means it will fall back to id-based hashing.).\n\nAlthough not recommended, you can decide for yourself and force\n``attrs`` to create one (e.g. if the class is immutable even though you\ndidn't freeze it programmatically) by passing ``True`` or not.  Both of\nthese cases are rather special and should be used carefully.\n\nSee our documentation on `hashing`, Python's documentation on\n`object.hash`, and the `GitHub issue that led to the default \\\nbehavior <https://github.com/python-attrs/attrs/issues/136>` for more\ndetails.\n:param bool init: Create a ``init`` method that initializes the\n``attrs`` attributes. Leading underscores are stripped for the argument\nname. If a ``attrspreinit`` method exists on the class, it will\nbe called before the class is initialized. If a ``attrspostinit``\nmethod exists on the class, it will be called after the class is fully\ninitialized.\n\nIf ``init`` is ``False``, an ``attrsinit`` method will be\ninjected instead. This allows you to define a custom ``init``\nmethod that can do pre-init work such as ``super().init()``,\nand then call ``attrsinit()`` and ``attrspostinit()``.\n:param bool slots: Create a `slotted class <slotted classes>` that's more\nmemory-efficient. Slotted classes are generally superior to the default\ndict classes, but have some gotchas you should know about, so we\nencourage you to read the `glossary entry <slotted classes>`.\n:param bool frozen: Make instances immutable after initialization.  If\nsomeone attempts to modify a frozen instance,\n`attr.exceptions.FrozenInstanceError` is raised.\n\n.. note::\n\n1. This is achieved by installing a custom ``setattr`` method\non your class, so you can't implement your own.\n\n2. True immutability is impossible in Python.\n\n3. This *does* have a minor a runtime performance `impact\n<how-frozen>` when initializing new instances.  In other words:\n``init`` is slightly slower with ``frozen=True``.\n\n4. If a class is frozen, you cannot modify ``self`` in\n``attrspostinit`` or a self-written ``init``. You can\ncircumvent that limitation by using\n``object.setattr(self, \"attributename\", value)``.\n\n5. Subclasses of a frozen class are frozen too.\n\n:param bool weakrefslot: Make instances weak-referenceable.  This has no\neffect unless ``slots`` is also enabled.\n:param bool autoattribs: If ``True``, collect `PEP 526`-annotated\nattributes (Python 3.6 and later only) from the class body.\n\nIn this case, you must annotate every field.  If ``attrs``\nencounters a field that is set to an `attr.ib` but lacks a type\nannotation, an `attr.exceptions.UnannotatedAttributeError` is\nraised.  Use ``fieldname: typing.Any = attr.ib(...)`` if you don't\nwant to set a type.\n\nIf you assign a value to those attributes (e.g. ``x: int = 42``), that\nvalue becomes the default value like if it were passed using\n``attr.ib(default=42)``.  Passing an instance of `Factory` also\nworks as expected in most cases (see warning below).\n\nAttributes annotated as `typing.ClassVar`, and attributes that are\nneither annotated nor set to an `attr.ib` are ignored.\n\n.. warning::\nFor features that use the attribute name to create decorators (e.g.\n`validators <validators>`), you still *must* assign `attr.ib` to\nthem. Otherwise Python will either not find the name or try to use\nthe default value to call e.g. ``validator`` on it.\n\nThese errors can be quite confusing and probably the most common bug\nreport on our bug tracker.\n\n.. `PEP 526`: https://www.python.org/dev/peps/pep-0526/\n:param bool kwonly: Make all attributes keyword-only (Python 3+)\nin the generated ``init`` (if ``init`` is ``False``, this\nparameter is ignored).\n:param bool cachehash: Ensure that the object's hash code is computed\nonly once and stored on the object.  If this is set to ``True``,\nhashing must be either explicitly or implicitly enabled for this\nclass.  If the hash code is cached, avoid any reassignments of\nfields involved in hash code computation or mutations of the objects\nthose fields point to after object creation.  If such changes occur,\nthe behavior of the object's hash code is undefined.\n:param bool autoexc: If the class subclasses `BaseException`\n(which implicitly includes any subclass of any exception), the\nfollowing happens to behave like a well-behaved Python exceptions\nclass:\n\n- the values for *eq*, *order*, and *hash* are ignored and the\ninstances compare and hash by the instance's ids (N.B. ``attrs`` will\n*not* remove existing implementations of ``hash`` or the equality\nmethods. It just won't add own ones.),\n- all attributes that are either passed into ``init`` or have a\ndefault value are additionally available as a tuple in the ``args``\nattribute,\n- the value of *str* is ignored leaving ``str`` to base classes.\n:param bool collectbymro: Setting this to `True` fixes the way ``attrs``\ncollects attributes from base classes.  The default behavior is\nincorrect in certain cases of multiple inheritance.  It should be on by\ndefault but is kept off for backward-compatability.\n\nSee issue `#428 <https://github.com/python-attrs/attrs/issues/428>` for\nmore details.\n\n:param Optional[bool] getstatesetstate:\n.. note::\nThis is usually only interesting for slotted classes and you should\nprobably just set *autodetect* to `True`.\n\nIf `True`, ``getstate`` and\n``setstate`` are generated and attached to the class. This is\nnecessary for slotted classes to be pickleable. If left `None`, it's\n`True` by default for slotted classes and ``False`` for dict classes.\n\nIf *autodetect* is `True`, and *getstatesetstate* is left `None`,\nand either ``getstate`` or ``setstate`` is detected directly\non the class (i.e. not inherited), it is set to `False` (this is usually\nwhat you want).\n\n:param onsetattr: A callable that is run whenever the user attempts to set\nan attribute (either by assignment like ``i.x = 42`` or by using\n`setattr` like ``setattr(i, \"x\", 42)``). It receives the same arguments\nas validators: the instance, the attribute that is being modified, and\nthe new value.\n\nIf no exception is raised, the attribute is set to the return value of\nthe callable.\n\nIf a list of callables is passed, they're automatically wrapped in an\n`attr.setters.pipe`.\n\n:param Optional[callable] fieldtransformer:\nA function that is called with the original class object and all\nfields right before ``attrs`` finalizes the class.  You can use\nthis, e.g., to automatically add converters or validators to\nfields based on their types.  See `transform-fields` for more details.\n\n.. versionadded:: 16.0.0 *slots*\n.. versionadded:: 16.1.0 *frozen*\n.. versionadded:: 16.3.0 *str*\n.. versionadded:: 16.3.0 Support for ``attrspostinit``.\n.. versionchanged:: 17.1.0\n*hash* supports ``None`` as value which is also the default now.\n.. versionadded:: 17.3.0 *autoattribs*\n.. versionchanged:: 18.1.0\nIf *these* is passed, no attributes are deleted from the class body.\n.. versionchanged:: 18.1.0 If *these* is ordered, the order is retained.\n.. versionadded:: 18.2.0 *weakrefslot*\n.. deprecated:: 18.2.0\n``lt``, ``le``, ``gt``, and ``ge`` now raise a\n`DeprecationWarning` if the classes compared are subclasses of\neach other. ``eq`` and ``ne`` never tried to compared subclasses\nto each other.\n.. versionchanged:: 19.2.0\n``lt``, ``le``, ``gt``, and ``ge`` now do not consider\nsubclasses comparable anymore.\n.. versionadded:: 18.2.0 *kwonly*\n.. versionadded:: 18.2.0 *cachehash*\n.. versionadded:: 19.1.0 *autoexc*\n.. deprecated:: 19.2.0 *cmp* Removal on or after 2021-06-01.\n.. versionadded:: 19.2.0 *eq* and *order*\n.. versionadded:: 20.1.0 *autodetect*\n.. versionadded:: 20.1.0 *collectbymro*\n.. versionadded:: 20.1.0 *getstatesetstate*\n.. versionadded:: 20.1.0 *onsetattr*\n.. versionadded:: 20.3.0 *fieldtransformer*\n.. versionchanged:: 21.1.0\n``init=False`` injects ``attrsinit``\n.. versionchanged:: 21.1.0 Support for ``attrspreinit``\n.. versionchanged:: 21.1.0 *cmp* undeprecated\n\n#### cmp_using\n\nCreate a class that can be passed into `attr.ib`'s ``eq``, ``order``, and\n``cmp`` arguments to customize field comparison.\n\nThe resulting class will have a full set of ordering methods if\nat least one of ``{lt, le, gt, ge}`` and ``eq``  are provided.\n\n:param Optional[callable] eq: `callable` used to evaluate equality\nof two objects.\n:param Optional[callable] lt: `callable` used to evaluate whether\none object is less than another object.\n:param Optional[callable] le: `callable` used to evaluate whether\none object is less than or equal to another object.\n:param Optional[callable] gt: `callable` used to evaluate whether\none object is greater than another object.\n:param Optional[callable] ge: `callable` used to evaluate whether\none object is greater than or equal to another object.\n\n:param bool requiresametype: When `True`, equality and ordering methods\nwill return `NotImplemented` if objects are not of the same type.\n\n:param Optional[str] classname: Name of class. Defaults to 'Comparable'.\n\nSee `comparison` for more details.\n\n.. versionadded:: 21.1.0\n\n#### evolve\n\nCreate a new instance, based on *inst* with *changes* applied.\n\n:param inst: Instance of a class with ``attrs`` attributes.\n:param changes: Keyword changes in the new copy.\n\n:return: A copy of inst with *changes* incorporated.\n\n:raise TypeError: If *attrname* couldn't be found in the class\n``init``.\n:raise attr.exceptions.NotAnAttrsClassError: If *cls* is not an ``attrs``\nclass.\n\n..  versionadded:: 17.1.0\n\n#### fields\n\nReturn the tuple of ``attrs`` attributes for a class.\n\nThe tuple also allows accessing the fields by their names (see below for\nexamples).\n\n:param type cls: Class to introspect.\n\n:raise TypeError: If *cls* is not a class.\n:raise attr.exceptions.NotAnAttrsClassError: If *cls* is not an ``attrs``\nclass.\n\n:rtype: tuple (with name accessors) of `attr.Attribute`\n\n..  versionchanged:: 16.2.0 Returned tuple allows accessing the fields\nby name.\n\n#### fields_dict\n\nReturn an ordered dictionary of ``attrs`` attributes for a class, whose\nkeys are the attribute names.\n\n:param type cls: Class to introspect.\n\n:raise TypeError: If *cls* is not a class.\n:raise attr.exceptions.NotAnAttrsClassError: If *cls* is not an ``attrs``\nclass.\n\n:rtype: an ordered dict where keys are attribute names and values are\n`attr.Attribute`\\ s. This will be a `dict` if it's\nnaturally ordered like on Python 3.6+ or an\n:class:`~collections.OrderedDict` otherwise.\n\n.. versionadded:: 18.1.0\n\n#### get_run_validators\n\nReturn whether or not validators are run.\n\n#### has\n\nCheck whether *cls* is a class with ``attrs`` attributes.\n\n:param type cls: Class to introspect.\n:raise TypeError: If *cls* is not a class.\n\n:rtype: bool\n\nib = attrib(default=NOTHING, validator=None, repr=True, cmp=None, hash=None, init=True, metadata=None, type=None, converter=None, factory=None, kwonly=False, eq=None, order=None, onsetattr=None)\nCreate a new attribute on a class.\n\n..  warning::\n\nDoes *not* do anything unless the class is also decorated with\n`attr.s`!\n\n:param default: A value that is used if an ``attrs``-generated ``init``\nis used and no value is passed while instantiating or the attribute is\nexcluded using ``init=False``.\n\nIf the value is an instance of `Factory`, its callable will be\nused to construct a new value (useful for mutable data types like lists\nor dicts).\n\nIf a default is not set (or set manually to `attr.NOTHING`), a value\n*must* be supplied when instantiating; otherwise a `TypeError`\nwill be raised.\n\nThe default can also be set using decorator notation as shown below.\n\n:type default: Any value\n\n:param callable factory: Syntactic sugar for\n``default=attr.Factory(factory)``.\n\n:param validator: `callable` that is called by ``attrs``-generated\n``init`` methods after the instance has been initialized.  They\nreceive the initialized instance, the `Attribute`, and the\npassed value.\n\nThe return value is *not* inspected so the validator has to throw an\nexception itself.\n\nIf a `list` is passed, its items are treated as validators and must\nall pass.\n\nValidators can be globally disabled and re-enabled using\n`getrunvalidators`.\n\nThe validator can also be set using decorator notation as shown below.\n\n:type validator: `callable` or a `list` of `callable`\\ s.\n\n:param repr: Include this attribute in the generated ``repr``\nmethod. If ``True``, include the attribute; if ``False``, omit it. By\ndefault, the built-in ``repr()`` function is used. To override how the\nattribute value is formatted, pass a ``callable`` that takes a single\nvalue and returns a string. Note that the resulting string is used\nas-is, i.e. it will be used directly *instead* of calling ``repr()``\n(the default).\n:type repr: a `bool` or a `callable` to use a custom function.\n\n:param eq: If ``True`` (default), include this attribute in the\ngenerated ``eq`` and ``ne`` methods that check two instances\nfor equality. To override how the attribute value is compared,\npass a ``callable`` that takes a single value and returns the value\nto be compared.\n:type eq: a `bool` or a `callable`.\n\n:param order: If ``True`` (default), include this attributes in the\ngenerated ``lt``, ``le``, ``gt`` and ``ge`` methods.\nTo override how the attribute value is ordered,\npass a ``callable`` that takes a single value and returns the value\nto be ordered.\n:type order: a `bool` or a `callable`.\n\n:param cmp: Setting *cmp* is equivalent to setting *eq* and *order* to the\nsame value. Must not be mixed with *eq* or *order*.\n:type cmp: a `bool` or a `callable`.\n\n:param Optional[bool] hash: Include this attribute in the generated\n``hash`` method.  If ``None`` (default), mirror *eq*'s value.  This\nis the correct behavior according the Python spec.  Setting this value\nto anything else than ``None`` is *discouraged*.\n:param bool init: Include this attribute in the generated ``init``\nmethod.  It is possible to set this to ``False`` and set a default\nvalue.  In that case this attributed is unconditionally initialized\nwith the specified default value or factory.\n:param callable converter: `callable` that is called by\n``attrs``-generated ``init`` methods to convert attribute's value\nto the desired format.  It is given the passed-in value, and the\nreturned value will be used as the new value of the attribute.  The\nvalue is converted before being passed to the validator, if any.\n:param metadata: An arbitrary mapping, to be used by third-party\ncomponents.  See `extendingmetadata`.\n:param type: The type of the attribute.  In Python 3.6 or greater, the\npreferred method to specify the type is using a variable annotation\n(see `PEP 526 <https://www.python.org/dev/peps/pep-0526/>`).\nThis argument is provided for backward compatibility.\nRegardless of the approach used, the type will be stored on\n``Attribute.type``.\n\nPlease note that ``attrs`` doesn't do anything with this metadata by\nitself. You can use it as part of your own code or for\n`static type checking <types>`.\n:param kwonly: Make this attribute keyword-only (Python 3+)\nin the generated ``init`` (if ``init`` is ``False``, this\nparameter is ignored).\n:param onsetattr: Allows to overwrite the *onsetattr* setting from\n`attr.s`. If left `None`, the *onsetattr* value from `attr.s` is used.\nSet to `attr.setters.NOOP` to run no `setattr` hooks for this\nattribute -- regardless of the setting in `attr.s`.\n:type onsetattr: `callable`, or a list of callables, or `None`, or\n`attr.setters.NOOP`\n\n.. versionadded:: 15.2.0 *convert*\n.. versionadded:: 16.3.0 *metadata*\n.. versionchanged:: 17.1.0 *validator* can be a ``list`` now.\n.. versionchanged:: 17.1.0\n*hash* is ``None`` and therefore mirrors *eq* by default.\n.. versionadded:: 17.3.0 *type*\n.. deprecated:: 17.4.0 *convert*\n.. versionadded:: 17.4.0 *converter* as a replacement for the deprecated\n*convert* to achieve consistency with other noun-based arguments.\n.. versionadded:: 18.1.0\n``factory=f`` is syntactic sugar for ``default=attr.Factory(f)``.\n.. versionadded:: 18.2.0 *kwonly*\n.. versionchanged:: 19.2.0 *convert* keyword argument removed.\n.. versionchanged:: 19.2.0 *repr* also accepts a custom callable.\n.. deprecated:: 19.2.0 *cmp* Removal on or after 2021-06-01.\n.. versionadded:: 19.2.0 *eq* and *order*\n.. versionadded:: 20.1.0 *onsetattr*\n.. versionchanged:: 20.3.0 *kwonly* backported to Python 2\n.. versionchanged:: 21.1.0\n*eq*, *order*, and *cmp* also accept a custom callable\n.. versionchanged:: 21.1.0 *cmp* undeprecated\n\n#### make_class\n\nA quick way to create a new class called *name* with *attrs*.\n\n:param str name: The name for the new class.\n\n:param attrs: A list of names or a dictionary of mappings of names to\nattributes.\n\nIf *attrs* is a list or an ordered dict (`dict` on Python 3.6+,\n`collections.OrderedDict` otherwise), the order is deduced from\nthe order of the names or attributes inside *attrs*.  Otherwise the\norder of the definition of the attributes is used.\n:type attrs: `list` or `dict`\n\n:param tuple bases: Classes that the new class will subclass.\n\n:param attributesarguments: Passed unmodified to `attr.s`.\n\n:return: A new class with *attrs*.\n:rtype: type\n\n.. versionadded:: 17.1.0 *bases*\n.. versionchanged:: 18.1.0 If *attrs* is ordered, the order is retained.\n\n#### resolve_types\n\nResolve any strings and forward annotations in type annotations.\n\nThis is only required if you need concrete types in `Attribute`'s *type*\nfield. In other words, you don't need to resolve your types if you only\nuse them for static type checking.\n\nWith no arguments, names will be looked up in the module in which the class\nwas created. If this is not what you want, e.g. if the name only exists\ninside a method, you may pass *globalns* or *localns* to specify other\ndictionaries in which to look up these names. See the docs of\n`typing.gettypehints` for more details.\n\n:param type cls: Class to resolve.\n:param Optional[dict] globalns: Dictionary containing global variables.\n:param Optional[dict] localns: Dictionary containing local variables.\n:param Optional[list] attribs: List of attribs for the given class.\nThis is necessary when calling from inside a ``fieldtransformer``\nsince *cls* is not an ``attrs`` class yet.\n\n:raise TypeError: If *cls* is not a class.\n:raise attr.exceptions.NotAnAttrsClassError: If *cls* is not an ``attrs``\nclass and you didn't pass any attribs.\n:raise NameError: If types cannot be resolved because of missing variables.\n\n:returns: *cls* so you can use this function also as a class decorator.\nPlease note that you have to apply it after `attr.s`. That means\nthe decorator has to come in the line before `attr.s`.\n\n..  versionadded:: 20.1.0\n..  versionadded:: 21.1.0 *attribs*\n\ns = attrs(maybecls=None, these=None, reprns=None, repr=None, cmp=None, hash=None, init=None, slots=False, frozen=False, weakrefslot=True, str=False, autoattribs=False, kwonly=False, cachehash=False, autoexc=False, eq=None, order=None, autodetect=False, collectbymro=False, getstatesetstate=None, onsetattr=None, fieldtransformer=None)\nA class decorator that adds `dunder\n<https://wiki.python.org/moin/DunderAlias>`\\ -methods according to the\nspecified attributes using `attr.ib` or the *these* argument.\n\n:param these: A dictionary of name to `attr.ib` mappings.  This is\nuseful to avoid the definition of your attributes within the class body\nbecause you can't (e.g. if you want to add ``repr`` methods to\nDjango models) or don't want to.\n\nIf *these* is not ``None``, ``attrs`` will *not* search the class body\nfor attributes and will *not* remove any attributes from it.\n\nIf *these* is an ordered dict (`dict` on Python 3.6+,\n`collections.OrderedDict` otherwise), the order is deduced from\nthe order of the attributes inside *these*.  Otherwise the order\nof the definition of the attributes is used.\n\n:type these: `dict` of `str` to `attr.ib`\n\n:param str reprns: When using nested classes, there's no way in Python 2\nto automatically detect that.  Therefore it's possible to set the\nnamespace explicitly for a more meaningful ``repr`` output.\n:param bool autodetect: Instead of setting the *init*, *repr*, *eq*,\n*order*, and *hash* arguments explicitly, assume they are set to\n``True`` unless any of the involved methods for one of the\narguments is implemented in the *current* class (i.e. it is *not*\ninherited from some base class).\n\nSo for example by implementing ``eq`` on a class yourself,\n``attrs`` will deduce ``eq=False`` and will create *neither*\n``eq`` *nor* ``ne`` (but Python classes come with a sensible\n``ne`` by default, so it *should* be enough to only implement\n``eq`` in most cases).\n\n.. warning::\n\nIf you prevent ``attrs`` from creating the ordering methods for you\n(``order=False``, e.g. by implementing ``le``), it becomes\n*your* responsibility to make sure its ordering is sound. The best\nway is to use the `functools.totalordering` decorator.\n\n\nPassing ``True`` or ``False`` to *init*, *repr*, *eq*, *order*,\n*cmp*, or *hash* overrides whatever *autodetect* would determine.\n\n*autodetect* requires Python 3. Setting it ``True`` on Python 2 raises\na `PythonTooOldError`.\n\n:param bool repr: Create a ``repr`` method with a human readable\nrepresentation of ``attrs`` attributes..\n:param bool str: Create a ``str`` method that is identical to\n``repr``.  This is usually not necessary except for\n`Exception`\\ s.\n:param Optional[bool] eq: If ``True`` or ``None`` (default), add ``eq``\nand ``ne`` methods that check two instances for equality.\n\nThey compare the instances as if they were tuples of their ``attrs``\nattributes if and only if the types of both classes are *identical*!\n:param Optional[bool] order: If ``True``, add ``lt``, ``le``,\n``gt``, and ``ge`` methods that behave like *eq* above and\nallow instances to be ordered. If ``None`` (default) mirror value of\n*eq*.\n:param Optional[bool] cmp: Setting *cmp* is equivalent to setting *eq*\nand *order* to the same value. Must not be mixed with *eq* or *order*.\n:param Optional[bool] hash: If ``None`` (default), the ``hash`` method\nis generated according how *eq* and *frozen* are set.\n\n1. If *both* are True, ``attrs`` will generate a ``hash`` for you.\n2. If *eq* is True and *frozen* is False, ``hash`` will be set to\nNone, marking it unhashable (which it is).\n3. If *eq* is False, ``hash`` will be left untouched meaning the\n``hash`` method of the base class will be used (if base class is\n``object``, this means it will fall back to id-based hashing.).\n\nAlthough not recommended, you can decide for yourself and force\n``attrs`` to create one (e.g. if the class is immutable even though you\ndidn't freeze it programmatically) by passing ``True`` or not.  Both of\nthese cases are rather special and should be used carefully.\n\nSee our documentation on `hashing`, Python's documentation on\n`object.hash`, and the `GitHub issue that led to the default \\\nbehavior <https://github.com/python-attrs/attrs/issues/136>` for more\ndetails.\n:param bool init: Create a ``init`` method that initializes the\n``attrs`` attributes. Leading underscores are stripped for the argument\nname. If a ``attrspreinit`` method exists on the class, it will\nbe called before the class is initialized. If a ``attrspostinit``\nmethod exists on the class, it will be called after the class is fully\ninitialized.\n\nIf ``init`` is ``False``, an ``attrsinit`` method will be\ninjected instead. This allows you to define a custom ``init``\nmethod that can do pre-init work such as ``super().init()``,\nand then call ``attrsinit()`` and ``attrspostinit()``.\n:param bool slots: Create a `slotted class <slotted classes>` that's more\nmemory-efficient. Slotted classes are generally superior to the default\ndict classes, but have some gotchas you should know about, so we\nencourage you to read the `glossary entry <slotted classes>`.\n:param bool frozen: Make instances immutable after initialization.  If\nsomeone attempts to modify a frozen instance,\n`attr.exceptions.FrozenInstanceError` is raised.\n\n.. note::\n\n1. This is achieved by installing a custom ``setattr`` method\non your class, so you can't implement your own.\n\n2. True immutability is impossible in Python.\n\n3. This *does* have a minor a runtime performance `impact\n<how-frozen>` when initializing new instances.  In other words:\n``init`` is slightly slower with ``frozen=True``.\n\n4. If a class is frozen, you cannot modify ``self`` in\n``attrspostinit`` or a self-written ``init``. You can\ncircumvent that limitation by using\n``object.setattr(self, \"attributename\", value)``.\n\n5. Subclasses of a frozen class are frozen too.\n\n:param bool weakrefslot: Make instances weak-referenceable.  This has no\neffect unless ``slots`` is also enabled.\n:param bool autoattribs: If ``True``, collect `PEP 526`-annotated\nattributes (Python 3.6 and later only) from the class body.\n\nIn this case, you must annotate every field.  If ``attrs``\nencounters a field that is set to an `attr.ib` but lacks a type\nannotation, an `attr.exceptions.UnannotatedAttributeError` is\nraised.  Use ``fieldname: typing.Any = attr.ib(...)`` if you don't\nwant to set a type.\n\nIf you assign a value to those attributes (e.g. ``x: int = 42``), that\nvalue becomes the default value like if it were passed using\n``attr.ib(default=42)``.  Passing an instance of `Factory` also\nworks as expected in most cases (see warning below).\n\nAttributes annotated as `typing.ClassVar`, and attributes that are\nneither annotated nor set to an `attr.ib` are ignored.\n\n.. warning::\nFor features that use the attribute name to create decorators (e.g.\n`validators <validators>`), you still *must* assign `attr.ib` to\nthem. Otherwise Python will either not find the name or try to use\nthe default value to call e.g. ``validator`` on it.\n\nThese errors can be quite confusing and probably the most common bug\nreport on our bug tracker.\n\n.. `PEP 526`: https://www.python.org/dev/peps/pep-0526/\n:param bool kwonly: Make all attributes keyword-only (Python 3+)\nin the generated ``init`` (if ``init`` is ``False``, this\nparameter is ignored).\n:param bool cachehash: Ensure that the object's hash code is computed\nonly once and stored on the object.  If this is set to ``True``,\nhashing must be either explicitly or implicitly enabled for this\nclass.  If the hash code is cached, avoid any reassignments of\nfields involved in hash code computation or mutations of the objects\nthose fields point to after object creation.  If such changes occur,\nthe behavior of the object's hash code is undefined.\n:param bool autoexc: If the class subclasses `BaseException`\n(which implicitly includes any subclass of any exception), the\nfollowing happens to behave like a well-behaved Python exceptions\nclass:\n\n- the values for *eq*, *order*, and *hash* are ignored and the\ninstances compare and hash by the instance's ids (N.B. ``attrs`` will\n*not* remove existing implementations of ``hash`` or the equality\nmethods. It just won't add own ones.),\n- all attributes that are either passed into ``init`` or have a\ndefault value are additionally available as a tuple in the ``args``\nattribute,\n- the value of *str* is ignored leaving ``str`` to base classes.\n:param bool collectbymro: Setting this to `True` fixes the way ``attrs``\ncollects attributes from base classes.  The default behavior is\nincorrect in certain cases of multiple inheritance.  It should be on by\ndefault but is kept off for backward-compatability.\n\nSee issue `#428 <https://github.com/python-attrs/attrs/issues/428>` for\nmore details.\n\n:param Optional[bool] getstatesetstate:\n.. note::\nThis is usually only interesting for slotted classes and you should\nprobably just set *autodetect* to `True`.\n\nIf `True`, ``getstate`` and\n``setstate`` are generated and attached to the class. This is\nnecessary for slotted classes to be pickleable. If left `None`, it's\n`True` by default for slotted classes and ``False`` for dict classes.\n\nIf *autodetect* is `True`, and *getstatesetstate* is left `None`,\nand either ``getstate`` or ``setstate`` is detected directly\non the class (i.e. not inherited), it is set to `False` (this is usually\nwhat you want).\n\n:param onsetattr: A callable that is run whenever the user attempts to set\nan attribute (either by assignment like ``i.x = 42`` or by using\n`setattr` like ``setattr(i, \"x\", 42)``). It receives the same arguments\nas validators: the instance, the attribute that is being modified, and\nthe new value.\n\nIf no exception is raised, the attribute is set to the return value of\nthe callable.\n\nIf a list of callables is passed, they're automatically wrapped in an\n`attr.setters.pipe`.\n\n:param Optional[callable] fieldtransformer:\nA function that is called with the original class object and all\nfields right before ``attrs`` finalizes the class.  You can use\nthis, e.g., to automatically add converters or validators to\nfields based on their types.  See `transform-fields` for more details.\n\n.. versionadded:: 16.0.0 *slots*\n.. versionadded:: 16.1.0 *frozen*\n.. versionadded:: 16.3.0 *str*\n.. versionadded:: 16.3.0 Support for ``attrspostinit``.\n.. versionchanged:: 17.1.0\n*hash* supports ``None`` as value which is also the default now.\n.. versionadded:: 17.3.0 *autoattribs*\n.. versionchanged:: 18.1.0\nIf *these* is passed, no attributes are deleted from the class body.\n.. versionchanged:: 18.1.0 If *these* is ordered, the order is retained.\n.. versionadded:: 18.2.0 *weakrefslot*\n.. deprecated:: 18.2.0\n``lt``, ``le``, ``gt``, and ``ge`` now raise a\n`DeprecationWarning` if the classes compared are subclasses of\neach other. ``eq`` and ``ne`` never tried to compared subclasses\nto each other.\n.. versionchanged:: 19.2.0\n``lt``, ``le``, ``gt``, and ``ge`` now do not consider\nsubclasses comparable anymore.\n.. versionadded:: 18.2.0 *kwonly*\n.. versionadded:: 18.2.0 *cachehash*\n.. versionadded:: 19.1.0 *autoexc*\n.. deprecated:: 19.2.0 *cmp* Removal on or after 2021-06-01.\n.. versionadded:: 19.2.0 *eq* and *order*\n.. versionadded:: 20.1.0 *autodetect*\n.. versionadded:: 20.1.0 *collectbymro*\n.. versionadded:: 20.1.0 *getstatesetstate*\n.. versionadded:: 20.1.0 *onsetattr*\n.. versionadded:: 20.3.0 *fieldtransformer*\n.. versionchanged:: 21.1.0\n``init=False`` injects ``attrsinit``\n.. versionchanged:: 21.1.0 Support for ``attrspreinit``\n.. versionchanged:: 21.1.0 *cmp* undeprecated\n\n#### set_run_validators\n\nSet whether or not validators are run.  By default, they are run.\n\n#### validate\n\nValidate all attributes on *inst* that have a validator.\n\nLeaves all exceptions through.\n\n:param inst: Instance of a class with ``attrs`` attributes.\n\n### DATA\n\nNOTHING = NOTHING\nall = ['Attribute', 'Factory', 'NOTHING', 'asdict', 'assoc', 'astu...\ncopyright = 'Copyright (c) 2015 Hynek Schlawack'\ndescription = 'Classes Without Boilerplate'\nemail = 'hs@ox.cx'\nlicense = 'MIT'\ntitle = 'attrs'\nuri = 'https://www.attrs.org/'\nurl = 'https://www.attrs.org/'\nversioninfo = VersionInfo(year=21, minor=2, micro=0, releaselevel...\n\n### VERSION\n\n21.2.0\n\n### AUTHOR\n\nHynek Schlawack\n\n### FILE\n\n/usr/lib/python3/dist-packages/attr/init.py\n\n"
        }
    ],
    "structuredContent": {
        "command": "attr",
        "section": "",
        "mode": "pydoc",
        "summary": "attr - Classes Without Boilerplate <https://www.attrs.org/>",
        "synopsis": null,
        "tldr_summary": null,
        "tldr_examples": [],
        "tldr_source": null,
        "flags": [],
        "examples": [],
        "see_also": [],
        "section_outline": [
            {
                "name": "NAME",
                "lines": 2,
                "subsections": []
            },
            {
                "name": "PACKAGE CONTENTS",
                "lines": 13,
                "subsections": []
            },
            {
                "name": "CLASSES",
                "lines": 4,
                "subsections": [
                    {
                        "name": "class Attribute",
                        "lines": 107
                    },
                    {
                        "name": "class Factory",
                        "lines": 44
                    }
                ]
            },
            {
                "name": "FUNCTIONS",
                "lines": 1,
                "subsections": [
                    {
                        "name": "asdict",
                        "lines": 31
                    },
                    {
                        "name": "assoc",
                        "lines": 15
                    },
                    {
                        "name": "astuple",
                        "lines": 154
                    },
                    {
                        "name": "attrib",
                        "lines": 376
                    },
                    {
                        "name": "attrs",
                        "lines": 247
                    },
                    {
                        "name": "cmp_using",
                        "lines": 26
                    },
                    {
                        "name": "evolve",
                        "lines": 14
                    },
                    {
                        "name": "fields",
                        "lines": 16
                    },
                    {
                        "name": "fields_dict",
                        "lines": 16
                    },
                    {
                        "name": "get_run_validators",
                        "lines": 2
                    },
                    {
                        "name": "has",
                        "lines": 136
                    },
                    {
                        "name": "make_class",
                        "lines": 23
                    },
                    {
                        "name": "resolve_types",
                        "lines": 279
                    },
                    {
                        "name": "set_run_validators",
                        "lines": 2
                    },
                    {
                        "name": "validate",
                        "lines": 6
                    }
                ]
            },
            {
                "name": "DATA",
                "lines": 11,
                "subsections": []
            },
            {
                "name": "VERSION",
                "lines": 2,
                "subsections": []
            },
            {
                "name": "AUTHOR",
                "lines": 2,
                "subsections": []
            },
            {
                "name": "FILE",
                "lines": 3,
                "subsections": []
            }
        ]
    }
}