Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix plum compatibility issue caused by 2.3.0 release #324

Merged
merged 3 commits into from
Jul 24, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading