Skip to content
Snippets Groups Projects
Commit 1a17eba9 authored by Moul's avatar Moul
Browse files

Bump black to v0.9.2

Apply Black 2025 format

Disable COM check as recommended
parent d4eed25e
No related branches found
No related tags found
No related merge requests found
Pipeline #39874 waiting for manual action
......@@ -11,7 +11,7 @@ repos:
- id: mixed-line-ending
- id: trailing-whitespace
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.8.5
rev: v0.9.2
hooks:
- id: ruff
args: [--fix, --exit-non-zero-on-fix]
......
......@@ -69,6 +69,6 @@ ignore_missing_imports = true
[tool.ruff]
target-version = "py39"
lint.select = ["F", "W", "I", "UP", "YTT", "B", "A", "DTZ", "T10",
"EXE", "ISC", "ICN", "G", "INP", "PIE", "PYI", "Q", "RSE", "SLF", "TID", "PL",
"COM", "C4", "PT", "RET", "SIM", "PTH", "PGH", "PL", "TRY", "RUF"]
"EXE", "ISC", "ICN", "G", "INP", "PIE", "PYI", "Q", "RSE", "SLF", "TID",
"PL", "C4", "PT", "RET", "SIM", "PTH", "PGH", "PL", "TRY", "RUF"]
lint.ignore = ["PLR2004", "PLR0913"]
......@@ -59,8 +59,10 @@ def generate_auth_file(auth_file: Path) -> None:
key = auth_method()
pubkey_cksum = gen_pubkey_checksum(key.pubkey)
if auth_file.is_file():
message = f"Would you like to erase {auth_file} with an authentication file corresponding \n\
message = (
f"Would you like to erase {auth_file} with an authentication file corresponding \n\
to following pubkey `{pubkey_cksum}`?"
)
click.confirm(message, abort=True)
key.save_seedhex_file(auth_file)
print(
......
......@@ -60,11 +60,11 @@ def display_diffi(current: WSConnection, diffi: dict) -> None:
table = tui.Table(style="columns").set_cols_dtype(["t", "t", "t", "i"])
table.fill_from_dict_list(sorted_diffi)
content = f'Current block: n°{current["number"]}, generated on {block_gen}\n\
Generation of next block n°{diffi["block"]} \
possible by at least {issuers}/{len(diffi["levels"])} members\n\
Common Proof-of-Work difficulty level: {current["powMin"]}, hash starting with `{match}`\n\
{table.draw()}'
content = f"Current block: n°{current['number']}, generated on {block_gen}\n\
Generation of next block n°{diffi['block']} \
possible by at least {issuers}/{len(diffi['levels'])} members\n\
Common Proof-of-Work difficulty level: {current['powMin']}, hash starting with `{match}`\n\
{table.draw()}"
print(content)
......
......@@ -110,8 +110,8 @@ def generate_header(pubkey: str, currency_symbol: str, ud_value: int) -> str:
balance = get_amount_from_pubkey(pubkey)
balance_ud = round(balance[1] / ud_value, 2)
date = arrow.now().format(ALL)
return f'Transactions history from: {idty["uid"]} {gen_pubkey_checksum(pubkey)}\n\
Current balance: {balance[1] / 100} {currency_symbol}, {balance_ud} UD {currency_symbol} on {date}\n'
return f"Transactions history from: {idty['uid']} {gen_pubkey_checksum(pubkey)}\n\
Current balance: {balance[1] / 100} {currency_symbol}, {balance_ud} UD {currency_symbol} on {date}\n"
def get_transactions_history(
......@@ -319,7 +319,7 @@ def assign_idty_from_pubkey(pubkey: str, identities: list, full_pubkey: bool) ->
for identity in identities:
if pubkey == identity["pubkey"]:
pubkey_mod = gen_pubkey_checksum(pubkey, short=not full_pubkey)
idty = f'{identity["uid"]} - {pubkey_mod}'
idty = f"{identity['uid']} - {pubkey_mod}"
return idty
......
......@@ -38,5 +38,5 @@ def lookup_cmd(uid_pubkey: str) -> None:
for lookup in lookups:
for identity in lookup["uids"]:
pubkey_checksum = gen_pubkey_checksum(lookup["pubkey"])
content += f'\n{pubkey_checksum}{identity["uid"]}'
content += f"\n{pubkey_checksum}{identity['uid']}"
click.echo(content)
......@@ -60,11 +60,11 @@ def status(uid_pubkey: str) -> None:
certifications["received_expire"].append(
arrow.now().shift(seconds=req_cert["expiresIn"]).format(DATE),
)
certifications["received"].append(f'{lookup_cert["uids"][0]}')
certifications["received"].append(f"{lookup_cert['uids'][0]}")
break
for pending_cert in req["pendingCerts"]:
certifications["received"].append(
f'{(wt.identity_of(pending_cert["from"]))["uid"]}',
f"{(wt.identity_of(pending_cert['from']))['uid']}",
)
certifications["received_expire"].append(
arrow.get(pending_cert["expires_on"]).to("local").format(DATE),
......@@ -81,13 +81,13 @@ def status(uid_pubkey: str) -> None:
table.fill_from_dict(certifications)
print(
f'{identity["uid"]} ({gen_pubkey_checksum(pubkey, True)}) \
from block #{identity["meta"]["timestamp"][:15]}\n\
received {len(certifications["received"])} and sent \
{nbr_sent_certs}/{params["sigStock"]} certifications:\n\
f"{identity['uid']} ({gen_pubkey_checksum(pubkey, True)}) \
from block #{identity['meta']['timestamp'][:15]}\n\
received {len(certifications['received'])} and sent \
{nbr_sent_certs}/{params['sigStock']} certifications:\n\
{table.draw()}\n\
✔: Certification written in the blockchain\n\
✘: Pending certification, deadline treatment\n',
✘: Pending certification, deadline treatment\n",
)
membership_status(certifications, pubkey, req)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment