Skip to content

Commit

Permalink
Fix mypy issues
Browse files Browse the repository at this point in the history
  • Loading branch information
MatthewMckee4 committed Feb 8, 2025
1 parent 31df101 commit 059bc1f
Show file tree
Hide file tree
Showing 4 changed files with 179 additions and 182 deletions.
10 changes: 3 additions & 7 deletions src/kfactory/layout.py
Original file line number Diff line number Diff line change
Expand Up @@ -665,9 +665,7 @@ def wrapper_autocell(

@cachetools.cached(cache=_cache, lock=RLock())
@functools.wraps(f)
def wrapped_cell(
**params: KCellParams.args | KCellParams.kwargs,
) -> K:
def wrapped_cell(**params: Any) -> K:
for key, value in params.items():
if isinstance(value, DecoratorDict | DecoratorList):
params[key] = _hashable_to_original(value)
Expand Down Expand Up @@ -974,7 +972,7 @@ def decorator_autocell(
def wrapper_autocell(
*args: KCellParams.args, **kwargs: KCellParams.kwargs
) -> VKCell:
params: dict[str, KCellParams.args] = {
params: dict[str, Any] = {
p.name: p.default for p in sig.parameters.values()
}
param_units: dict[str, str] = {
Expand Down Expand Up @@ -1003,9 +1001,7 @@ def wrapper_autocell(

@cachetools.cached(cache=_cache)
@functools.wraps(f)
def wrapped_cell(
**params: KCellParams.args,
) -> VKCell:
def wrapped_cell(**params: Any) -> VKCell:
for key, value in params.items():
if isinstance(value, DecoratorDict | DecoratorList):
params[key] = _hashable_to_original(value)
Expand Down
4 changes: 4 additions & 0 deletions src/kfactory/ports.py
Original file line number Diff line number Diff line change
Expand Up @@ -238,6 +238,10 @@ def pformat(self, unit: Literal["dbu", "um", None] = None) -> str:
config.console.print(pprint_ports(self, unit=unit))
return capture.get()

def __hash__(self) -> int:
"""Hash the ports."""
return hash(self._bases)

Check warning on line 243 in src/kfactory/ports.py

View check run for this annotation

Codecov / codecov/patch

src/kfactory/ports.py#L243

Added line #L243 was not covered by tests


class Ports(ProtoPorts[int]):
"""A collection of dbu ports.
Expand Down
2 changes: 1 addition & 1 deletion src/kfactory/serialization.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
class DecoratorList(UserList[Any]):
"""Hashable decorator for a list."""

def __hash__(self) -> int:
def __hash__(self) -> int: # type: ignore[override]
"""Hash the list."""
return hash(tuple(self.data))

Expand Down
Loading

0 comments on commit 059bc1f

Please sign in to comment.