Skip to content

Commit c3db78e

Browse files
Code improvements
1 parent 29bd7ac commit c3db78e

File tree

4 files changed

+14
-14
lines changed

4 files changed

+14
-14
lines changed

.gitignore

+2-4
Original file line numberDiff line numberDiff line change
@@ -107,14 +107,14 @@ ipython_config.py
107107
# pyenv
108108
# For a library or package, you might want to ignore these files since the code is
109109
# intended to run in multiple environments; otherwise, check them in:
110-
# .python-version
110+
.python-version
111111

112112
# pipenv
113113
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
114114
# However, in case of collaboration, if having platform-specific dependencies or dependencies
115115
# having no cross-platform support, pipenv may install dependencies that don't work, or not
116116
# install all needed dependencies.
117-
#Pipfile.lock
117+
Pipfile.lock
118118

119119
# PEP 582; used by e.g. github.com/David-OConnor/pyflow
120120
__pypackages__/
@@ -164,8 +164,6 @@ cython_debug/
164164
# These are backup files generated by rustfmt
165165
**/*.rs.bk
166166

167-
.DS_Store
168-
169167
# The cache for docker container dependency
170168
.cargo
171169

src/commands/wallets.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -1150,7 +1150,7 @@ async def _filter_stake_info(stake_info: StakeInfo) -> bool:
11501150
async def transfer(
11511151
wallet: Wallet, subtensor: SubtensorInterface, destination: str, amount: float
11521152
):
1153-
# To:do - work out prompts to be passed through the cli
1153+
# TODO: - work out prompts to be passed through the cli
11541154
"""Transfer token of amount to destination."""
11551155
await transfer_extrinsic(
11561156
subtensor, wallet, destination, Balance.from_tao(amount), prompt=False
@@ -1300,7 +1300,7 @@ async def faucet(
13001300
log_verbose: bool,
13011301
max_successes: int = 3,
13021302
):
1303-
# To:do - work out prompts to be passed through the cli
1303+
# TODO: - work out prompts to be passed through the cli
13041304
success = await run_faucet_extrinsic(
13051305
subtensor,
13061306
wallet,

src/tests/e2e_tests/test_wallet_creations.py

+9-7
Original file line numberDiff line numberDiff line change
@@ -143,16 +143,18 @@ def extract_mnemonics_from_commands(output: str) -> Dict[str, Optional[str]]:
143143
mnemonics: Dict[str, Optional[str]] = {"coldkey": None, "hotkey": None}
144144
lines = output.splitlines()
145145

146-
# Regex pattern to capture the mnemonic
147-
pattern = re.compile(r"btcli w regen_(coldkey|hotkey) --mnemonic ([a-z ]+)")
146+
key_types = ["coldkey", "hotkey"]
147+
command_prefix = "btcli w regen_"
148148

149149
for line in lines:
150150
line = line.strip().lower()
151-
match = pattern.search(line)
152-
if match:
153-
key_type = match.group(1) # 'coldkey' or 'hotkey'
154-
mnemonic_phrase = match.group(2).strip()
155-
mnemonics[key_type] = mnemonic_phrase
151+
152+
if line.startswith(command_prefix):
153+
for key_type in key_types:
154+
if line.startswith(f"{command_prefix}{key_type} --mnemonic "):
155+
mnemonic_phrase = line.split("--mnemonic ")[1].strip()
156+
mnemonics[key_type] = mnemonic_phrase
157+
break
156158

157159
return mnemonics
158160

src/tests/e2e_tests/utils.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,7 @@ def validate_wallet_inspect(
155155
delegates: List[Tuple[str, float, bool]],
156156
hotkeys_netuid: List[Tuple[str, str, float, bool]],
157157
):
158-
# To:do - Handle stake in Balance format as well
158+
# TODO: Handle stake in Balance format as well
159159
"""
160160
Validates the presence of specific coldkey, balance, delegates, and hotkeys/netuid in the wallet information.
161161

0 commit comments

Comments
 (0)