Skip to content

Commit

Permalink
remove function signature inspection
Browse files Browse the repository at this point in the history
  • Loading branch information
braingram committed Oct 20, 2023
1 parent 39a5dc1 commit 863d9c0
Showing 1 changed file with 0 additions and 15 deletions.
15 changes: 0 additions & 15 deletions src/stpipe/container.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import abc
import inspect


class AbstractModelContainer(abc.ABC):
Expand Down Expand Up @@ -31,20 +30,6 @@ def __subclasshook__(cls, C):
if function is None or not callable(function):
return False

# check that functionaccepts the required arguments/parameter
signature = inspect.signature(function)
target_signature = inspect.signature(getattr(cls, function_name))
for parameter_name in target_signature.parameters:
if parameter_name == "self":
pass
# check that this required parameter/argument exists in the function signature
if parameter_name not in signature.parameters:
return False
parameter = signature.parameters[parameter_name]
# make sure the required parameter is not positional only
if parameter.kind == inspect.Parameter.POSITIONAL_ONLY:
return False

return True

@property
Expand Down

0 comments on commit 863d9c0

Please sign in to comment.