guess_stats: test function name after signature
possibility that you've just passed it a string or something which has no __name__, wait till we know it has a signature
This commit is contained in:
parent
91f3e81573
commit
b95d4586e2
1 changed files with 4 additions and 3 deletions
|
@ -34,9 +34,6 @@ def is_data_provider(fun: Any) -> bool:
|
||||||
# one example which could benefit is my.pdfs
|
# one example which could benefit is my.pdfs
|
||||||
if fun is None:
|
if fun is None:
|
||||||
return False
|
return False
|
||||||
# probably a helper function?
|
|
||||||
if fun.__name__.startswith("_"):
|
|
||||||
return False
|
|
||||||
# todo. uh.. very similar to what cachew is trying to do?
|
# todo. uh.. very similar to what cachew is trying to do?
|
||||||
try:
|
try:
|
||||||
sig = inspect.signature(fun)
|
sig = inspect.signature(fun)
|
||||||
|
@ -47,6 +44,10 @@ def is_data_provider(fun: Any) -> bool:
|
||||||
if len(list(sig_required_params(sig))) > 0:
|
if len(list(sig_required_params(sig))) > 0:
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
# probably a helper function?
|
||||||
|
if fun.__name__.startswith("_"):
|
||||||
|
return False
|
||||||
|
|
||||||
return_type = sig.return_annotation
|
return_type = sig.return_annotation
|
||||||
return type_is_iterable(return_type)
|
return type_is_iterable(return_type)
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue