File tree 1 file changed +8
-6
lines changed
1 file changed +8
-6
lines changed Original file line number Diff line number Diff line change @@ -336,6 +336,12 @@ def install_req_from_line(
336
336
extras = Requirement ("placeholder" + extras_as_string .lower ()).extras
337
337
else :
338
338
extras = ()
339
+
340
+ def with_source (text ):
341
+ if not line_source :
342
+ return text
343
+ return '{} (from {})' .format (text , line_source )
344
+
339
345
if req_as_string is not None :
340
346
try :
341
347
req = Requirement (req_as_string )
@@ -348,12 +354,8 @@ def install_req_from_line(
348
354
add_msg = "= is not a valid operator. Did you mean == ?"
349
355
else :
350
356
add_msg = ''
351
- if line_source is None :
352
- source = ''
353
- else :
354
- source = ' (from {})' .format (line_source )
355
- msg = (
356
- 'Invalid requirement: {!r}{}' .format (req_as_string , source )
357
+ msg = with_source (
358
+ 'Invalid requirement: {!r}' .format (req_as_string )
357
359
)
358
360
if add_msg :
359
361
msg += '\n Hint: {}' .format (add_msg )
You can’t perform that action at this time.
0 commit comments