Skip to content

Commit

Permalink
collapse an if statement
Browse files Browse the repository at this point in the history
  • Loading branch information
hauntsaninja committed Oct 24, 2020
1 parent ee42307 commit afc267d
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions mypy/find_sources.py
Original file line number Diff line number Diff line change
Expand Up @@ -148,14 +148,14 @@ def crawl_up(self, path: str) -> Tuple[str, str]:
def crawl_up_dir(self, dir: str) -> Tuple[str, str]:
"""Given a directory name, return the corresponding module name and base directory."""
parent_dir, base = os.path.split(dir)
if not dir or not base:
module = ''
base_dir = dir or '.'
return module, base_dir

if self.explicit_package_roots is None and not self.get_init_file(dir):
module = ''
base_dir = dir or '.'
if (
not dir or not base
# In the absence of explicit package roots, a lack of __init__.py means we've reached
# an (implicit) package root
or (self.explicit_package_roots is None and not self.get_init_file(dir))
):
module = ""
base_dir = dir or "."
return module, base_dir

# Ensure that base is a valid python module name
Expand Down

0 comments on commit afc267d

Please sign in to comment.