# Path: ethronsoft/gcspypi/utilities/version.py
# def complete_version(v):
#     """adds missing '0' to a version that has less than 3 components
#     
#     Arguments:
#         v {str} -- The version to update
#     
#     Returns:
#         str -- The modified version
#     """
# 
#     tokens = [x for x in v.split(".") if x.strip()]
#     if len(tokens) > 3:
#         raise InvalidParameter("Invalid Version")
#     for i in range(3 - len(tokens)):
#         tokens.append("0")
#     return ".".join(tokens)
# 
# Path: ethronsoft/gcspypi/exceptions/boundary_errors.py
# class InvalidParameter(Exception):
#     pass


from ethronsoft.gcspypi.utilities.version import complete_version
from ethronsoft.gcspypi.exceptions import InvalidParameter
    from ethronsoft.gcspypi.package.package import Package
    from ethronsoft.gcspypi.package.package import Package
import functools
            x = higher(list, Package(pkg_name, complete_version(v1)), pkg_comp_name_version)
        else:
            x = None
    elif op1 == "<=":
        if v1:
            x = floor(list, Package(pkg_name, complete_version(v1)), pkg_comp_name_version)
        else:
            x = lower(list, Package(pkg_name + 'x01', ""), pkg_comp_name) #lower than last
    elif op1 == ">=":
        if v1:
            x = ceiling(list, Package(pkg_name, complete_version(v1)), pkg_comp_name_version)
        else:
            x = lower(list, Package(pkg_name + 'x01', ""), pkg_comp_name)
    else:
        raise InvalidParameter("Invalid operator" + op1)

    if x and x.name != pkg_name:
        return None

    if v2:
        if op2 == "==":
            # return equal(list, Package(pkg_name, complete_version(v2)), pkg_comp_name_version)
            return x if x.version == complete_version(v2) else None
        elif op2 == "<":
            return x if x.version < complete_version(v2) else None
        elif op2 == ">":
            return x if x.version > complete_version(v2) else None
        elif op2 == "<=":
            return x if x.version <= complete_version(v2) else None
        elif op2 == ">=":

# Path: ethronsoft/gcspypi/utilities/version.py
# def complete_version(v):
#     """adds missing '0' to a version that has less than 3 components
#     
#     Arguments:
#         v {str} -- The version to update
#     
#     Returns:
#         str -- The modified version
#     """
# 
#     tokens = [x for x in v.split(".") if x.strip()]
#     if len(tokens) > 3:
#         raise InvalidParameter("Invalid Version")
#     for i in range(3 - len(tokens)):
#         tokens.append("0")
#     return ".".join(tokens)
# 
# Path: ethronsoft/gcspypi/exceptions/boundary_errors.py
# class InvalidParameter(Exception):
#     pass


# Path: ethronsoft/gcspypi/utilities/queries.py
from ethronsoft.gcspypi.utilities.version import complete_version
from ethronsoft.gcspypi.exceptions import InvalidParameter
    from ethronsoft.gcspypi.package.package import Package
    from ethronsoft.gcspypi.package.package import Package
import functools

            x = higher(list, Package(pkg_name, complete_version(v1)), pkg_comp_name_version)
        else:
            x = None
    elif op1 == "<=":
        if v1:
            x = floor(list, Package(pkg_name, complete_version(v1)), pkg_comp_name_version)
        else:
            x = lower(list, Package(pkg_name + 'x01', ""), pkg_comp_name) #lower than last
    elif op1 == ">=":
        if v1:
            x = ceiling(list, Package(pkg_name, complete_version(v1)), pkg_comp_name_version)
        else:
            x = lower(list, Package(pkg_name + 'x01', ""), pkg_comp_name)
    else:
        raise InvalidParameter("Invalid operator" + op1)

    if x and x.name != pkg_name:
        return None

    if v2:
        if op2 == "==":
            # return equal(list, Package(pkg_name, complete_version(v2)), pkg_comp_name_version)
            return x if x.version == complete_version(v2) else None
        elif op2 == "<":
            return x if x.version < complete_version(v2) else None
        elif op2 == ">":
            return x if x.version > complete_version(v2) else None
        elif op2 == "<=":
            return x if x.version <= complete_version(v2) else None
        elif op2 == ">=":

            return x if x.version <= complete_version(v2) else None