Skip to content

Commit

Permalink
name fix
Browse files Browse the repository at this point in the history
  • Loading branch information
chadrik committed Aug 2, 2023
1 parent 592a3c0 commit 49ee495
Showing 1 changed file with 11 additions and 11 deletions.
22 changes: 11 additions & 11 deletions mypy/stubgen.py
Original file line number Diff line number Diff line change
Expand Up @@ -1246,15 +1246,15 @@ def remove_blacklisted_modules(modules: list[StubSource]) -> list[StubSource]:
]


def split_pyi_from_py(modules: list[StubSource]) -> tuple[list[StubSource], list[StubSource]]:
def split_pyc_from_py(modules: list[StubSource]) -> tuple[list[StubSource], list[StubSource]]:
py_modules = []
pyi_modules = []
pyc_modules = []
for mod in modules:
if is_pyc_only(mod.path):
pyi_modules.append(mod)
pyc_modules.append(mod)
else:
py_modules.append(mod)
return pyi_modules, py_modules
return pyc_modules, py_modules


def is_blacklisted_path(path: str) -> bool:
Expand All @@ -1272,7 +1272,7 @@ def collect_build_targets(
) -> tuple[list[StubSource], list[StubSource], list[StubSource]]:
"""Collect files for which we need to generate stubs.
Return list of Python modules and C modules.
Return list of py modules, pyc modules, and C modules.
"""
if options.packages or options.modules:
if options.no_import:
Expand All @@ -1295,8 +1295,8 @@ def collect_build_targets(
c_modules = []

py_modules = remove_blacklisted_modules(py_modules)
pyi_mod, py_mod = split_pyi_from_py(py_modules)
return py_mod, pyi_mod, c_modules
pyc_mod, py_mod = split_pyc_from_py(py_modules)
return py_mod, pyc_mod, c_modules


def find_module_paths_using_imports(
Expand Down Expand Up @@ -1524,13 +1524,13 @@ def generate_stub_for_py_module(
def generate_stubs(options: Options) -> None:
"""Main entry point for the program."""
mypy_opts = mypy_options(options)
py_modules, pyi_modules, c_modules = collect_build_targets(options, mypy_opts)
all_modules = py_modules + pyi_modules + c_modules
py_modules, pyc_modules, c_modules = collect_build_targets(options, mypy_opts)
all_modules = py_modules + pyc_modules + c_modules
all_module_names = sorted(m.module for m in all_modules)
# Use parsed sources to generate stubs for Python modules.
generate_asts_for_modules(py_modules, options.parse_only, mypy_opts, options.verbose)
files = []
for mod in py_modules + pyi_modules:
for mod in py_modules + pyc_modules:
assert mod.path is not None, "Not found module was not skipped"
target = mod.module.replace(".", "/")
if os.path.basename(mod.path) in ["__init__.py", "__init__.pyc"]:
Expand All @@ -1544,7 +1544,7 @@ def generate_stubs(options: Options) -> None:
mod,
target,
options.parse_only,
options.inspect or mod in pyi_modules,
options.inspect or mod in pyc_modules,
options.include_private,
options.export_less,
doc_dir=options.doc_dir,
Expand Down

0 comments on commit 49ee495

Please sign in to comment.