aboutsummaryrefslogtreecommitdiffstats
path: root/setuptools/package_index.py
diff options
context:
space:
mode:
authorJason R. Coombs <jaraco@jaraco.com>2015-12-11 10:34:36 -0500
committerJason R. Coombs <jaraco@jaraco.com>2015-12-11 10:34:36 -0500
commit6667ea387d5694cf936644898acd20000ca7b1ec (patch)
tree729a41e94fe61714ea3fbbc038a77975c90f7089 /setuptools/package_index.py
parent6b8c9181fbb0ef5b223ba45ed361991c601d1d13 (diff)
downloadexternal_python_setuptools-6667ea387d5694cf936644898acd20000ca7b1ec.tar.gz
external_python_setuptools-6667ea387d5694cf936644898acd20000ca7b1ec.tar.bz2
external_python_setuptools-6667ea387d5694cf936644898acd20000ca7b1ec.zip
Replace nested for loop with dual-for generator expression.
Diffstat (limited to 'setuptools/package_index.py')
-rwxr-xr-xsetuptools/package_index.py12
1 files changed, 8 insertions, 4 deletions
diff --git a/setuptools/package_index.py b/setuptools/package_index.py
index 095688f9..3456f715 100755
--- a/setuptools/package_index.py
+++ b/setuptools/package_index.py
@@ -6,6 +6,7 @@ import shutil
import socket
import base64
import hashlib
+import itertools
from functools import wraps
from pkg_resources import (
@@ -353,10 +354,13 @@ class PackageIndex(Environment):
def scan_egg_links(self, search_path):
dirs = filter(os.path.isdir, search_path)
- for item in dirs:
- for entry in os.listdir(item):
- if entry.endswith('.egg-link'):
- self.scan_egg_link(item, entry)
+ egg_links = (
+ (path, entry)
+ for path in dirs
+ for entry in os.listdir(path)
+ if entry.endswith('.egg-link')
+ )
+ list(itertools.starmap(self.scan_egg_link, egg_links))
def scan_egg_link(self, path, entry):
with open(os.path.join(path, entry)) as raw_lines: