Skip to content

Commit

Permalink
fix: pyright error
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 96d4717 commit 7f672cf
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions expression/core/typing.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

from abc import abstractmethod
from collections.abc import Iterable
from typing import Any, Protocol, TypeVar, cast, get_origin
from typing import Any, Protocol, TypeVar, get_origin


_T = TypeVar("_T")
Expand Down Expand Up @@ -88,8 +88,7 @@ def try_downcast(type_: type[_Derived], expr: Any) -> _Derived | None:
"""
origin: type[_Derived] | None = get_origin(type_) or type_
if origin is not None and isinstance(expr, origin):
derived = cast(_Derived, expr)
return derived
return expr

return None

Expand Down

0 comments on commit 7f672cf

Please sign in to comment.