Skip to content

Commit 88a66e7

Browse files
author
hauntsaninja
committed
collapse an if statement
1 parent e675a72 commit 88a66e7

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

mypy/find_sources.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -148,14 +148,14 @@ def crawl_up(self, path: str) -> Tuple[str, str]:
148148
def crawl_up_dir(self, dir: str) -> Tuple[str, str]:
149149
"""Given a directory name, return the corresponding module name and base directory."""
150150
parent_dir, base = os.path.split(dir)
151-
if not dir or not base:
152-
module = ''
153-
base_dir = dir or '.'
154-
return module, base_dir
155-
156-
if self.explicit_package_roots is None and not self.get_init_file(dir):
157-
module = ''
158-
base_dir = dir or '.'
151+
if (
152+
not dir or not base
153+
# In the absence of explicit package roots, a lack of __init__.py means we've reached
154+
# an (implicit) package root
155+
or (self.explicit_package_roots is None and not self.get_init_file(dir))
156+
):
157+
module = ""
158+
base_dir = dir or "."
159159
return module, base_dir
160160

161161
# Ensure that base is a valid python module name

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy