Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
镜像
Python_Packaging_Authority
pip
提交
3defc24e
P
pip
项目概览
镜像
/
Python_Packaging_Authority
/
pip
12 个月 前同步成功
通知
0
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
P
pip
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
未验证
提交
3defc24e
编写于
7月 07, 2020
作者:
S
Stéphane Bidoul
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Removed unused comes_from argument of parse_requirements
上级
0512785f
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
4 addition
and
20 deletion
+4
-20
src/pip/_internal/req/req_file.py
src/pip/_internal/req/req_file.py
+4
-19
tests/unit/test_req.py
tests/unit/test_req.py
+0
-1
未找到文件。
src/pip/_internal/req/req_file.py
浏览文件 @
3defc24e
...
...
@@ -105,7 +105,6 @@ class ParsedLine(object):
self
,
filename
,
# type: str
lineno
,
# type: int
comes_from
,
# type: Optional[str]
args
,
# type: str
opts
,
# type: Values
constraint
,
# type: bool
...
...
@@ -113,7 +112,6 @@ class ParsedLine(object):
# type: (...) -> None
self
.
filename
=
filename
self
.
lineno
=
lineno
self
.
comes_from
=
comes_from
self
.
opts
=
opts
self
.
constraint
=
constraint
...
...
@@ -134,7 +132,6 @@ def parse_requirements(
filename
,
# type: str
session
,
# type: PipSession
finder
=
None
,
# type: Optional[PackageFinder]
comes_from
=
None
,
# type: Optional[str]
options
=
None
,
# type: Optional[optparse.Values]
constraint
=
False
,
# type: bool
):
...
...
@@ -144,13 +141,12 @@ def parse_requirements(
:param filename: Path or url of requirements file.
:param session: PipSession instance.
:param finder: Instance of pip.index.PackageFinder.
:param comes_from: Origin description of requirements.
:param options: cli options.
:param constraint: If true, parsing a constraint file rather than
requirements file.
"""
line_parser
=
get_line_parser
(
finder
)
parser
=
RequirementsFileParser
(
session
,
line_parser
,
comes_from
)
parser
=
RequirementsFileParser
(
session
,
line_parser
)
for
parsed_line
in
parser
.
parse
(
filename
,
constraint
):
parsed_req
=
handle_line
(
...
...
@@ -333,12 +329,10 @@ class RequirementsFileParser(object):
self
,
session
,
# type: PipSession
line_parser
,
# type: LineParser
comes_from
,
# type: Optional[str]
):
# type: (...) -> None
self
.
_session
=
session
self
.
_line_parser
=
line_parser
self
.
_comes_from
=
comes_from
def
parse
(
self
,
filename
,
constraint
):
# type: (str, bool) -> Iterator[ParsedLine]
...
...
@@ -382,9 +376,7 @@ class RequirementsFileParser(object):
def
_parse_file
(
self
,
filename
,
constraint
):
# type: (str, bool) -> Iterator[ParsedLine]
_
,
content
=
get_file_content
(
filename
,
self
.
_session
,
comes_from
=
self
.
_comes_from
)
_
,
content
=
get_file_content
(
filename
,
self
.
_session
)
lines_enum
=
preprocess
(
content
)
...
...
@@ -399,7 +391,6 @@ class RequirementsFileParser(object):
yield
ParsedLine
(
filename
,
line_number
,
self
.
_comes_from
,
args_str
,
opts
,
constraint
,
...
...
@@ -553,15 +544,14 @@ def expand_env_variables(lines_enum):
yield
line_number
,
line
def
get_file_content
(
url
,
session
,
comes_from
=
None
):
# type: (str, PipSession
, Optional[str]
) -> Tuple[str, Text]
def
get_file_content
(
url
,
session
):
# type: (str, PipSession) -> Tuple[str, Text]
"""Gets the content of a file; it may be a filename, file: URL, or
http: URL. Returns (location, content). Content is unicode.
Respects # -*- coding: declarations on the retrieved files.
:param url: File path or url.
:param session: PipSession instance.
:param comes_from: Origin description of requirements.
"""
scheme
=
get_url_scheme
(
url
)
...
...
@@ -572,11 +562,6 @@ def get_file_content(url, session, comes_from=None):
return
resp
.
url
,
resp
.
text
elif
scheme
==
'file'
:
if
comes_from
and
comes_from
.
startswith
(
'http'
):
raise
InstallationError
(
'Requirements file {} references URL {}, '
'which is local'
.
format
(
comes_from
,
url
)
)
url
=
url_to_path
(
url
)
try
:
...
...
tests/unit/test_req.py
浏览文件 @
3defc24e
...
...
@@ -47,7 +47,6 @@ def get_processed_req_from_line(line, fname='file', lineno=1):
parsed_line
=
ParsedLine
(
fname
,
lineno
,
fname
,
args_str
,
opts
,
False
,
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录