Skip to content

Commit

Permalink
Fix plum compatibility issue caused by 2.3.0 release (#324)
Browse files Browse the repository at this point in the history
  • Loading branch information
pabloferz authored Jul 24, 2024
2 parents beebd98 + 124d884 commit 15a1700
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion pysages/utils/compat.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,13 +103,23 @@ def has_method(fn, T, index):
_typing = import_module("plum" if _plum_version_tuple < (2, 2, 1) else "typing")
_util = _typing.type if _plum_version_tuple < (2, 2, 1) else _typing

if _plum_version_tuple < (2, 3, 0):

def _signature_types(sig):
return sig.types

else:

def _signature_types(sig):
return sig.signature.types

def dispatch_table(dispatch):
return dispatch.functions

def has_method(fn, T, index):
types_at_index = set()
for sig in fn.methods:
typ = sig.types[index]
typ = _signature_types(sig)[index]
if _util.get_origin(typ) is _typing.Union:
types_at_index.update(_util.get_args(typ))
else:
Expand Down

0 comments on commit 15a1700

Please sign in to comment.