MCPcopy Index your code
hub / github.com/python/mypy / build_signature

Function build_signature

mypy/stubdoc.py:481–493  ·  view source on GitHub ↗

Build function signature from lists of positional and optional argument names.

(positional: Sequence[str], optional: Sequence[str])

Source from the content-addressed store, hash-verified

479
480
481def build_signature(positional: Sequence[str], optional: Sequence[str]) -> str:
482 """Build function signature from lists of positional and optional argument names."""
483 args: MutableSequence[str] = []
484 args.extend(positional)
485 for arg in optional:
486 if arg.startswith("*"):
487 args.append(arg)
488 else:
489 args.append(f"{arg}=...")
490 sig = f"({', '.join(args)})"
491 # Ad-hoc fixes.
492 sig = sig.replace("(self)", "")
493 return sig
494
495
496def parse_all_signatures(lines: Sequence[str]) -> tuple[list[Sig], list[Sig]]:

Callers 2

test_build_signatureMethod · 0.90
parse_all_signaturesFunction · 0.85

Calls 5

extendMethod · 0.80
appendMethod · 0.80
replaceMethod · 0.80
startswithMethod · 0.45
joinMethod · 0.45

Tested by 1

test_build_signatureMethod · 0.72

Used in the wild real call sites across dependent graphs

searching dependent graphs…