本文整理匯總了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