Improve readability in resolve_pkg_root_and_module_name a bit

This makes it more clear what is the purpose of the start variable.
This commit is contained in:
Bruno Oliveira 2024-04-06 12:13:46 -03:00
parent 24c7d2c2a0
commit 22afde54e7
1 changed files with 1 additions and 1 deletions

View File

@ -786,7 +786,7 @@ def resolve_pkg_root_and_module_name(
if pkg_path is not None: if pkg_path is not None:
pkg_root = pkg_path.parent pkg_root = pkg_path.parent
if consider_namespace_packages: if consider_namespace_packages:
start = path.parent if pkg_path is None else pkg_path.parent start = pkg_root if pkg_root is not None else path.parent
for candidate in (start, *start.parents): for candidate in (start, *start.parents):
if is_importable(candidate, path): if is_importable(candidate, path):
# Point the pkg_root to the root of the namespace package. # Point the pkg_root to the root of the namespace package.