Skip to content

Commit 0555261

Browse files
committed
Move extra conversion to function.
1 parent ec8bf2c commit 0555261

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

src/pip/_internal/req/constructors.py

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,14 @@ def _strip_extras(path):
7474
return path_no_extras, extras
7575

7676

77+
def convert_extras(extras):
78+
# type: (Optional[str]) -> Set[str]
79+
if extras:
80+
return Requirement("placeholder" + extras.lower()).extras
81+
else:
82+
return set()
83+
84+
7785
def parse_editable(editable_req):
7886
# type: (str) -> Tuple[Optional[str], str, Optional[Set[str]]]
7987
"""Parses an editable requirement into:
@@ -332,10 +340,7 @@ def install_req_from_line(
332340
else:
333341
req_as_string = name
334342

335-
if extras_as_string:
336-
extras = Requirement("placeholder" + extras_as_string.lower()).extras
337-
else:
338-
extras = ()
343+
extras = convert_extras(extras_as_string)
339344

340345
def with_source(text):
341346
if not line_source:

0 commit comments

Comments
 (0)