Skip to content

Commit fcc415f

Browse files
committed
Fix pep8 compatibility
1 parent 711892a commit fcc415f

File tree

2 files changed

+25
-8
lines changed

2 files changed

+25
-8
lines changed

Diff for: pip/req/req_file.py

+18-6
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,8 @@ def parser_exit(self, msg):
7676
IGNORE = 5
7777

7878

79-
def parse_requirements(filename, finder=None, comes_from=None, options=None, session=None):
79+
def parse_requirements(filename, finder=None, comes_from=None, options=None,
80+
session=None):
8081
"""
8182
Parse a requirements file and yield InstallRequirement instances.
8283
@@ -93,13 +94,21 @@ def parse_requirements(filename, finder=None, comes_from=None, options=None, ses
9394
"'session'"
9495
)
9596

96-
_, content = get_file_content(filename, comes_from=comes_from, session=session)
97-
parser = parse_content(filename, content, finder, comes_from, options, session)
97+
_, content = get_file_content(
98+
filename, comes_from=comes_from, session=session
99+
)
100+
101+
parser = parse_content(
102+
filename, content, finder, comes_from, options, session
103+
)
104+
98105
for item in parser:
99106
yield item
100107

101108

102-
def parse_content(filename, content, finder=None, comes_from=None, options=None, session=None):
109+
def parse_content(filename, content, finder=None, comes_from=None,
110+
options=None, session=None):
111+
103112
# Split, sanitize and join lines with continuations.
104113
content = content.splitlines()
105114
content = ignore_comments(content)
@@ -129,7 +138,8 @@ def parse_content(filename, content, finder=None, comes_from=None, options=None,
129138
isolated = options.isolated_mode if options else False
130139
default_vcs = options.default_vcs if options else None
131140
yield InstallRequirement.from_editable(
132-
value, comes_from=comes_from, default_vcs=default_vcs, isolated=isolated
141+
value, comes_from=comes_from,
142+
default_vcs=default_vcs, isolated=isolated
133143
)
134144

135145
# ---------------------------------------------------------------------
@@ -141,7 +151,9 @@ def parse_content(filename, content, finder=None, comes_from=None, options=None,
141151
req_dir = os.path.dirname(filename)
142152
req_url = os.path.join(os.path.dirname(filename), value)
143153
# TODO: Why not use `comes_from='-r {} (line {})'` here as well?
144-
parser = parse_requirements(req_url, finder, comes_from, options, session)
154+
parser = parse_requirements(
155+
req_url, finder, comes_from, options, session
156+
)
145157
for req in parser:
146158
yield req
147159

Diff for: tests/unit/test_req.py

+7-2
Original file line numberDiff line numberDiff line change
@@ -528,7 +528,9 @@ def test_parse_options_from_requirements(finder):
528528

529529
assert parse_line('--index-url abc') == (OPTION, ('--index-url', 'abc'))
530530
assert parse_line('--index-url=abc') == (OPTION, ('--index-url', 'abc'))
531-
assert parse_line('--index-url = abc') == (OPTION, ('--index-url', 'abc'))
531+
assert parse_line('--index-url = abc') == (
532+
OPTION, ('--index-url', 'abc')
533+
)
532534

533535
with pytest.raises(RequirementsFileParseError):
534536
parse_line('--allow-external')
@@ -555,7 +557,10 @@ def test_get_requirement_options():
555557
res = parse_requirement_options('--install-option="--abc --zxc"')
556558
assert res == {'install_options': ['--abc', '--zxc']}
557559

558-
line = 'INITools==2.0 --global-option="--one --two -3" --install-option="--prefix=/opt"'
560+
line = (
561+
'INITools==2.0 --global-option="--one --two -3" '
562+
'--install-option="--prefix=/opt"'
563+
)
559564
assert parse_line(line) == (REQUIREMENT, (
560565
'INITools==2.0', {
561566
'global_options': ['--one', '--two', '-3'],

0 commit comments

Comments
 (0)