From b6c928ce7ad709fd05f04fd648a441f82e9196ba Mon Sep 17 00:00:00 2001 From: Matt Cleinman <9295855+mcleinman@users.noreply.github.com> Date: Wed, 13 Nov 2024 11:06:14 -0800 Subject: [PATCH] simply with a regex --- scripts/ci/update_server_names.py | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/scripts/ci/update_server_names.py b/scripts/ci/update_server_names.py index dd88113b33..0f92ec384e 100755 --- a/scripts/ci/update_server_names.py +++ b/scripts/ci/update_server_names.py @@ -61,15 +61,11 @@ def fetch_server_list(): string_map = countries for city in cities: # Remove state suffix, capitalize each work, remove spaces. - baseId = city.split(",")[0].strip().title().replace(" ", "") + id = city.split(",")[0].strip().title().replace(" ", "") # Remove special characters like the `ö` in `Malmö` - allowedIdChars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz" - simpleId = "" - for char in baseId: - if char in allowedIdChars: - simpleId = simpleId + char + id = re.sub(r'[^a-zA-Z]+', '', id) # Add it to the map - string_map[simpleId] = city + string_map[id] = city ### # 2. Fetch the list of servers in extras.xliff