From 451a07d2d2b7a192d064d555053d4232d3b218e5 Mon Sep 17 00:00:00 2001 From: James Tanner Date: Wed, 4 Oct 2023 23:10:15 -0400 Subject: [PATCH] checkin --- dev/scripts.community/cleanup_namespaces.py | 2 ++ dev/scripts.community/testme.py | 12 ++++++++++++ 2 files changed, 14 insertions(+) create mode 100644 dev/scripts.community/testme.py diff --git a/dev/scripts.community/cleanup_namespaces.py b/dev/scripts.community/cleanup_namespaces.py index 4e121af39d..231d8e3c43 100644 --- a/dev/scripts.community/cleanup_namespaces.py +++ b/dev/scripts.community/cleanup_namespaces.py @@ -38,6 +38,8 @@ def do_cleanup(): prefix, number = strip_number_from_string(ns_name) #print(f'{prefix} {number}') if number is None: + if prefix not in ns_map: + ns_map[prefix] = [prefix] continue if prefix not in ns_map: ns_map[prefix] = [] diff --git a/dev/scripts.community/testme.py b/dev/scripts.community/testme.py new file mode 100644 index 0000000000..33f8ae4369 --- /dev/null +++ b/dev/scripts.community/testme.py @@ -0,0 +1,12 @@ +import re + +def strip_number_from_string(input_string): + #match = re.search(r'(\D+)(\d+)$', input_string) + #match = re.search(r'([\w\d_]*)(\d+)$', input_string) + match = re.search(r'([\w_]*[A-Za-z_])(\d+)$', input_string) + if match: + prefix = match.group(1) + number = match.group(2) + return prefix, int(number) + else: + return input_string, None