summaryrefslogtreecommitdiff
path: root/pkg_resources
diff options
context:
space:
mode:
authorJason R. Coombs <jaraco@jaraco.com>2020-05-10 15:56:20 -0400
committerJason R. Coombs <jaraco@jaraco.com>2020-05-10 15:56:20 -0400
commitda3d39f88d3aad2281b78600e03cf05c1e983f71 (patch)
treef78cd8e106b627f5aa9c15a34262d0be951a6a75 /pkg_resources
parentfdee8026f5d58ee7cee0fad3c0b7e0ae7d5272ba (diff)
downloadpython-setuptools-git-da3d39f88d3aad2281b78600e03cf05c1e983f71.tar.gz
Restore single return
Diffstat (limited to 'pkg_resources')
-rw-r--r--pkg_resources/__init__.py22
1 files changed, 12 insertions, 10 deletions
diff --git a/pkg_resources/__init__.py b/pkg_resources/__init__.py
index a50ad1ab..6a6bda2c 100644
--- a/pkg_resources/__init__.py
+++ b/pkg_resources/__init__.py
@@ -2071,16 +2071,18 @@ def find_on_path(importer, path_item, only=False):
def dist_factory(path_item, entry, only):
"""Return a dist_factory for the given entry."""
lower = entry.lower()
- if lower.endswith('.egg-info'):
- return distributions_from_metadata
- elif lower.endswith('.dist-info') and os.path.isdir(entry):
- return distributions_from_metadata
- elif not only and _is_egg_path(entry):
- return find_distributions
- elif not only and lower.endswith('.egg-link'):
- return resolve_egg_link
- else:
- return NoDists()
+ is_egg_info = lower.endswith('.egg-info')
+ is_dist_info = lower.endswith('.dist-info') and os.path.isdir(entry)
+ is_meta = is_egg_info or is_dist_info
+ return (
+ distributions_from_metadata
+ if is_meta else
+ find_distributions
+ if not only and _is_egg_path(entry) else
+ resolve_egg_link
+ if not only and lower.endswith('.egg-link') else
+ NoDists()
+ )
class NoDists: