MCPcopy Create free account
hub / github.com/aboutcode-org/scancode-toolkit / evolve

Method evolve

src/licensedcode/_vendor/attr/_make.py:2737–2752  ·  view source on GitHub ↗

Copy *self* and apply *changes*. This works similarly to `attr.evolve` but that function does not work with ``Attribute``. It is mainly meant to be used for `transform-fields`. .. versionadded:: 20.3.0

(self, **changes)

Source from the content-addressed store, hash-verified

2735
2736 # Don't use attr.evolve since fields(Attribute) doesn't work
2737 def evolve(self, **changes):
2738 """
2739 Copy *self* and apply *changes*.
2740
2741 This works similarly to `attr.evolve` but that function does not work
2742 with ``Attribute``.
2743
2744 It is mainly meant to be used for `transform-fields`.
2745
2746 .. versionadded:: 20.3.0
2747 """
2748 new = copy.copy(self)
2749
2750 new._setattrs(changes.items())
2751
2752 return new
2753
2754 # Don't use _add_pickle since fields(Attribute) doesn't work
2755 def __getstate__(self):

Callers 8

reportable_tokensFunction · 0.80
tag_matched_tokensFunction · 0.80
_collect_base_attrsFunction · 0.80
_transform_attrsFunction · 0.80
get_resourceMethod · 0.80
walkMethod · 0.80
walkMethod · 0.80

Calls 2

_setattrsMethod · 0.80
copyMethod · 0.45

Tested by

no test coverage detected