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
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
def normalize_invariable(self): self.operands = ( self.operands[0], Constant(normalize(self.operands[1].eval())) )
def normalize(self, text, preserve_patterns=False): return normalize(text, normalization_map=self.pattern_normalization if preserve_patterns else self.normalization)
def get_sorting_key(self): return normalize(translations(self))
def get_group_sorting_key(self, grouping): if self.sort_groups_alphabetically: return normalize(translations(grouping)) else: return grouping.key
def get_item_sorting_key(self, item): return normalize(translations(item))
def _string_get_index_value(self, value): if value is not None and self.normalized_index: return normalize(value) else: return value