in scripts/awsicons/icon.py [0:0]
def _make_name(self, regex: str, filename: str, mappings: dict):
"""
Create PUML friendly name short name without directory and strip leading Arch_ or Res_
and trailing _48.svg, then remove leading AWS or Amazon to reduce length.
Strip non-alphanumeric characters.
The name input should be a complete filename (e.g., Arch_foo_48.svg)
"""
try:
name = re.search(regex, filename).group(1)
new_name = re.sub(r"[^a-zA-Z0-9]", "", name)
except Exception as e:
print(
f"Error in extracting icon name from filename. Regex: {regex}, source filename string: {filename}"
)
raise SystemExit(1)
if mappings:
try:
new_name = mappings[new_name]
except KeyError:
# no match found, existing filename is okay
pass
return new_name