diff options
author | Victor Shyba <victor.shyba@gmail.com> | 2014-08-18 09:50:27 -0300 |
---|---|---|
committer | Victor Shyba <victor.shyba@gmail.com> | 2014-08-18 09:50:27 -0300 |
commit | ff110f03e4bdf526e61d844e0c8296ad804d511f (patch) | |
tree | de718df66d190ff325f8776febdb85ca7382d1da /py-fake-service/app/search/search_query.py | |
parent | 3e3ab15d98bf7ca866e0ff40e6adf43902a5eac3 (diff) |
Apply PEP8 automatically
Diffstat (limited to 'py-fake-service/app/search/search_query.py')
-rw-r--r-- | py-fake-service/app/search/search_query.py | 26 |
1 files changed, 12 insertions, 14 deletions
diff --git a/py-fake-service/app/search/search_query.py b/py-fake-service/app/search/search_query.py index 83c0bbca..765d1008 100644 --- a/py-fake-service/app/search/search_query.py +++ b/py-fake-service/app/search/search_query.py @@ -3,27 +3,27 @@ import re def _next_token(): - return StringRegexp('[^\s]+') + return StringRegexp('[^\s]+') -def _separators(): - return StringRegexp('[\s&]+') +def _separators(): + return StringRegexp('[\s&]+') def _compile_tag(compiled, token): - tag = token.split(":").pop() - if token[0] == "-": + tag = token.split(":").pop() + if token[0] == "-": compiled["not_tags"].append(tag) - else: - compiled["tags"].append(tag) - return compiled + else: + compiled["tags"].append(tag) + return compiled class SearchQuery: @staticmethod def compile(query): - compiled = {"tags": [], "not_tags": [], "general":[]} + compiled = {"tags": [], "not_tags": [], "general": []} scanner = StringScanner(query.encode('utf8').replace("\"", "")) first_token = True @@ -56,15 +56,13 @@ class SearchQuery: return True if self.compiled.get('general'): - search_terms = re.compile(self.compiled['general'], flags=re.IGNORECASE) + search_terms = re.compile( + self.compiled['general'], + flags=re.IGNORECASE) if search_terms.search(mail.body) or search_terms.search(mail.subject): return True if not [v for v in self.compiled.values() if v]: return True - return False - - - |