Add a `__replace__` method to the class, which is used to replace attributes in the `copy` module.
(self, attributes: list[DataclassAttribute])
| 399 | return True |
| 400 | |
| 401 | def _add_dunder_replace(self, attributes: list[DataclassAttribute]) -> None: |
| 402 | """Add a `__replace__` method to the class, which is used to replace attributes in the `copy` module.""" |
| 403 | args = [ |
| 404 | attr.to_argument(self._cls.info, of="replace") |
| 405 | for attr in attributes |
| 406 | if attr.is_in_init |
| 407 | ] |
| 408 | add_method_to_class( |
| 409 | self._api, |
| 410 | self._cls, |
| 411 | "__replace__", |
| 412 | args=args, |
| 413 | return_type=fill_typevars(self._cls.info), |
| 414 | ) |
| 415 | |
| 416 | def _add_internal_replace_method(self, attributes: list[DataclassAttribute]) -> None: |
| 417 | """ |
no test coverage detected