diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 7748456d1b63283b913e79f000a60fb7c58468fc..1962c00ce21f35a5de398588f5297943aaea60a8 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -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] diff --git a/pyproject.toml b/pyproject.toml index 427251664cb4b021ad07304023aeac0f14713b2b..ab08a269d491220db80f2990e4001f7d5e86eb8b 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -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"] diff --git a/silkaj/auth.py b/silkaj/auth.py index 90f22fff61459e03b416c6f10a933ec8bc4cb175..e394bb0686511131f91fefeb4133e66ac829c60b 100644 --- a/silkaj/auth.py +++ b/silkaj/auth.py @@ -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( diff --git a/silkaj/blockchain/difficulty.py b/silkaj/blockchain/difficulty.py index a0faaa950caebc67b781258b4f597916c0503521..6576c6cae188523384fe9d6900b67a9e6c13258f 100644 --- a/silkaj/blockchain/difficulty.py +++ b/silkaj/blockchain/difficulty.py @@ -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) diff --git a/silkaj/money/history.py b/silkaj/money/history.py index d1a35ae020d5ee6f0ef8f7ab77a9e6334e06b5e9..748f2775653e96bcd0abca69c9c6c81d76a32e9d 100644 --- a/silkaj/money/history.py +++ b/silkaj/money/history.py @@ -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 diff --git a/silkaj/wot/lookup.py b/silkaj/wot/lookup.py index b8fb81a23cd4ca24b91a55fb11481715b2922ccb..62537082f5ce34f2fa6ef8336ba7c80bdc9acf52 100644 --- a/silkaj/wot/lookup.py +++ b/silkaj/wot/lookup.py @@ -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) diff --git a/silkaj/wot/status.py b/silkaj/wot/status.py index 0f1db8cf2ae73fb64d74ea1f99518cdb50e4459b..e0fb2630883c341a45fd5e9e662800d7205ba7ed 100644 --- a/silkaj/wot/status.py +++ b/silkaj/wot/status.py @@ -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)