(
    freqs: Iterable[Tuple[Any, int]], values: List[Any]
)
only keeps things that match the string representation of values in the enumeration.
    converts from the string to the value as represented in the enumeration.
only keeps things that match the string representation of values in the enumeration.
    converts from the string to the value as represented in the enumeration.
only keeps things that match the string representation of values in the enumeration . converts from the string to the value as represented in the enumeration .
def freqsAsEnumValues(
    freqs: Iterable[Tuple[Any, int]], values: List[Any]
) -> Iterator[Tuple[Defaultable[Any], int]]:
    """only keeps things that match the string representation of values in the enumeration.
    converts from the string to the value as represented in the enumeration.
    """

    def as_str(v) -> str:
        """There are some quirks in how the PGO files
        encodes values relative to python's str method
        """
        if v is None:
            return "none"
        elif v is True:
            return "true"
        elif v is False:
            return "false"
        else:
            return str(v)

    value_lookup = {as_str(k): k for k in values}
    for v, f in freqs:
        if v == DEFAULT_STR:
            yield _default_value, f
            continue

        if v in value_lookup:
            yield value_lookup[v], f
def freqsAsEnumValues ( freqs : Iterable [ Tuple [ Any , int ] ] , values : List [ Any ] ) -> Iterator [ Tuple [ Defaultable [ Any ] , int ] ] : def as_str ( v ) -> str : """There are some quirks in how the PGO files
        encodes values relative to python's str method
        """ if v is None : return "none" elif v is True : return "true" elif v is False : return "false" else : return str ( v ) value_lookup = { as_str ( k ) : k for k in values } for v , f in freqs : if v == DEFAULT_STR : yield _default_value , f continue if v in value_lookup : yield value_lookup [ v ] , f