Skip to content

Commit

Permalink
fix: rm type ignore
Browse files Browse the repository at this point in the history
  • Loading branch information
phi-friday authored and dbrattli committed Aug 4, 2024
1 parent 7f672cf commit 47338fd
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion expression/collections/array.py
Original file line number Diff line number Diff line change
Expand Up @@ -385,7 +385,7 @@ def sum(self: TypedArray[_TSourceSum]) -> int:
def sum_by(self, projection: Callable[[_TSource], _TSourceSum]) -> int:
return pipe(
self,
sum_by(projection), # type: ignore
sum_by(projection),
)

def tail(self) -> TypedArray[_TSource]:
Expand Down
2 changes: 1 addition & 1 deletion expression/collections/map.py
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@ def of_seq(sequence: Iterable[tuple[_Key_, _Result]]) -> Map[_Key_, _Result]:
"""
return of_seq(sequence)

def __hash__(self) -> int: # type: ignore
def __hash__(self) -> int:
def combine_hash(x: int, y: int) -> int:
return (x << 1) + y + 631

Expand Down
8 changes: 4 additions & 4 deletions expression/core/tagged_union.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ def tagged_union(

def transform(cls: Any) -> Any:
cls = dataclass(init=False, repr=False, order=False, eq=False, kw_only=True)(cls)
fields_ = fields(cls) # type: ignore
fields_ = fields(cls)
field_names = tuple(f.name for f in fields_)
original_init = cls.__init__

Expand All @@ -65,7 +65,7 @@ def __init__(self: Any, **kwargs: Any) -> None:

# Enables the use of dataclasses.asdict
union_fields = dict((f.name, f) for f in fields_ if f.name in [name, "tag"])
object.__setattr__(self, "__dataclass_fields__", union_fields) # type: ignore
object.__setattr__(self, "__dataclass_fields__", union_fields)
original_init(self)

def __repr__(self: Any) -> str:
Expand All @@ -77,9 +77,9 @@ def __lt__(self: Any, other: Any) -> bool:
if not isinstance(other, cls):
return False

return (self._index, getattr(self, self.tag)) < (other._index, getattr(other, other.tag)) # type: ignore
return (self._index, getattr(self, self.tag)) < (other._index, getattr(other, other.tag))

cls.__lt__ = __lt__ # type: ignore
cls.__lt__ = __lt__

if frozen:

Expand Down
2 changes: 1 addition & 1 deletion expression/extra/parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -264,7 +264,7 @@ def cons(head: _A, tail: Block[_A]) -> Block[_A]:
match parser_list:
case block.empty:
return preturn(block.empty)
case Block([head, *tail]): # type: ignore
case Block([head, *tail]):
tail_ = sequence(Block(tail))
return cons_p(head)(tail_)
case _:
Expand Down

0 comments on commit 47338fd

Please sign in to comment.