Skip to content

Commit ccb5e94

Browse files
author
hauntsaninja
committed
cosmetic changes to modulefinder
Just so that the logic mirrors closely
1 parent 40fd841 commit ccb5e94

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

mypy/modulefinder.py

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -361,15 +361,15 @@ def find_modules_recursive(self, module: str) -> List[BuildSource]:
361361
module_path = self.find_module(module)
362362
if isinstance(module_path, ModuleNotFoundReason):
363363
return []
364-
result = [BuildSource(module_path, module, None)]
364+
sources = [BuildSource(module_path, module, None)]
365365

366366
package_path = None
367367
if module_path.endswith(('__init__.py', '__init__.pyi')):
368368
package_path = os.path.dirname(module_path)
369369
elif self.fscache.isdir(module_path):
370370
package_path = module_path
371371
if package_path is None:
372-
return result
372+
return sources
373373

374374
# This logic closely mirrors that in find_sources. One small but important difference is
375375
# that we do not sort names with keyfunc. The recursive call to find_modules_recursive
@@ -382,16 +382,16 @@ def find_modules_recursive(self, module: str) -> List[BuildSource]:
382382
# Skip certain names altogether
383383
if name == '__pycache__' or name.startswith('.') or name.endswith('~'):
384384
continue
385-
path = os.path.join(package_path, name)
385+
subpath = os.path.join(package_path, name)
386386

387-
if self.fscache.isdir(path):
387+
if self.fscache.isdir(subpath):
388388
# Only recurse into packages
389389
if (self.options and self.options.namespace_packages) or (
390-
self.fscache.isfile(os.path.join(path, "__init__.py"))
391-
or self.fscache.isfile(os.path.join(path, "__init__.pyi"))
390+
self.fscache.isfile(os.path.join(subpath, "__init__.py"))
391+
or self.fscache.isfile(os.path.join(subpath, "__init__.pyi"))
392392
):
393393
seen.add(name)
394-
result.extend(self.find_modules_recursive(module + '.' + name))
394+
sources.extend(self.find_modules_recursive(module + '.' + name))
395395
else:
396396
stem, suffix = os.path.splitext(name)
397397
if stem == '__init__':
@@ -400,8 +400,8 @@ def find_modules_recursive(self, module: str) -> List[BuildSource]:
400400
# (If we sorted names) we could probably just make the BuildSource ourselves,
401401
# but this ensures compatibility with find_module / the cache
402402
seen.add(stem)
403-
result.extend(self.find_modules_recursive(module + '.' + stem))
404-
return result
403+
sources.extend(self.find_modules_recursive(module + '.' + stem))
404+
return sources
405405

406406

407407
def verify_module(fscache: FileSystemCache, id: str, path: str, prefix: str) -> bool:

0 commit comments

Comments
 (0)