Skip to content
This repository has been archived by the owner on Dec 10, 2024. It is now read-only.

Commit

Permalink
Normalize FuncDict and FuncSet util collections key and value callabl…
Browse files Browse the repository at this point in the history
…es (#102)
  • Loading branch information
mawildoer authored Oct 24, 2024
1 parent bb04dc1 commit 5ce6764
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions src/faebryk/libs/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -1010,16 +1010,14 @@ def __init__(
def __contains__(self, item: T):
return item in self._keys[self._hasher(item)]

@property
def keys(self) -> Iterator[T]:
yield from chain.from_iterable(self._keys.values())

@property
def values(self) -> Iterator[U]:
yield from chain.from_iterable(self._values.values())

def __iter__(self) -> Iterator[T]:
yield from self.keys
yield from self.keys()

def __len__(self) -> int:
return sum(len(v) for v in self._values.values())
Expand Down Expand Up @@ -1054,7 +1052,7 @@ def __delitem__(self, key: T):

def items(self) -> Iterable[tuple[T, U]]:
"""Iter key-value pairs as items, just like a dict."""
yield from zip(self.keys, self.values)
yield from zip(self.keys(), self.values())

def __repr__(self) -> str:
return (
Expand Down

0 comments on commit 5ce6764

Please sign in to comment.