本文整理汇总了Python中pkg_resources.invalid_marker方法的典型用法代码示例。如果您正苦于以下问题:Python pkg_resources.invalid_marker方法的具体用法?Python pkg_resources.invalid_marker怎么用?Python pkg_resources.invalid_marker使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pkg_resources
的用法示例。
在下文中一共展示了pkg_resources.invalid_marker方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: check_extras
# 需要导入模块: import pkg_resources [as 别名]
# 或者: from pkg_resources import invalid_marker [as 别名]
def check_extras(dist, attr, value):
"""Verify that extras_require mapping is valid"""
try:
for k,v in value.items():
if ':' in k:
k,m = k.split(':',1)
if pkg_resources.invalid_marker(m):
raise DistutilsSetupError("Invalid environment marker: "+m)
list(pkg_resources.parse_requirements(v))
except (TypeError,ValueError,AttributeError):
raise DistutilsSetupError(
"'extras_require' must be a dictionary whose values are "
"strings or lists of strings containing valid project/version "
"requirement specifiers."
)
示例2: check_extras
# 需要导入模块: import pkg_resources [as 别名]
# 或者: from pkg_resources import invalid_marker [as 别名]
def check_extras(dist, attr, value):
"""Verify that extras_require mapping is valid"""
try:
for k, v in value.items():
if ':' in k:
k, m = k.split(':', 1)
if pkg_resources.invalid_marker(m):
raise DistutilsSetupError("Invalid environment marker: " + m)
list(pkg_resources.parse_requirements(v))
except (TypeError, ValueError, AttributeError):
raise DistutilsSetupError(
"'extras_require' must be a dictionary whose values are "
"strings or lists of strings containing valid project/version "
"requirement specifiers."
)
示例3: _check_extra
# 需要导入模块: import pkg_resources [as 别名]
# 或者: from pkg_resources import invalid_marker [as 别名]
def _check_extra(extra, reqs):
name, sep, marker = extra.partition(':')
if marker and pkg_resources.invalid_marker(marker):
raise DistutilsSetupError("Invalid environment marker: " + marker)
list(pkg_resources.parse_requirements(reqs))
示例4: marker_passes
# 需要导入模块: import pkg_resources [as 别名]
# 或者: from pkg_resources import invalid_marker [as 别名]
def marker_passes(marker):
"""
Given an environment marker, return True if the marker is valid
and matches this environment.
"""
return (
not marker
or not pkg_resources.invalid_marker(marker)
and pkg_resources.evaluate_marker(marker)
)
示例5: marker_passes
# 需要导入模块: import pkg_resources [as 别名]
# 或者: from pkg_resources import invalid_marker [as 别名]
def marker_passes(marker):
"""
Given an environment marker, return True if the marker is valid
and matches this environment.
"""
return (
not marker
or not pkg_resources.invalid_marker(marker)
and pkg_resources.evaluate_marker(marker)
)