Repository navigation
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Improved logics to better use python implementation for some comparison:
EqualFilter._check_value: normalise with a list comprehension and also buildself._value_set = frozenset(self._value);matchtests membership against it.NotEqualFilterinherits it.StartswithFilter/EndswithFilter._check_value: normalise with a list comprehension and also buildself._prefixes/self._suffixesas tuples;_check_startswith/_check_endswithbecome a singlevalue.lower().startswith(self._prefixes)/.endswith(self._suffixes).KeywordFilter._check_value: normalise with a list comprehension;_check_keyword: lowercasevalueonce, thenkeyword in value.DomainFilter._check_value: drop the redundantstr()cast and also buildself._domains(frozenset) andself._dot_suffixes(tuple of"." + domain);_check_domainreturnsvalue in self._domains or value.endswith(self._dot_suffixes).NETWORK:
_parse_network(text) -> tuple[int, int, int] | None(version, first address, last address) decorated withfunctools.lru_cache(maxsize=4096). It returnsNoneonValueError/TypeError, so invalid values are cached as well.NetworkFilter._check_value: also build per-version sorted_starts/_endslists, keeping only the outermost blocks (CIDR blocks are either nested or disjoint, so the result is a list of disjoint intervals)._check_network:bisect_righton_starts[version], then check that the event block ends within that interval.NotNetworkFilterinherits it.Noneand not the exception.ComparatorFilter._check_value: also computeself._thresholdas in D8 (Nonewhen there is no non-NaN term)._comparecompares once against it and catchesOverflowError.Add a
DictQuerysubclass that memoisesget()keyed by(path, repr(default)), because the default can end up inside list results. Paths starting withcertego.routing_historybypass the cache, and so do non-string paths. The check runs only on a miss, by never storing those paths.DictQuery's own traversal is untouched.Routing.matchwraps the event in that subclass instead ofDictQuery, and nothing else changes.Rule.outputkeeps the plainDictQuery.