mirror of
https://github.com/ansible/awx.git
synced 2026-01-11 10:00:01 -03:30
Merge pull request #838 from AlanCoding/no_unicode_loop_2
Avoid slowdown generating smart_filter (alternative 2)
This commit is contained in:
commit
526391a072
@ -1,5 +1,4 @@
|
||||
import re
|
||||
import sys
|
||||
from pyparsing import (
|
||||
infixNotation,
|
||||
opAssoc,
|
||||
@ -15,9 +14,6 @@ from awx.main.utils.common import get_search_fields
|
||||
|
||||
__all__ = ['SmartFilter']
|
||||
|
||||
unicode_spaces = [unichr(c) for c in xrange(sys.maxunicode) if unichr(c).isspace()]
|
||||
unicode_spaces_other = unicode_spaces + [u'(', u')', u'=', u'"']
|
||||
|
||||
|
||||
def string_to_type(t):
|
||||
if t == u'true':
|
||||
@ -213,6 +209,8 @@ class SmartFilter(object):
|
||||
filter_string_raw = filter_string
|
||||
filter_string = unicode(filter_string)
|
||||
|
||||
unicode_spaces = list(set(unicode(c) for c in filter_string if c.isspace()))
|
||||
unicode_spaces_other = unicode_spaces + [u'(', u')', u'=', u'"']
|
||||
atom = CharsNotIn(unicode_spaces_other)
|
||||
atom_inside_quotes = CharsNotIn(u'"')
|
||||
atom_quoted = Literal('"') + Optional(atom_inside_quotes) + Literal('"')
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user