Skip to content

Commit 62b836f

Browse files
committed
Merge remote-tracking branch 'origin/staging' into feat/thewhaleking/new-exception-for-max-retries
2 parents 0acc0b6 + f63ebb7 commit 62b836f

File tree

4 files changed

+15
-6
lines changed

4 files changed

+15
-6
lines changed

.github/workflows/check-sdk-tests.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -229,7 +229,6 @@ jobs:
229229
git fetch origin staging
230230
python3 -m pip install --upgrade pip
231231
python3 -m pip install '.[dev]'
232-
python3 -m pip install -r requirements/torch.txt
233232
234233
- name: Clone async-substrate-interface repo
235234
run: git clone https://github.com/opentensor/async-substrate-interface.git

async_substrate_interface/async_substrate.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
import asyncio
88
import inspect
99
import logging
10-
import random
1110
import ssl
1211
import time
1312
from hashlib import blake2b
@@ -49,7 +48,12 @@
4948
SubstrateMixin,
5049
Preprocessed,
5150
)
52-
from async_substrate_interface.utils import hex_to_bytes, json, get_next_id
51+
from async_substrate_interface.utils import (
52+
hex_to_bytes,
53+
json,
54+
get_next_id,
55+
rng as random,
56+
)
5357
from async_substrate_interface.utils.cache import async_sql_lru_cache
5458
from async_substrate_interface.utils.decoding import (
5559
_determine_if_old_runtime_call,

async_substrate_interface/sync_substrate.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import functools
22
import logging
3-
import random
43
from hashlib import blake2b
54
from typing import Optional, Union, Callable, Any
65

@@ -31,7 +30,12 @@
3130
Preprocessed,
3231
ScaleObj,
3332
)
34-
from async_substrate_interface.utils import hex_to_bytes, json, get_next_id
33+
from async_substrate_interface.utils import (
34+
hex_to_bytes,
35+
json,
36+
get_next_id,
37+
rng as random,
38+
)
3539
from async_substrate_interface.utils.decoding import (
3640
_determine_if_old_runtime_call,
3741
_bt_decode_to_dict_or_list,

async_substrate_interface/utils/__init__.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,15 @@
55

66
id_cycle = cycle(range(1, 999))
77

8+
rng = random.Random()
9+
810

911
def get_next_id() -> str:
1012
"""
1113
Generates a pseudo-random ID by returning the next int of a range from 1-998 prepended with
1214
two random ascii characters.
1315
"""
14-
random_letters = "".join(random.choices(string.ascii_letters, k=2))
16+
random_letters = "".join(rng.choices(string.ascii_letters, k=2))
1517
return f"{random_letters}{next(id_cycle)}"
1618

1719

0 commit comments

Comments
 (0)