@staticmethod
    def _compare_components(a_parts, b_parts):

        def grab(l, idx, gtype, gdefault):
            part = gdefault

            if idx < len(l):
                possible_part = l[idx]

                if isinstance(possible_part, gtype):
                    part = possible_part

            return part

        for idx in xrange(0, max(len(a_parts), len(b_parts))):
            # Grab the non-digit part of the characters
            grab_non_digit = lambda l, idx: grab(l, idx, basestring, '')

            a_str = grab_non_digit(a_parts, idx)
            b_str = grab_non_digit(b_parts, idx)

            # Compare with the special lexicographic version (~,
            # letters, everything else)
            s_cmp = version_string_cmp(a_str, b_str)

            if 0 != s_cmp:
                return s_cmp

            # Consume all digit characters from each item
            grab_digit = lambda l, idx: grab(l, idx, int, 0)

            a_int = grab_digit(a_parts, idx)
            b_int = grab_digit(b_parts, idx)

            # Compare the numbers
            i_cmp = cmp(a_int, b_int)

            if 0 != i_cmp:
                return i_cmp

            idx += 1

        return 0
test with empty host FQDN URL
dataset/ETHPy150Open jlisee/xpkg/python/xpkg/util.py/Version._compare_components--crossover with--dataset/ETHPy150Open alecthomas/voluptuous/voluptuous/tests/tests.py/test_fqdnurl_validation_without_host