def test_glob_to_regex(): """Make sure glob_to_regex() strips the right static suffix off the end of the pattern fnmatch.translate() returns. In other words, pin down the behavior of fnmatch.translate(). """ eq_(glob_to_regex('hi'), 'hi')
def test_glob_to_regex(): """Make sure glob_to_regex() strips the right static suffix off the end of the pattern fnmatch.translate() returns. In other words, pin down the behavior of fnmatch.translate(). """ eq_(glob_to_regex('hi'), '^hi$')
def filter(self): glob = self._term["arg"] try: return es_regex_filter( regex_grammar.parse(glob_to_regex(glob)), "path", is_case_sensitive=self._term["case_sensitive"] ) except NoTrigrams: raise BadTerm("Path globs need at least 3 literal characters in a row " "for speed.")
def filter(self): glob = self._term['arg'] try: return es_regex_filter( regex_grammar.parse(glob_to_regex(glob)), 'path', is_case_sensitive=self._term['case_sensitive']) except NoTrigrams: raise BadTerm('Path globs need at least 3 literal characters in a row ' 'for speed.')
def _regex_filter(self, path_seg_property_name, no_trigrams_error_text): """Return an ES regex filter that matches this filter's glob against the path segment at path_seg_property_name. """ glob = self._term['arg'] try: return es_regex_filter( regex_grammar.parse(glob_to_regex(glob)), path_seg_property_name, is_case_sensitive=self._term['case_sensitive']) except NoTrigrams: raise BadTerm(no_trigrams_error_text)