(pattern)
return (
        len(parts),  # Shorter OIDs are less specific than longer OIDs, regardless of their contents.
        parts,  # For same-length OIDs, compare their contents (integer parts).
    )
Return a measure of the specificity of an OID pattern.

    Suitable for use as a key function when sorting OID patterns.
Return a measure of the specificity of an OID pattern.
Return a measure of the specificity of an OID pattern .
def oid_pattern_specificity(pattern):
    # type: (str) -> Tuple[int, Tuple[int, ...]]
    """Return a measure of the specificity of an OID pattern.

    Suitable for use as a key function when sorting OID patterns.
    """
    wildcard_key = -1  # Must be less than all digits, so that e.G. '1.*' is less specific than '1.n' for n = 0...9.

    parts = tuple(wildcard_key if digit == '*' else int(digit) for digit in pattern.lstrip('.').split('.'))

    return (
        len(parts),  # Shorter OIDs are less specific than longer OIDs, regardless of their contents.
        parts,  # For same-length OIDs, compare their contents (integer parts).
    )
def oid_pattern_specificity ( pattern ) : # type: (str) -> Tuple[int, Tuple[int, ...]] wildcard_key = - 1 # Must be less than all digits, so that e.G. '1.*' is less specific than '1.n' for n = 0...9. parts = tuple ( wildcard_key if digit == '*' else int ( digit ) for digit in pattern . lstrip ( '.' ) . split ( '.' ) ) return ( len ( parts ) , # Shorter OIDs are less specific than longer OIDs, regardless of their contents. parts , # For same-length OIDs, compare their contents (integer parts). )