Suits: Make suit name regex's case-insensitive (and tweak a comment)

This commit is contained in:
Athanasius committed 2021-05-25 16:05:34 +01:00
1 parent dba3fba8e3
commit 43a7974da5
1 file changed
+3 -3
+3 -3
View File
@@ -1605,19 +1605,19 @@ class EDLogs(FileSystemEventHandler): # type: ignore # See below
"""
# TODO: Localisation ?
# Stage 1: Is it in `$<type>_Class<X>_Name;` form ?
if m := re.fullmatch(r'^\$([^_]+)_Class([0-9]+)_Name;$', name):
if m := re.fullmatch(r'(?i)^\$([^_]+)_Class([0-9]+)_Name;$', name):
n, c = m.group(1, 2)
name = n
# Stage 2: Is it in `<type>_class<x>` form ?
elif m := re.fullmatch(r'^([^_]+)_class([0-9]+)$', name):
elif m := re.fullmatch(r'(?i)^([^_]+)_class([0-9]+)$', name):
n, c = m.group(1, 2)
name = n
# Now turn either of those into an English '<type> Suit' form
name = edmc_suit_symbol_to_en.get(name.lower(), name)
# Stage 3: Is it in verbose `<type> Suit` form ?
# Finally, map that to a form without the verbose ' Suit' on the end
name = edmc_suit_shortnames.get(name, name)
return name