MCPcopy Create free account
hub / github.com/python/mypy / get_signatures

Method get_signatures

mypy/stubdoc.py:372–382  ·  view source on GitHub ↗

Return sorted copy of the list of signatures found so far.

(self)

Source from the content-addressed store, hash-verified

370 self.accumulator = ""
371
372 def get_signatures(self) -> list[FunctionSig]:
373 """Return sorted copy of the list of signatures found so far."""
374
375 def has_arg(name: str, signature: FunctionSig) -> bool:
376 return any(x.name == name for x in signature.args)
377
378 def args_kwargs(signature: FunctionSig) -> bool:
379 return has_arg("*args", signature) and has_arg("**kwargs", signature)
380
381 # Move functions with (*args, **kwargs) in their signature to last place.
382 return sorted(self.signatures, key=lambda x: 1 if args_kwargs(x) else 0)
383
384
385def infer_sig_from_docstring(docstr: str | None, name: str) -> list[FunctionSig] | None:

Callers 3

infer_sig_from_docstringFunction · 0.95
visit_func_defMethod · 0.45

Calls 1

sortedFunction · 0.85

Tested by

no test coverage detected