Skip to content

Commit 3b8aadb

Browse files
"yield from", instead of "yield" in a loop
This is a suggestion from pyupgrade: https://github.com/asottile/pyupgrade#yield--yield-from
1 parent 930728f commit 3b8aadb

File tree

1 file changed

+3
-6
lines changed

1 file changed

+3
-6
lines changed

pkg_resources/__init__.py

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2095,8 +2095,7 @@ def find_eggs_in_zip(importer, path_item, only=False):
20952095
if _is_egg_path(subitem):
20962096
subpath = os.path.join(path_item, subitem)
20972097
dists = find_eggs_in_zip(zipimport.zipimporter(subpath), subpath)
2098-
for dist in dists:
2099-
yield dist
2098+
yield from dists
21002099
elif subitem.lower().endswith(('.dist-info', '.egg-info')):
21012100
subpath = os.path.join(path_item, subitem)
21022101
submeta = EggMetadata(zipimport.zipimporter(subpath))
@@ -2131,8 +2130,7 @@ def find_on_path(importer, path_item, only=False):
21312130
for entry in sorted(entries):
21322131
fullpath = os.path.join(path_item, entry)
21332132
factory = dist_factory(path_item, entry, only)
2134-
for dist in factory(fullpath):
2135-
yield dist
2133+
yield from factory(fullpath)
21362134

21372135

21382136
def dist_factory(path_item, entry, only):
@@ -2850,8 +2848,7 @@ def _get_metadata_path_for_display(self, name):
28502848

28512849
def _get_metadata(self, name):
28522850
if self.has_metadata(name):
2853-
for line in self.get_metadata_lines(name):
2854-
yield line
2851+
yield from self.get_metadata_lines(name)
28552852

28562853
def _get_version(self):
28572854
lines = self._get_metadata(self.PKG_INFO)

0 commit comments

Comments
 (0)