File size: 315 Bytes
cb5b71d
 
bc133ae
 
 
 
cb5b71d
 
 
bc133ae
cb5b71d
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
"""Module to handle naming of RecordSets and distribution."""

import re

NAME_PATTERN_REGEX = "[^a-zA-Z0-9\\-_\\.]"


def find_unique_name(names: set[str], name: str):
    """Find a unique UID."""
    name = re.sub(NAME_PATTERN_REGEX, "_", name)
    while name in names:
        name = f"{name}_0"
    return name