import string
import unicodedata
-def parse_search_query(query):
- q = []
- for word in query.split():
- # Is this lexeme negated?
- negated = word.startswith("!")
-
- # Remove any special characters
- word = re.sub(r"\W+", "", word, flags=re.UNICODE)
- if not word:
- continue
-
- # Restore negation
- if negated:
- word = "!%s" % word
-
- q.append(word)
-
- return " & ".join(q)
-
def format_size(s, max_unit=None):
units = ("B", "kB", "MB", "GB", "TB")