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

Method from_doc_dir

mypy/stubgenc.py:56–67  ·  view source on GitHub ↗

Instantiate from a directory of .rst files.

(cls, doc_dir: str)

Source from the content-addressed store, hash-verified

54
55 @classmethod
56 def from_doc_dir(cls, doc_dir: str) -> ExternalSignatureGenerator:
57 """Instantiate from a directory of .rst files."""
58 all_sigs: list[Sig] = []
59 all_class_sigs: list[Sig] = []
60 for path in glob.glob(f"{doc_dir}/*.rst"):
61 with open(path) as f:
62 loc_sigs, loc_class_sigs = parse_all_signatures(f.readlines())
63 all_sigs += loc_sigs
64 all_class_sigs += loc_class_sigs
65 sigs = dict(find_unique_signatures(all_sigs))
66 class_sigs = dict(find_unique_signatures(all_class_sigs))
67 return ExternalSignatureGenerator(sigs, class_sigs)
68
69 def get_function_sig(
70 self, default_sig: FunctionSig, ctx: FunctionContext

Callers 1

get_sig_generatorsMethod · 0.80

Calls 5

parse_all_signaturesFunction · 0.90
find_unique_signaturesFunction · 0.90
dictClass · 0.85
readlinesMethod · 0.80

Tested by

no test coverage detected