From b8ccc612bfcc0edac750705a67314485e159672d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marek=20Kondzio=C5=82ka?= Date: Fri, 20 Sep 2024 08:45:56 +0200 Subject: [PATCH] Issue 551: Added support for `collections.abc.Callable` in function_wrapper.py (#552) --- fugue/dataframe/function_wrapper.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/fugue/dataframe/function_wrapper.py b/fugue/dataframe/function_wrapper.py index 8e15324b..4a377748 100644 --- a/fugue/dataframe/function_wrapper.py +++ b/fugue/dataframe/function_wrapper.py @@ -154,6 +154,7 @@ def _run_func( annotation == Callable or annotation == callable # pylint: disable=comparison-with-callable or str(annotation).startswith("typing.Callable") + or str(annotation).startswith("collections.abc.Callable") ), ) class _CallableParam(AnnotatedParam): @@ -168,6 +169,9 @@ class _CallableParam(AnnotatedParam): or annotation == Optional[callable] or str(annotation).startswith("typing.Union[typing.Callable") # 3.8- or str(annotation).startswith("typing.Optional[typing.Callable") # 3.9+ + or str(annotation).startswith( + "typing.Optional[collections.abc.Callable]" + ) # 3.9+ ), ) class _OptionalCallableParam(AnnotatedParam):