cache regex tuples by id
This commit is contained in:
parent
8f1f604708
commit
cd611199b1
1 changed files with 3 additions and 3 deletions
|
|
@ -318,15 +318,15 @@ def regex_tuple_from_key_alias(obj):
|
||||||
|
|
||||||
"""
|
"""
|
||||||
global _REGEX_TUPLE_CACHE
|
global _REGEX_TUPLE_CACHE
|
||||||
permutation_string = " ".join([obj.key] + obj.aliases.all())
|
|
||||||
|
|
||||||
if permutation_string not in _REGEX_TUPLE_CACHE:
|
if obj.id not in _REGEX_TUPLE_CACHE:
|
||||||
|
permutation_string = " ".join([obj.key] + obj.aliases.all())
|
||||||
_REGEX_TUPLE_CACHE[permutation_string] = (
|
_REGEX_TUPLE_CACHE[permutation_string] = (
|
||||||
re.compile(ordered_permutation_regex(permutation_string), _RE_FLAGS),
|
re.compile(ordered_permutation_regex(permutation_string), _RE_FLAGS),
|
||||||
obj,
|
obj,
|
||||||
obj.key,
|
obj.key,
|
||||||
)
|
)
|
||||||
return _REGEX_TUPLE_CACHE[permutation_string]
|
return _REGEX_TUPLE_CACHE[obj.id]
|
||||||
|
|
||||||
|
|
||||||
def parse_language(speaker, emote):
|
def parse_language(speaker, emote):
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue