MCPcopy
hub / github.com/sqlalchemy/sqlalchemy / __imul__

Method __imul__

lib/sqlalchemy/ext/associationproxy.py:1649–1660  ·  view source on GitHub ↗
(self, n: SupportsIndex)

Source from the content-addressed store, hash-verified

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"

Callers

nothing calls this directly

Calls 2

clearMethod · 0.95
extendMethod · 0.95

Tested by

no test coverage detected