mirror of https://github.com/jab/bidict.git
Correct __iter__ docstrings (s/items/keys).
This commit is contained in:
parent
9bb1d88383
commit
d96f3ac11e
|
@ -378,7 +378,7 @@ class BidictBase(BidirectionalMapping):
|
|||
return len(self._fwdm)
|
||||
|
||||
def __iter__(self): # lgtm [py/inheritance/incorrect-overridden-signature]
|
||||
"""Iterator over the contained items."""
|
||||
"""Iterator over the contained keys."""
|
||||
# No default implementation for __iter__ inherited from Mapping ->
|
||||
# always delegate to _fwdm.
|
||||
return iter(self._fwdm)
|
||||
|
|
|
@ -18,7 +18,7 @@ class _DelegatingMixin:
|
|||
__slots__ = ()
|
||||
|
||||
def __iter__(self):
|
||||
"""Iterator over the contained items."""
|
||||
"""Iterator over the contained keys."""
|
||||
return iter(self._fwdm) # pylint: disable=protected-access
|
||||
|
||||
def keys(self):
|
||||
|
|
|
@ -45,7 +45,7 @@ class FrozenOrderedBidict(OrderedBidictBase):
|
|||
# mutation.
|
||||
if DICTS_ORDERED:
|
||||
def __iter__(self, reverse=False): # noqa: N802
|
||||
"""Iterator over the contained items."""
|
||||
"""Iterator over the contained keys in insertion order."""
|
||||
if reverse:
|
||||
return super().__iter__(reverse=True)
|
||||
return iter(self._fwdm._fwdm) # pylint: disable=protected-access
|
||||
|
|
|
@ -271,13 +271,13 @@ class OrderedBidictBase(BidictBase):
|
|||
assert invm[val] is nodeinv
|
||||
|
||||
def __iter__(self, reverse=False):
|
||||
"""An iterator over this bidict's items in order."""
|
||||
"""Iterator over the contained keys in insertion order."""
|
||||
fwdm_inv = self._fwdm.inverse # pylint: disable=no-member
|
||||
for node in self._sntl.__iter__(reverse=reverse):
|
||||
yield fwdm_inv[node]
|
||||
|
||||
def __reversed__(self):
|
||||
"""An iterator over this bidict's items in reverse order."""
|
||||
"""Iterator over the contained keys in reverse insertion order."""
|
||||
for key in self.__iter__(reverse=True):
|
||||
yield key
|
||||
|
||||
|
|
Loading…
Reference in New Issue