Skip to content

Commit

Permalink
fix signature
Browse files Browse the repository at this point in the history
  • Loading branch information
oeway committed Mar 4, 2024
1 parent 901a1ff commit 08a395a
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
2 changes: 1 addition & 1 deletion python/imjoy_rpc/VERSION
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
"version": "0.5.48post1"
"version": "0.5.48.post2"
}
14 changes: 13 additions & 1 deletion python/imjoy_rpc/hypha/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -479,7 +479,19 @@ def callable_sig(any_callable, skip_context=False):
# e.g. <lambda> -> lambda
name = re.sub(r"\W", "", name)

return f"{name}{signature}"
primitive = True
for p in signature.parameters.values():
if (
p.default is not None
and p.default != inspect._empty
and not isinstance(p.default, (str, int, float, bool, list, dict, tuple))
):
primitive = False
if primitive:
sig_str = str(signature)
else:
sig_str = f"({', '.join([p.name for p in signature.parameters.values()])})"
return f"{name}{sig_str}"


def callable_doc(any_callable):
Expand Down

0 comments on commit 08a395a

Please sign in to comment.