Correct __iter__ docstrings (s/items/keys).

This commit is contained in:
jab 2020-01-11 19:40:37 +00:00
parent 9bb1d88383
commit d96f3ac11e
4 changed files with 5 additions and 5 deletions

View File

@ -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)

View File

@ -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):

View File

@ -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

View File

@ -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