MCPcopy Index your code
hub / github.com/python/mypy / _add_internal_replace_method

Method _add_internal_replace_method

mypy/plugins/dataclasses.py:416–428  ·  view source on GitHub ↗

Stashes the signature of 'dataclasses.replace(...)' for this specific dataclass to be used later whenever 'dataclasses.replace' is called for this dataclass.

(self, attributes: list[DataclassAttribute])

Source from the content-addressed store, hash-verified

414 )
415
416 def _add_internal_replace_method(self, attributes: list[DataclassAttribute]) -> None:
417 """
418 Stashes the signature of 'dataclasses.replace(...)' for this specific dataclass
419 to be used later whenever 'dataclasses.replace' is called for this dataclass.
420 """
421 add_method_to_class(
422 self._api,
423 self._cls,
424 _INTERNAL_REPLACE_SYM_NAME,
425 args=[attr.to_argument(self._cls.info, of="replace") for attr in attributes],
426 return_type=NoneType(),
427 is_staticmethod=True,
428 )
429
430 def _add_internal_post_init_method(self, attributes: list[DataclassAttribute]) -> None:
431 add_method_to_class(

Callers 1

transformMethod · 0.95

Calls 3

add_method_to_classFunction · 0.90
NoneTypeClass · 0.90
to_argumentMethod · 0.80

Tested by

no test coverage detected