提交 14ebb039 编写于 作者: J Jon Dufresne

Use "yield from" syntax

Available since Python 3.3.

https://docs.python.org/3/whatsnew/3.3.html#pep-380
上级 c383ec3b
......@@ -340,8 +340,7 @@ class PipSession(requests.Session):
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)
......
......@@ -334,8 +334,7 @@ class RequirementsFileParser:
# 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]
......@@ -363,10 +362,7 @@ class RequirementsFileParser:
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
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册