MCPcopy
hub / github.com/numpy/numpy / main

Function main

tools/refguide_check.py:546–652  ·  view source on GitHub ↗

Validates the docstrings of all the pre decided set of modules for errors and docstring standards.

(argv)

Source from the content-addressed store, hash-verified

544
545
546def main(argv):
547 """
548 Validates the docstrings of all the pre decided set of
549 modules for errors and docstring standards.
550 """
551 parser = ArgumentParser(usage=__doc__.lstrip())
552 parser.add_argument("module_names", metavar="SUBMODULES", default=[],
553 nargs='*', help="Submodules to check (default: all public)")
554 parser.add_argument("-v", "--verbose", action="count", default=0)
555 args = parser.parse_args(argv)
556
557 modules = []
558 names_dict = {}
559
560 if not args.module_names:
561 args.module_names = list(PUBLIC_SUBMODULES) + [BASE_MODULE]
562
563 module_names = args.module_names + [
564 OTHER_MODULE_DOCS[name]
565 for name in args.module_names
566 if name in OTHER_MODULE_DOCS
567 ]
568 # remove duplicates while maintaining order
569 module_names = list(dict.fromkeys(module_names))
570
571 dots = True
572 success = True
573 results = []
574 errormsgs = []
575
576 for submodule_name in module_names:
577 prefix = BASE_MODULE + '.'
578 if not (
579 submodule_name.startswith(prefix) or
580 submodule_name == BASE_MODULE
581 ):
582 module_name = prefix + submodule_name
583 else:
584 module_name = submodule_name
585
586 __import__(module_name)
587 module = sys.modules[module_name]
588
589 if submodule_name not in OTHER_MODULE_DOCS:
590 find_names(module, names_dict)
591
592 if submodule_name in args.module_names:
593 modules.append(module)
594
595 if modules:
596 print(f"Running checks for {len(modules)} modules:")
597 for module in modules:
598 if dots:
599 sys.stderr.write(module.__name__ + ' ')
600 sys.stderr.flush()
601
602 all_dict, deprecated, others = get_all_dict(module)
603 names = names_dict.get(module.__name__, set())

Callers 1

refguide_check.pyFile · 0.70

Calls 12

find_namesFunction · 0.85
get_all_dictFunction · 0.85
check_itemsFunction · 0.85
check_restFunction · 0.85
allFunction · 0.85
lstripMethod · 0.80
startswithMethod · 0.80
stripMethod · 0.80
joinMethod · 0.80
writeMethod · 0.45
flushMethod · 0.45
getMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…