| 1647 | return self |
| 1648 | |
| 1649 | def __imul__(self, n: SupportsIndex) -> Self: |
| 1650 | # unlike a regular list *=, proxied __imul__ will generate unique |
| 1651 | # backing objects for each copy. *= on proxied lists is a bit of |
| 1652 | # a stretch anyhow, and this interpretation of the __imul__ contract |
| 1653 | # is more plausibly useful than copying the backing objects. |
| 1654 | if not isinstance(n, int): |
| 1655 | raise NotImplementedError() |
| 1656 | if n == 0: |
| 1657 | self.clear() |
| 1658 | elif n > 1: |
| 1659 | self.extend(list(self) * (n - 1)) |
| 1660 | return self |
| 1661 | |
| 1662 | if typing.TYPE_CHECKING: |
| 1663 | # TODO: no idea how to do this without separate "stub" |