MCPcopy
hub / github.com/CadQuery/cadquery / get_arity

Function get_arity

cadquery/utils.py:119–128  ·  view source on GitHub ↗
(f: TCallable)

Source from the content-addressed store, hash-verified

117
118
119def get_arity(f: TCallable) -> int:
120
121 if isbuiltin(f):
122 rv = 0 # assume 0 arity for builtins; they cannot be introspected
123 else:
124 # NB: this is not understood by mypy
125 n_defaults = len(f.__defaults__) if f.__defaults__ else 0
126 rv = f.__code__.co_argcount - n_defaults
127
128 return rv
129
130
131K = TypeVar("K")

Callers 2

invokeMethod · 0.85
invokeMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected