本文整理汇总了Python中pkg_resources.extern.six.moves.filter方法的典型用法代码示例。如果您正苦于以下问题:Python moves.filter方法的具体用法?Python moves.filter怎么用?Python moves.filter使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pkg_resources.extern.six.moves
的用法示例。
在下文中一共展示了moves.filter方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: _filter_extras
# 需要导入模块: from pkg_resources.extern.six import moves [as 别名]
# 或者: from pkg_resources.extern.six.moves import filter [as 别名]
def _filter_extras(dm):
"""
Given a mapping of extras to dependencies, strip off
environment markers and filter out any dependencies
not matching the markers.
"""
for extra in list(filter(None, dm)):
new_extra = extra
reqs = dm.pop(extra)
new_extra, _, marker = extra.partition(':')
fails_marker = marker and (
invalid_marker(marker)
or not evaluate_marker(marker)
)
if fails_marker:
reqs = []
new_extra = safe_extra(new_extra) or None
dm.setdefault(new_extra, []).extend(reqs)
return dm
示例2: _version_from_file
# 需要导入模块: from pkg_resources.extern.six import moves [as 别名]
# 或者: from pkg_resources.extern.six.moves import filter [as 别名]
def _version_from_file(lines):
"""
Given an iterable of lines from a Metadata file, return
the value of the Version field, if present, or None otherwise.
"""
is_version_line = lambda line: line.lower().startswith('version:')
version_lines = filter(is_version_line, lines)
line = next(iter(version_lines), '')
_, _, value = line.partition(':')
return safe_version(value.strip()) or None
示例3: _version_from_file
# 需要导入模块: from pkg_resources.extern.six import moves [as 别名]
# 或者: from pkg_resources.extern.six.moves import filter [as 别名]
def _version_from_file(lines):
"""
Given an iterable of lines from a Metadata file, return
the value of the Version field, if present, or None otherwise.
"""
def is_version_line(line):
return line.lower().startswith('version:')
version_lines = filter(is_version_line, lines)
line = next(iter(version_lines), '')
_, _, value = line.partition(':')
return safe_version(value.strip()) or None