Skip to content

Commit

Permalink
undo mypy ignores
Browse files Browse the repository at this point in the history
  • Loading branch information
matthiasdiener committed Nov 14, 2023
1 parent 9244899 commit 3ebfcfd
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 8 deletions.
6 changes: 3 additions & 3 deletions pytato/array.py
Original file line number Diff line number Diff line change
Expand Up @@ -518,7 +518,7 @@ def T(self) -> Array:
@memoize_method
def __hash__(self) -> int:
attrs_filtered: List[Any] = []
for field in attrs.fields(type(self)): # type: ignore[misc]
for field in attrs.fields(type(self)):
attr = getattr(self, field)
if field == "tags":
attr = Taggable.__hash__(self)
Expand Down Expand Up @@ -1796,7 +1796,7 @@ def update_persistent_hash(self, key_hash: int, key_builder: Any) -> None:
#
# No need to dispatch to superclass: fields() automatically gives us
# fields from the entire class hierarchy.
for f in fields(self.__class__): # type: ignore[misc]
for f in fields(self.__class__):
key_builder.rec(key_hash, getattr(self, f.name))

def short_str(self, maxlen: int = 100) -> str:
Expand Down Expand Up @@ -1831,7 +1831,7 @@ def update_persistent_hash(self, key_hash: int, key_builder: Any) -> None:
#
# No need to dispatch to superclass: fields() automatically gives us
# fields from the entire class hierarchy.
for f in fields(self.__class__): # type: ignore[misc]
for f in fields(self.__class__):
key_builder.rec(key_hash, getattr(self, f.name))

def short_str(self, maxlen: int = 100) -> str:
Expand Down
7 changes: 2 additions & 5 deletions pytato/stringifier.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,9 +95,7 @@ def _map_generic_array(self, expr: Array, depth: int) -> str:
if depth > self.truncation_depth:
return self.truncation_string

# type-ignore-reason: https://github.com/python/mypy/issues/16254
fields = tuple(field.name
for field in attrs.fields(type(expr))) # type: ignore[misc]
fields = tuple(field.name for field in attrs.fields(type(expr)))

if expr.ndim <= 1:
# prettify: if ndim <=1 'expr.axes' would be trivial,
Expand Down Expand Up @@ -155,8 +153,7 @@ def _get_field_val(field: str) -> str:

return (f"{type(expr).__name__}("
+ ", ".join(f"{field.name}={_get_field_val(field.name)}"
# type-ignore-reason: https://github.com/python/mypy/issues/16254
for field in attrs.fields(type(expr))) # type: ignore[misc]
for field in attrs.fields(type(expr)))
+ ")")

def map_loopy_call(self, expr: LoopyCall, depth: int) -> str:
Expand Down

0 comments on commit 3ebfcfd

Please sign in to comment.