We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 9076e41 commit 0e56cdfCopy full SHA for 0e56cdf
async_substrate_interface/utils/__init__.py
@@ -1,11 +1,18 @@
1
import importlib
2
from itertools import cycle
3
+import random
4
+import string
5
6
id_cycle = cycle(range(1, 999))
7
8
-def get_next_id():
- return next(id_cycle)
9
+def get_next_id() -> str:
10
+ """
11
+ Generates a pseudo-random ID by returning grabbing the next int of a range from 1-998, and prepending it with
12
+ two random ascii characters.
13
14
+ random_letters = "".join(random.choices(string.ascii_letters, k=2))
15
+ return f"{random_letters}{next(id_cycle)}"
16
17
18
def hex_to_bytes(hex_str: str) -> bytes:
0 commit comments