def _matches()

in mozilla_schema_generator/matcher.py [0:0]


    def _matches(match_v: Any, probe_v: Any) -> bool:
        if isinstance(probe_v, set):
            probe_v = list(probe_v)

        # Not a match if this key isn't in the probe definition
        if probe_v is None:
            return False

        # Not a match if not an exact match of values (e.g. type=scalar vs. histogram)
        if not isinstance(match_v, dict):
            if match_v != probe_v:
                return False

        elif isinstance(match_v, dict):
            # Not a match if probe_v doesn't contain expected value
            if Matcher.contains_key in match_v:
                if match_v[Matcher.contains_key] not in probe_v:
                    return False

            # Not a match if matches the "not" value
            if Matcher.not_key in match_v:
                if match_v[Matcher.not_key] == probe_v:
                    return False

            # Match if any of the listed values match
            if Matcher.any_key in match_v:
                return probe_v in match_v[Matcher.any_key]
        return True