version.py 文件源码

python
阅读 31 收藏 0 点赞 0 评论 0

项目:two1-python 作者: 21dotco 项目源码 文件源码
def is_version_gte(actual, expected):
    """ Checks two versions for actual >= epected condition

        Versions need to be in Major.Minor.Patch format.

    Args:
        actual (str): the actual version being checked
        expected (str): the expected version being checked

    Returns:
        bool: True if the actual version is greater than or equal to
            the expected version.

    Raises:
        ValueError: if expected ot actual version is not in Major.Minor.Patch
            format.
    """
    if isinstance(parse_version(actual), SetuptoolsVersion):
        # This handles versions that end in things like `rc0`
        return parse_version(actual) >= parse_version(expected)
    else:
        # This handles versions that end in things like `-v7+` and `-generic`
        return LooseVersion(actual) >= LooseVersion(expected)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号