a Pͣ_*@sdZddlmZddlmZddlmZddlmZm Z m Z m Z ddddddd dd dd d ddd ddddd d d Z e Z ee ddd Zedddddddd dddd ddZdS)z This is a Python 3.6 and later-only, keyword-only, and **provisional** API that calls `attr.s` with different default values. Provisional APIs that shall become "import attrs" one glorious day. )partial)UnannotatedAttributeError)setters)NOTHING_frozen_setattrsattribattrsNTF)thesereprhashinitslotsfrozen weakref_slotstr auto_attribskw_only cache_hashauto_exceqorder auto_detectgetstate_setstate on_setattrfield_transformercsV fdd fdd}|durJ|S||SdS)a4 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: 1. If all attributes are annotated and no `attr.ib` is found, it assumes *auto_attribs=True*. 2. 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 cs0t|  |  d dS)NT) maybe_clsr r r r rrrrrrrrrrrZcollect_by_mrorrr)r )clsr)rrrrrrrr r rrrr rrr r2/usr/lib/python3.9/site-packages/attr/_next_gen.pydo_it7s,zdefine..do_itcsdtjfv}dur$dur$tj|jD]$}|jtur*|rDtdtjqPq*durb|Sz |dWSty|dYS0dS)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_OPZvalidate __bases__ __setattr__r ValueErrorr)rZhad_on_setattrZbase_cls)rr rrrrwrapOs"     zdefine..wrapNr)rr r r r rrrrrrrrrrrrrrr$r)rrrrr rrrrr r rrrr rrr rrdefines ',%r%)rr defaultZ validatorr r r metadataZ converterfactoryrrrrc Cs t|||||||||| | | d S)zx Identical to `attr.ib`, except keyword-only and with some arguments removed. .. versionadded:: 20.1.0 r&)rr&rrrfield~sr*)N)__doc__ functoolsrZattr.exceptionsrr_makerrrr r%Zmutablerr*rrrrsP    j