MCPcopy
hub / github.com/python-attrs/attrs / add_init

Method add_init

src/attr/_make.py:1081–1104  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

1079 return self
1080
1081 def add_init(self):
1082 script, globs, annotations = _make_init_script(
1083 self._cls,
1084 self._attrs,
1085 self._has_pre_init,
1086 self._pre_init_has_args,
1087 self._has_post_init,
1088 self._frozen,
1089 self._slots,
1090 self._cache_hash,
1091 self._base_attr_map,
1092 self._is_exc,
1093 self._on_setattr,
1094 attrs_init=False,
1095 )
1096
1097 def _attach_init(cls_dict, globs):
1098 init = globs["__init__"]
1099 init.__annotations__ = annotations
1100 cls_dict["__init__"] = self._add_method_dunders(init)
1101
1102 self._script_snippets.append((script, globs, _attach_init))
1103
1104 return self
1105
1106 def add_replace(self):
1107 self._cls_dict["__replace__"] = self._add_method_dunders(evolve)

Callers 2

wrapFunction · 0.80
test_returns_selfMethod · 0.80

Calls 1

_make_init_scriptFunction · 0.85

Tested by 1

test_returns_selfMethod · 0.64