Add forgotten Attribute.evolve to stub

Fixes #752
This commit is contained in:
Hynek Schlawack 2021-01-29 11:09:02 +01:00
parent b717ad9de0
commit c2712fd102
3 changed files with 7 additions and 0 deletions

View File

@ -0,0 +1 @@
Added forgotten ``attr.Attribute.evolve()`` to type stubs.

View File

@ -83,6 +83,8 @@ class Attribute(Generic[_T]):
kw_only: bool
on_setattr: _OnSetAttrType
def evolve(self, **changes: Any) -> "Attribute": ...
# NOTE: We had several choices for the annotation to use for type arg:
# 1) Type[_T]
# - Pros: Handles simple cases correctly

View File

@ -242,6 +242,10 @@ class NGFrozen:
ngf = NGFrozen(1)
attr.fields(NGFrozen).x.evolve(eq=False)
a = attr.fields(NGFrozen).x
a.evolve(repr=False)
@attr.s(collect_by_mro=True)
class MRO: