本文整理汇总了Python中pip.FrozenRequirement.from_dist方法的典型用法代码示例。如果您正苦于以下问题:Python FrozenRequirement.from_dist方法的具体用法?Python FrozenRequirement.from_dist怎么用?Python FrozenRequirement.from_dist使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pip.FrozenRequirement
的用法示例。
在下文中一共展示了FrozenRequirement.from_dist方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: dist_is_editable
# 需要导入模块: from pip import FrozenRequirement [as 别名]
# 或者: from pip.FrozenRequirement import from_dist [as 别名]
def dist_is_editable(dist):
"""Is distribution an editable install?"""
#TODO: factor out determining editableness out of FrozenRequirement
from pip import FrozenRequirement
req = FrozenRequirement.from_dist(dist, [])
return req.editable
示例2: frozen_req_from_dist
# 需要导入模块: from pip import FrozenRequirement [as 别名]
# 或者: from pip.FrozenRequirement import from_dist [as 别名]
def frozen_req_from_dist(dist):
try:
return FrozenRequirement.from_dist(dist)
except TypeError:
return FrozenRequirement.from_dist(dist, [])
示例3: dist_is_editable
# 需要导入模块: from pip import FrozenRequirement [as 别名]
# 或者: from pip.FrozenRequirement import from_dist [as 别名]
def dist_is_editable(dist):
"""Is distribution an editable install?"""
# TODO: factor out determining editableness out of FrozenRequirement
from pip import FrozenRequirement
req = FrozenRequirement.from_dist(dist, [])
return req.editable
示例4: dist_to_req
# 需要导入模块: from pip import FrozenRequirement [as 别名]
# 或者: from pip.FrozenRequirement import from_dist [as 别名]
def dist_to_req(dist):
"""Make a pip.FrozenRequirement from a pkg_resources distribution object"""
try: # :pragma:nocover: (pip>=10)
from pip._internal.operations.freeze import FrozenRequirement
except ImportError: # :pragma:nocover: (pip<10)
from pip import FrozenRequirement
# normalize the casing, dashes in the req name
orig_name, dist.project_name = dist.project_name, dist.key
result = FrozenRequirement.from_dist(dist, [])
# put things back the way we found it.
dist.project_name = orig_name
return result