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

Function parse_options

mypy/stubgen.py:1910–2046  ·  view source on GitHub ↗
(args: list[str])

Source from the content-addressed store, hash-verified

1908
1909
1910def parse_options(args: list[str]) -> Options:
1911 parser = argparse.ArgumentParser(
1912 prog="stubgen", usage=HEADER, description=DESCRIPTION, fromfile_prefix_chars="@"
1913 )
1914
1915 parser.add_argument(
1916 "--ignore-errors",
1917 action="store_true",
1918 help="ignore errors when trying to generate stubs for modules",
1919 )
1920 parser.add_argument(
1921 "--no-import",
1922 action="store_true",
1923 help="don't import the modules, just parse and analyze them "
1924 "(doesn't work with C extension modules and might not "
1925 "respect __all__)",
1926 )
1927 parser.add_argument(
1928 "--no-analysis",
1929 "--parse-only",
1930 dest="parse_only",
1931 action="store_true",
1932 help="don't perform semantic analysis of sources, just parse them "
1933 "(only applies to Python modules, might affect quality of stubs. "
1934 "Not compatible with --inspect-mode)",
1935 )
1936 parser.add_argument(
1937 "--inspect-mode",
1938 dest="inspect",
1939 action="store_true",
1940 help="import and inspect modules instead of parsing source code."
1941 "This is the default behavior for c modules and pyc-only packages, but "
1942 "it is also useful for pure python modules with dynamically generated members.",
1943 )
1944 parser.add_argument(
1945 "--include-private",
1946 action="store_true",
1947 help="generate stubs for objects and members considered private "
1948 "(single leading underscore and no trailing underscores)",
1949 )
1950 parser.add_argument(
1951 "--export-less",
1952 action="store_true",
1953 help="don't implicitly export all names imported from other modules in the same package",
1954 )
1955 parser.add_argument(
1956 "--include-docstrings",
1957 action="store_true",
1958 help="include existing docstrings with the stubs",
1959 )
1960 parser.add_argument("-v", "--verbose", action="store_true", help="show more verbose messages")
1961 parser.add_argument("-q", "--quiet", action="store_true", help="show fewer messages")
1962 parser.add_argument(
1963 "--doc-dir",
1964 metavar="PATH",
1965 default="",
1966 help="use .rst documentation in PATH (this may result in "
1967 "better stubs in some cases; consider setting this to "

Callers 5

test_files_foundMethod · 0.90
test_packages_foundMethod · 0.90
test_module_not_foundMethod · 0.90
parse_flagsMethod · 0.90
mainFunction · 0.70

Calls 4

add_argumentMethod · 0.80
splitMethod · 0.80
OptionsClass · 0.70
errorMethod · 0.45

Tested by 4

test_files_foundMethod · 0.72
test_packages_foundMethod · 0.72
test_module_not_foundMethod · 0.72
parse_flagsMethod · 0.72

Used in the wild real call sites across dependent graphs

searching dependent graphs…