Skip to content

Commit

Permalink
Merge pull request #9365 from jdufresne/yield-from
Browse files Browse the repository at this point in the history
Use "yield from" syntax
  • Loading branch information
pradyunsg authored Dec 26, 2020
2 parents c383ec3 + 14ebb03 commit 2fb341a
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 8 deletions.
Empty file.
3 changes: 1 addition & 2 deletions src/pip/_internal/network/session.py
Original file line number Diff line number Diff line change
Expand Up @@ -340,8 +340,7 @@ def add_trusted_host(self, host, source=None, suppress_logging=False):

def iter_secure_origins(self):
# type: () -> Iterator[SecureOrigin]
for secure_origin in SECURE_ORIGINS:
yield secure_origin
yield from SECURE_ORIGINS
for host, port in self.pip_trusted_origins:
yield ('*', host, '*' if port is None else port)

Expand Down
8 changes: 2 additions & 6 deletions src/pip/_internal/req/req_file.py
Original file line number Diff line number Diff line change
Expand Up @@ -334,8 +334,7 @@ def parse(self, filename, constraint):
# type: (str, bool) -> Iterator[ParsedLine]
"""Parse a given file, yielding parsed lines.
"""
for line in self._parse_and_recurse(filename, constraint):
yield line
yield from self._parse_and_recurse(filename, constraint)

def _parse_and_recurse(self, filename, constraint):
# type: (str, bool) -> Iterator[ParsedLine]
Expand Down Expand Up @@ -363,10 +362,7 @@ def _parse_and_recurse(self, filename, constraint):
os.path.dirname(filename), req_path,
)

for inner_line in self._parse_and_recurse(
req_path, nested_constraint,
):
yield inner_line
yield from self._parse_and_recurse(req_path, nested_constraint)
else:
yield line

Expand Down

0 comments on commit 2fb341a

Please sign in to comment.