Skip to content

Commit

Permalink
Fix compatibility issue with plum >= 2.2.1 (#280)
Browse files Browse the repository at this point in the history
Co-authored-by: Pablo Zubieta <[email protected]>
  • Loading branch information
yzjin and pabloferz authored Sep 8, 2023
1 parent c78e21f commit c972ad6
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions pysages/utils/compat.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ def has_method(fn, T, index):

else:
_bt = import_module("beartype.door")
_pm = import_module("plum")
_typing = import_module("plum" if _plum_version_tuple < (2, 2, 1) else "typing")

def dispatch_table(dispatch):
return dispatch.functions
Expand All @@ -75,8 +75,8 @@ def has_method(fn, T, index):
types_at_index = set()
for sig in fn.methods:
typ = sig.types[index]
if _pm.get_origin(typ) is _pm.Union:
types_at_index.update(_pm.get_args(typ))
if _typing.get_origin(typ) is _typing.Union:
types_at_index.update(_typing.get_args(typ))
else:
types_at_index.add(typ)
return T in types_at_index
Expand Down

0 comments on commit c972ad6

Please sign in to comment.