我们从Python开源项目中,提取了以下50个代码示例,用于说明如何使用pip._vendor.pkg_resources.parse_version()。
def should_warn(current_version, removal_version): # Our Significant digits on versions is 2, so remove everything but the # first two places. current_version = ".".join(current_version.split(".")[:2]) removal_version = ".".join(removal_version.split(".")[:2]) # Our warning threshold is one minor version before removal, so we # decrement the minor version by one major, minor = removal_version.split(".") minor = str(int(minor) - 1) warn_version = ".".join([major, minor]) # Test if our current_version should be a warn return (pkg_resources.parse_version(current_version) < pkg_resources.parse_version(warn_version))
def highest_version(versions): return next(iter( sorted(versions, key=pkg_resources.parse_version, reverse=True) ))