GitLab Repo

amachine.am_id_generator

 1import itertools
 2import threading
 3
 4_lock = threading.Lock()
 5_composition_counter = itertools.count(0) 
 6_group_counter = itertools.count(0)
 7
 8def next_composition_id() -> str:
 9    with _lock:
10        return str( next(_composition_counter) )
11
12def next_group_id() -> str:
13    with _lock:
14        return str( next(_group_counter) )
def next_composition_id() -> str:
 9def next_composition_id() -> str:
10    with _lock:
11        return str( next(_composition_counter) )
def next_group_id() -> str:
13def next_group_id() -> str:
14    with _lock:
15        return str( next(_group_counter) )