diff options
author | Zuul <zuul@review.openstack.org> | 2018-02-09 12:55:21 +0000 |
---|---|---|
committer | Gerrit Code Review <review@openstack.org> | 2018-02-09 12:55:21 +0000 |
commit | 695abbe53a99bddca0a1278988f92fc3e4c1ae86 (patch) | |
tree | 5f89db200f3cec3e7c866fe2cf901a926af210b6 /oslo_utils | |
parent | 171b968e6e747a4fcd7063d00912af9ada4fcc52 (diff) | |
parent | 9180df19b8995bff044995f167291422d20f3c58 (diff) | |
download | oslo-utils-695abbe53a99bddca0a1278988f92fc3e4c1ae86.tar.gz |
Merge "Clean imports in code"
Diffstat (limited to 'oslo_utils')
-rw-r--r-- | oslo_utils/specs_matcher.py | 27 |
1 files changed, 12 insertions, 15 deletions
diff --git a/oslo_utils/specs_matcher.py b/oslo_utils/specs_matcher.py index a21798c..f999a9f 100644 --- a/oslo_utils/specs_matcher.py +++ b/oslo_utils/specs_matcher.py @@ -17,9 +17,6 @@ import ast import operator import pyparsing -from pyparsing import Literal -from pyparsing import OneOrMore -from pyparsing import Regex def _all_in(x, *y): @@ -104,25 +101,25 @@ Example operations: unary_ops = ( # Order matters here (so that '=' doesn't match before '==') - Literal("==") | Literal("=") | - Literal("!=") | Literal("<in>") | - Literal(">=") | Literal("<=") | - Literal(">") | Literal("<") | - Literal("s==") | Literal("s!=") | + pyparsing.Literal("==") | pyparsing.Literal("=") | + pyparsing.Literal("!=") | pyparsing.Literal("<in>") | + pyparsing.Literal(">=") | pyparsing.Literal("<=") | + pyparsing.Literal(">") | pyparsing.Literal("<") | + pyparsing.Literal("s==") | pyparsing.Literal("s!=") | # Order matters here (so that '<' doesn't match before '<=') - Literal("s<=") | Literal("s<") | + pyparsing.Literal("s<=") | pyparsing.Literal("s<") | # Order matters here (so that '>' doesn't match before '>=') - Literal("s>=") | Literal("s>")) + pyparsing.Literal("s>=") | pyparsing.Literal("s>")) - all_in_nary_op = Literal("<all-in>") - or_ = Literal("<or>") + all_in_nary_op = pyparsing.Literal("<all-in>") + or_ = pyparsing.Literal("<or>") # An atom is anything not an keyword followed by anything but whitespace - atom = ~(unary_ops | all_in_nary_op | or_) + Regex(r"\S+") + atom = ~(unary_ops | all_in_nary_op | or_) + pyparsing.Regex(r"\S+") unary = unary_ops + atom - nary = all_in_nary_op + OneOrMore(atom) - disjunction = OneOrMore(or_ + atom) + nary = all_in_nary_op + pyparsing.OneOrMore(atom) + disjunction = pyparsing.OneOrMore(or_ + atom) # Even-numbered tokens will be '<or>', so we drop them disjunction.setParseAction(lambda _s, _l, t: ["<or>"] + t[1::2]) |