MCPcopy Create free account
hub / github.com/Project-MONAI/MONAI / __init__

Method __init__

monai/transforms/adaptors.py:245–260  ·  view source on GitHub ↗
(self, function: Callable)

Source from the content-addressed store, hash-verified

243class FunctionSignature:
244
245 def __init__(self, function: Callable) -> None:
246 import inspect
247
248 sfn = inspect.signature(function)
249 self.found_args = False
250 self.found_kwargs = False
251 self.defaults = {}
252 self.non_var_parameters = set()
253 for p in sfn.parameters.values():
254 if p.kind is inspect.Parameter.VAR_POSITIONAL:
255 self.found_args = True
256 if p.kind is inspect.Parameter.VAR_KEYWORD:
257 self.found_kwargs = True
258 else:
259 self.non_var_parameters.add(p.name)
260 self.defaults[p.name] = p.default is not p.empty
261
262 def __repr__(self) -> str:
263 s = "<class 'FunctionSignature': found_args={}, found_kwargs={}, defaults={}"

Callers

nothing calls this directly

Calls 1

addMethod · 0.80

Tested by

no test coverage detected