コード例 #1
0
ファイル: expressions.py プロジェクト: marticongost/cocktail
    def normalize_operands(self, a, b):

        if self.normalized_strings:
            if a is not None:
                a = normalize(a)
            if not self._invariable_normalized and b is not None:
                b = normalize(b)

        return a, b
コード例 #2
0
def escape_ga_string(id):
    if id:
        id = html_to_plain_text(id)
        id = normalize(id)
        id = _escape_ga_string_nonword_expr.sub("-", id).strip("-")
        id = _escape_ga_string_repeat_expr.sub("-", id)
    return id
コード例 #3
0
ファイル: expressions.py プロジェクト: marticongost/cocktail
 def normalize_invariable(self):
     self.operands = (
         self.operands[0],
         Constant(normalize(self.operands[1].eval()))
     )
コード例 #4
0
 def normalize(self, text, preserve_patterns=False):
     return normalize(text,
                      normalization_map=self.pattern_normalization
                      if preserve_patterns else self.normalization)
コード例 #5
0
ファイル: grouping.py プロジェクト: marticongost/cocktail
 def get_sorting_key(self):
     return normalize(translations(self))
コード例 #6
0
ファイル: grouping.py プロジェクト: marticongost/cocktail
 def get_group_sorting_key(self, grouping):
     if self.sort_groups_alphabetically:
         return normalize(translations(grouping))
     else:
         return grouping.key
コード例 #7
0
ファイル: grouping.py プロジェクト: marticongost/cocktail
 def get_item_sorting_key(self, item):
     return normalize(translations(item))
コード例 #8
0
def _string_get_index_value(self, value):
    if value is not None and self.normalized_index:
        return normalize(value)
    else:
        return value