(weak=WEAK_MATCHES, strong=STRONG_MATCHES)
return relevance
Create a key function that can be used to sort errors by relevance.

    Arguments:
        weak (set):
            a collection of validator names to consider to be "weak".
            If there are two errors at the same level of the instance
            and one is in the set of weak validator names, the other
            error will take priority. By default, :validator:`anyOf` and
            :validator:`oneOf` are considered weak validators and will
            be superseded by other same-level validation errors.

        strong (set):
            a collection of validator names to consider to be "strong"
Create a key function that can be used to sort errors by relevance.
Create a key function that can be used to sort errors by relevance .
def by_relevance(weak=WEAK_MATCHES, strong=STRONG_MATCHES):
    """
    Create a key function that can be used to sort errors by relevance.

    Arguments:
        weak (set):
            a collection of validator names to consider to be "weak".
            If there are two errors at the same level of the instance
            and one is in the set of weak validator names, the other
            error will take priority. By default, :validator:`anyOf` and
            :validator:`oneOf` are considered weak validators and will
            be superseded by other same-level validation errors.

        strong (set):
            a collection of validator names to consider to be "strong"
    """
    def relevance(error):
        validator = error.validator
        return -len(error.path), validator not in weak, validator in strong
    return relevance
def by_relevance ( weak = WEAK_MATCHES , strong = STRONG_MATCHES ) : def relevance ( error ) : validator = error . validator return - len ( error . path ) , validator not in weak , validator in strong return relevance