Skip to content

Commit

Permalink
"yield from", instead of "yield" in a loop
Browse files Browse the repository at this point in the history
This is a suggestion from pyupgrade:
https://github.com/asottile/pyupgrade#yield--yield-from
  • Loading branch information
DimitriPapadopoulos committed Sep 23, 2023
1 parent 8e86c38 commit 5a9a97e
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions pkg_resources/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2095,8 +2095,7 @@ def find_eggs_in_zip(importer, path_item, only=False):
if _is_egg_path(subitem):
subpath = os.path.join(path_item, subitem)
dists = find_eggs_in_zip(zipimport.zipimporter(subpath), subpath)
for dist in dists:
yield dist
yield from dists
elif subitem.lower().endswith(('.dist-info', '.egg-info')):
subpath = os.path.join(path_item, subitem)
submeta = EggMetadata(zipimport.zipimporter(subpath))
Expand Down Expand Up @@ -2131,8 +2130,7 @@ def find_on_path(importer, path_item, only=False):
for entry in sorted(entries):
fullpath = os.path.join(path_item, entry)
factory = dist_factory(path_item, entry, only)
for dist in factory(fullpath):
yield dist
yield from factory(fullpath)


def dist_factory(path_item, entry, only):
Expand Down Expand Up @@ -2850,8 +2848,7 @@ def _get_metadata_path_for_display(self, name):

def _get_metadata(self, name):
if self.has_metadata(name):
for line in self.get_metadata_lines(name):
yield line
yield from self.get_metadata_lines(name)

def _get_version(self):
lines = self._get_metadata(self.PKG_INFO)
Expand Down

0 comments on commit 5a9a97e

Please sign in to comment.