build(deps): bump ruff from 0.15.21 to 0.16.0 (#21238)

* build(deps): bump ruff from 0.15.21 to 0.16.0

Bumps [ruff](https://github.com/astral-sh/ruff) from 0.15.21 to 0.16.0.
- [Release notes](https://github.com/astral-sh/ruff/releases)
- [Changelog](https://github.com/astral-sh/ruff/blob/main/CHANGELOG.md)
- [Commits](https://github.com/astral-sh/ruff/compare/0.15.21...0.16.0)

---
updated-dependencies:
- dependency-name: ruff
  dependency-version: 0.16.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>

* affect changes

* Restrict formtting to chia/tools/benchmarks

* Fix generated protocol files

* more noqa

* network protocol files

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Matt <quexington@gmail.com>
This commit is contained in:
dependabot[bot]
2026-08-06 09:34:35 -07:00
committed by GitHub
co-authored by dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Matt
parent fec92d5b2b
commit 67cdfcda41
49 changed files with 133 additions and 131 deletions
+1 -1
View File
@@ -129,7 +129,7 @@ jobs:
- major_dot_minor: "3.12"
check:
- name: ruff
command: ruff format --check --diff .
command: ruff format --check --diff chia benchmarks tools
- name: generated protocol tests
command: |
python3 -m chia._tests.util.build_network_protocol_files
+3 -3
View File
@@ -218,7 +218,7 @@ def compare_results(
if data not in old:
continue
print(f"\ncompare: {data}, old: {old_commit_hash}, new: {new_commit_hash}")
print_compare_row("mode", "µs/iteration old", "µs/iteration new", "diff %") # noqa: RUF001
print_compare_row("mode", "µs/iteration old", "µs/iteration new", "diff %") # ruff: ignore[ambiguous-unicode-character-string]
for mode, results in modes.items():
if mode not in old[data]:
continue
@@ -247,8 +247,8 @@ def run(data: Data, mode: Mode, runs: int, ms: int, live: bool, output: TextIO,
)
print_row(
mode="mode",
us_per_iteration="µs/iteration", # noqa: RUF001
stdev_us_per_iteration="stdev µs/iteration %", # noqa: RUF001
us_per_iteration="µs/iteration", # ruff: ignore[ambiguous-unicode-character-string]
stdev_us_per_iteration="stdev µs/iteration %", # ruff: ignore[ambiguous-unicode-character-string]
avg_iterations="avg iterations/run",
stdev_iterations="stdev iterations/run %",
)
@@ -62,7 +62,7 @@ def test_deserialization_simple_list() -> None:
def test_deserialization_password_coin() -> None:
# (i (= (sha256 2) (q 0x2cf24dba5fb0a30e26e83b2ac5b9e29e1b161e5c1fa7425e73043362938b9824)) (c (q 51) (c 5 (c (q 100) (q ())))) (q "wrong password")) # noqa
# (i (= (sha256 2) (q 0x2cf24dba5fb0a30e26e83b2ac5b9e29e1b161e5c1fa7425e73043362938b9824)) (c (q 51) (c 5 (c (q 100) (q ())))) (q "wrong password")) # ruff: ignore[line-too-long]
b = hexstr_to_bytes(
"ff04ffff0affff0bff0280ffff01ffa02cf24dba5fb0a30e26e83b2ac5b9e29e1b161e5c1fa7425e73043362938b98248080ffff05ffff01ff3380ffff05ff05ffff05ffff01ff6480ffff01ff8080808080ffff01ff8e77726f6e672070617373776f72648080"
)
@@ -73,7 +73,7 @@ def test_deserialization_password_coin() -> None:
def test_deserialization_large_numbers() -> None:
# '(99999999999999999999999999999999999999999999999999999999999999999 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF -99999999999999999999999999999999999999999999999999999999999999999999999999999)' # noqa
# '(99999999999999999999999999999999999999999999999999999999999999999 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF -99999999999999999999999999999999999999999999999999999999999999999999999999999)' # ruff: ignore[line-too-long]
b = hexstr_to_bytes(
"ff9c00f316271c7fc3908a8bef464e3945ef7a253609ffffffffffffffffffb00fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffa1ff22ea0179500526edb610f148ec0c614155678491902d6000000000000000000180"
)
+1 -1
View File
@@ -14,7 +14,7 @@ from chia_rs.sized_ints import uint64
from click.testing import CliRunner
from chia._tests.environments.wallet import STANDARD_TX_ENDPOINT_ARGS, WalletTestFramework
from chia._tests.wallet.conftest import * # noqa
from chia._tests.wallet.conftest import * # ruff: ignore[undefined-local-with-import-star]
from chia.cmds.cmd_classes import ChiaCliContext, ChiaCommand, chia_command, option
from chia.cmds.cmd_helpers import (
_TRANSACTION_ENDPOINT_DECORATOR_APPLIED,
+1 -1
View File
@@ -1,4 +1,4 @@
# ruff: noqa: E402 # See imports after multiprocessing.set_start_method
# ruff: file-ignore[module-import-not-at-top-of-file] # See imports after multiprocessing.set_start_method
from __future__ import annotations
import asyncio
File diff suppressed because one or more lines are too long
+1 -1
View File
@@ -158,7 +158,7 @@ class ChiaRoot:
kwargs["stderr"] = stderr
try:
return subprocess.run(*final_args, **kwargs) # noqa: PLW1510
return subprocess.run(*final_args, **kwargs) # ruff: ignore[subprocess-run-without-check]
except OSError as e:
raise Exception(f"failed to run:\n {final_args}\n {kwargs}") from e
@@ -65,8 +65,8 @@ async def test_lookup_coin_ids(bt: BlockTools, empty_blockchain: Blockchain) ->
scs = StateChangeSummary(br, uint32(0), [], removals, additions, rewards)
# Removal ID and addition PH
has_coin_sub = lambda c: c == coin_ids[1] # noqa: E731
has_ph_sub = lambda ph: ph == phs[4] # noqa: E731
has_coin_sub = lambda c: c == coin_ids[1] # ruff: ignore[lambda-assignment]
has_ph_sub = lambda ph: ph == phs[4] # ruff: ignore[lambda-assignment]
_, lookup_coin_ids = get_hints_and_subscription_coin_ids(scs, has_coin_sub, has_ph_sub)
@@ -75,8 +75,8 @@ async def test_lookup_coin_ids(bt: BlockTools, empty_blockchain: Blockchain) ->
assert set(lookup_coin_ids) == {coin_ids[1], first_coin_id, second_coin_id}
# Removal PH and addition ID
has_coin_sub = lambda c: c == first_coin_id # noqa: E731
has_ph_sub = lambda ph: ph == phs[0] # noqa: E731
has_coin_sub = lambda c: c == first_coin_id # ruff: ignore[lambda-assignment]
has_ph_sub = lambda ph: ph == phs[0] # ruff: ignore[lambda-assignment]
_, lookup_coin_ids = get_hints_and_subscription_coin_ids(scs, has_coin_sub, has_ph_sub)
assert set(lookup_coin_ids) == {first_coin_id, coin_ids[0], coin_ids[2]}
@@ -84,19 +84,19 @@ async def test_lookup_coin_ids(bt: BlockTools, empty_blockchain: Blockchain) ->
# Subscribe to hint
third_coin_id: bytes32 = Coin(bytes32(coin_ids[2]), phs[9], uint64(123)).name()
has_ph_sub = lambda ph: ph == bytes32(b"1" * 32) # noqa: E731
has_ph_sub = lambda ph: ph == bytes32(b"1" * 32) # ruff: ignore[lambda-assignment]
_, lookup_coin_ids = get_hints_and_subscription_coin_ids(scs, no_sub, has_ph_sub)
assert set(lookup_coin_ids) == {first_coin_id, third_coin_id}
# Reward PH
has_ph_sub = lambda ph: ph == rewards[0].puzzle_hash # noqa: E731
has_ph_sub = lambda ph: ph == rewards[0].puzzle_hash # ruff: ignore[lambda-assignment]
_, lookup_coin_ids = get_hints_and_subscription_coin_ids(scs, no_sub, has_ph_sub)
assert set(lookup_coin_ids) == {rewards[0].name(), rewards[2].name()}
# Reward coin id + reward ph
has_coin_sub = lambda c: c == rewards[1].name() # noqa: E731
has_coin_sub = lambda c: c == rewards[1].name() # ruff: ignore[lambda-assignment]
_, lookup_coin_ids = get_hints_and_subscription_coin_ids(scs, has_coin_sub, has_ph_sub)
assert set(lookup_coin_ids) == {rewards[1].name(), rewards[0].name(), rewards[2].name()}
+9 -9
View File
@@ -2242,7 +2242,7 @@ def generator_condition_tester(
height: uint32,
coin_amount: int = 123,
) -> NPCResult:
prg = f"(q ((0x0101010101010101010101010101010101010101010101010101010101010101 {'(q ' if quote else ''} {conditions} {')' if quote else ''} {coin_amount} (() (q . ())))))" # noqa
prg = f"(q ((0x0101010101010101010101010101010101010101010101010101010101010101 {'(q ' if quote else ''} {conditions} {')' if quote else ''} {coin_amount} (() (q . ())))))" # ruff: ignore[line-too-long]
print(f"program: {prg}")
program = SerializedProgram.from_bytes(binutils.assemble(prg).as_bin())
generator = BlockGenerator(program, [])
@@ -2499,7 +2499,7 @@ class TestGeneratorConditions:
puzzle_hash = "abababababababababababababababab"
program = SerializedProgram.from_bytes(
binutils.assemble(
f'(q ((0x0101010101010101010101010101010101010101010101010101010101010101 (q (51 "{puzzle_hash}" 10)) 123 (() (q . ())))(0x0101010101010101010101010101010101010101010101010101010101010102 (q (51 "{puzzle_hash}" 10)) 123 (() (q . ()))) ))' # noqa
f'(q ((0x0101010101010101010101010101010101010101010101010101010101010101 (q (51 "{puzzle_hash}" 10)) 123 (() (q . ())))(0x0101010101010101010101010101010101010101010101010101010101010102 (q (51 "{puzzle_hash}" 10)) 123 (() (q . ()))) ))' # ruff: ignore[line-too-long]
).as_bin()
)
generator = BlockGenerator(program, [])
@@ -2623,7 +2623,7 @@ class TestGeneratorConditions:
# )
# with A=28 and B specified as {num}
SINGLE_ARG_INT_COND = "(a (q 2 4 (c 2 (c (c (q . {opcode}) (c (concat (a 6 (c 2 (c (q . {filler}) (c 5 ())))) (q . {val})) ())) (c 11 ())))) (c (q (a (i 11 (q 4 5 (a 4 (c 2 (c 5 (c (- 11 (q . 1)) ()))))) ()) 1) 2 (i 11 (q 2 6 (c 2 (c (concat 5 5) (c (- 11 (q . 1)) ())))) (q . 5)) 1) (q 28 {num})))" # noqa
SINGLE_ARG_INT_COND = "(a (q 2 4 (c 2 (c (c (q . {opcode}) (c (concat (a 6 (c 2 (c (q . {filler}) (c 5 ())))) (q . {val})) ())) (c 11 ())))) (c (q (a (i 11 (q 4 5 (a 4 (c 2 (c 5 (c (- 11 (q . 1)) ()))))) ()) 1) 2 (i 11 (q 2 6 (c 2 (c (concat 5 5) (c (- 11 (q . 1)) ())))) (q . 5)) 1) (q 28 {num})))" # ruff: ignore[line-too-long]
# this program:
# (mod (A B)
@@ -2638,7 +2638,7 @@ SINGLE_ARG_INT_COND = "(a (q 2 4 (c 2 (c (c (q . {opcode}) (c (concat (a 6 (c 2
# truncates the first byte of the large string being passed down for each
# iteration, in an attempt to defeat any caching of integers by node ID.
# substr is cheap, and no memory is copied, so we can perform a lot of these
SINGLE_ARG_INT_SUBSTR_COND = "(a (q 2 4 (c 2 (c (concat (a 6 (c 2 (c (q . {filler}) (c 5 ())))) (q . {val})) (c 11 ())))) (c (q (a (i 11 (q 4 (c (q . {opcode}) (c 5 ())) (a 4 (c 2 (c (substr 5 (q . 1)) (c (- 11 (q . 1)) ()))))) ()) 1) 2 (i 11 (q 2 6 (c 2 (c (concat 5 5) (c (- 11 (q . 1)) ())))) (q . 5)) 1) (q 28 {num})))" # noqa
SINGLE_ARG_INT_SUBSTR_COND = "(a (q 2 4 (c 2 (c (concat (a 6 (c 2 (c (q . {filler}) (c 5 ())))) (q . {val})) (c 11 ())))) (c (q (a (i 11 (q 4 (c (q . {opcode}) (c 5 ())) (a 4 (c 2 (c (substr 5 (q . 1)) (c (- 11 (q . 1)) ()))))) ()) 1) 2 (i 11 (q 2 6 (c 2 (c (concat 5 5) (c (- 11 (q . 1)) ())))) (q . 5)) 1) (q 28 {num})))" # ruff: ignore[line-too-long]
# this program:
# (mod (A B)
@@ -2650,7 +2650,7 @@ SINGLE_ARG_INT_SUBSTR_COND = "(a (q 2 4 (c 2 (c (concat (a 6 (c 2 (c (q . {fille
# )
# (iter (concat (large_string 0x00 A) (q . 0xffffffff)) B)
# )
SINGLE_ARG_INT_SUBSTR_TAIL_COND = "(a (q 2 4 (c 2 (c (concat (a 6 (c 2 (c (q . {filler}) (c 5 ())))) (q . {val})) (c 11 ())))) (c (q (a (i 11 (q 4 (c (q . {opcode}) (c 5 ())) (a 4 (c 2 (c (substr 5 () (- (strlen 5) (q . 1))) (c (- 11 (q . 1)) ()))))) ()) 1) 2 (i 11 (q 2 6 (c 2 (c (concat 5 5) (c (- 11 (q . 1)) ())))) (q . 5)) 1) (q 25 {num})))" # noqa
SINGLE_ARG_INT_SUBSTR_TAIL_COND = "(a (q 2 4 (c 2 (c (concat (a 6 (c 2 (c (q . {filler}) (c 5 ())))) (q . {val})) (c 11 ())))) (c (q (a (i 11 (q 4 (c (q . {opcode}) (c 5 ())) (a 4 (c 2 (c (substr 5 () (- (strlen 5) (q . 1))) (c (- 11 (q . 1)) ()))))) ()) 1) 2 (i 11 (q 2 6 (c 2 (c (concat 5 5) (c (- 11 (q . 1)) ())))) (q . 5)) 1) (q 25 {num})))" # ruff: ignore[line-too-long]
# (mod (A B)
# (defun large_string (V N)
@@ -2661,7 +2661,7 @@ SINGLE_ARG_INT_SUBSTR_TAIL_COND = "(a (q 2 4 (c 2 (c (concat (a 6 (c 2 (c (q . {
# )
# (iter (large_string 0x00 A) B)
# )
SINGLE_ARG_INT_LADDER_COND = "(a (q 2 4 (c 2 (c (a 6 (c 2 (c (q . {filler}) (c 5 ())))) (c 11 ())))) (c (q (a (i 11 (q 4 (c (q . {opcode}) (c (concat 5 11) ())) (a 4 (c 2 (c 5 (c (- 11 (q . 1)) ()))))) ()) 1) 2 (i 11 (q 2 6 (c 2 (c (concat 5 5) (c (- 11 (q . 1)) ())))) (q . 5)) 1) (q 24 {num})))" # noqa
SINGLE_ARG_INT_LADDER_COND = "(a (q 2 4 (c 2 (c (a 6 (c 2 (c (q . {filler}) (c 5 ())))) (c 11 ())))) (c (q (a (i 11 (q 4 (c (q . {opcode}) (c (concat 5 11) ())) (a 4 (c 2 (c 5 (c (- 11 (q . 1)) ()))))) ()) 1) 2 (i 11 (q 2 6 (c 2 (c (concat 5 5) (c (- 11 (q . 1)) ())))) (q . 5)) 1) (q 24 {num})))" # ruff: ignore[line-too-long]
# this program:
# (mod (A B)
@@ -2675,7 +2675,7 @@ SINGLE_ARG_INT_LADDER_COND = "(a (q 2 4 (c 2 (c (a 6 (c 2 (c (q . {filler}) (c 5
# )
# with B set to {num}
CREATE_ANNOUNCE_COND = "(a (q 2 4 (c 2 (c (c (q . {opcode}) (c (a 6 (c 2 (c 5 ()))) ())) (c 11 ())))) (c (q (a (i 11 (q 4 5 (a 4 (c 2 (c 5 (c (- 11 (q . 1)) ()))))) ()) 1) 23 (q . 97) 5) (q 8184 {num})))" # noqa
CREATE_ANNOUNCE_COND = "(a (q 2 4 (c 2 (c (c (q . {opcode}) (c (a 6 (c 2 (c 5 ()))) ())) (c 11 ())))) (c (q (a (i 11 (q 4 5 (a 4 (c 2 (c 5 (c (- 11 (q . 1)) ()))))) ()) 1) 23 (q . 97) 5) (q 8184 {num})))" # ruff: ignore[line-too-long]
# this program:
# (mod (A)
@@ -2684,7 +2684,7 @@ CREATE_ANNOUNCE_COND = "(a (q 2 4 (c 2 (c (c (q . {opcode}) (c (a 6 (c 2 (c 5 ()
# )
# (iter (q 51 "abababababababababababababababab" 1) A)
# )
CREATE_COIN = '(a (q 2 2 (c 2 (c (q 51 "abababababababababababababababab" 1) (c 5 ())))) (c (q 2 (i 11 (q 4 5 (a 2 (c 2 (c 5 (c (- 11 (q . 1)) ()))))) ()) 1) (q {num})))' # noqa
CREATE_COIN = '(a (q 2 2 (c 2 (c (q 51 "abababababababababababababababab" 1) (c 5 ())))) (c (q 2 (i 11 (q 4 5 (a 2 (c 2 (c 5 (c (- 11 (q . 1)) ()))))) ()) 1) (q {num})))' # ruff: ignore[line-too-long]
# this program:
# (mod (A)
@@ -2700,7 +2700,7 @@ CREATE_COIN = '(a (q 2 2 (c 2 (c (q 51 "abababababababababababababababab" 1) (c
# (iter (q 51 "abababababababababababababababab") A)
# )
# creates {num} CREATE_COIN conditions, each with a different amount
CREATE_UNIQUE_COINS = '(a (q 2 6 (c 2 (c (q 51 "abababababababababababababababab") (c 5 ())))) (c (q (a (i 5 (q 4 9 (a 4 (c 2 (c 13 (c 11 ()))))) (q 4 11 ())) 1) 2 (i 11 (q 4 (a 4 (c 2 (c 5 (c 11 ())))) (a 6 (c 2 (c 5 (c (- 11 (q . 1)) ()))))) ()) 1) (q {num})))' # noqa
CREATE_UNIQUE_COINS = '(a (q 2 6 (c 2 (c (q 51 "abababababababababababababababab") (c 5 ())))) (c (q (a (i 5 (q 4 9 (a 4 (c 2 (c 13 (c 11 ()))))) (q 4 11 ())) 1) 2 (i 11 (q 4 (a 4 (c 2 (c 5 (c 11 ())))) (a 6 (c 2 (c 5 (c (- 11 (q . 1)) ()))))) ()) 1) (q {num})))' # ruff: ignore[line-too-long]
# some of the malicious tests will fail post soft-fork, this function helps test
+1 -1
View File
@@ -58,7 +58,7 @@ async def main() -> None:
async def dun() -> None:
# TODO: switch to event driven code
while shutdown_path.exists(): # noqa: ASYNC110
while shutdown_path.exists(): # ruff: ignore[async-busy-wait]
await asyncio.sleep(0.25)
task.cancel()
+2 -2
View File
@@ -80,7 +80,7 @@ async def async_main(
async def dun() -> None:
# TODO: switch to event driven code
while shutdown_path.exists(): # noqa: ASYNC110
while shutdown_path.exists(): # ruff: ignore[async-busy-wait]
await asyncio.sleep(0.25)
thread_end_event.set()
@@ -98,7 +98,7 @@ async def async_main(
try:
try:
# TODO: switch to event driven code
while not thread_end_event.is_set(): # noqa: ASYNC110
while not thread_end_event.is_set(): # ruff: ignore[async-busy-wait]
await asyncio.sleep(0.1)
finally:
# the test checks explicitly for this
+6 -6
View File
@@ -31,18 +31,18 @@ def test_base_event_loop_has_methods() -> None:
method = getattr(base_selector_event_loop, "create_server")
assert inspect.ismethod(method)
if sys.version_info >= (3, 13):
expected_signature = "(protocol_factory, host=None, port=None, *, family=<AddressFamily.AF_UNSPEC: 0>, flags=<AddressInfo.AI_PASSIVE: 1>, sock=None, backlog=100, ssl=None, reuse_address=None, reuse_port=None, keep_alive=None, ssl_handshake_timeout=None, ssl_shutdown_timeout=None, start_serving=True)" # noqa: E501
expected_signature = "(protocol_factory, host=None, port=None, *, family=<AddressFamily.AF_UNSPEC: 0>, flags=<AddressInfo.AI_PASSIVE: 1>, sock=None, backlog=100, ssl=None, reuse_address=None, reuse_port=None, keep_alive=None, ssl_handshake_timeout=None, ssl_shutdown_timeout=None, start_serving=True)" # ruff: ignore[line-too-long]
elif sys.version_info >= (3, 11):
expected_signature = "(protocol_factory, host=None, port=None, *, family=<AddressFamily.AF_UNSPEC: 0>, flags=<AddressInfo.AI_PASSIVE: 1>, sock=None, backlog=100, ssl=None, reuse_address=None, reuse_port=None, ssl_handshake_timeout=None, ssl_shutdown_timeout=None, start_serving=True)" # noqa: E501
expected_signature = "(protocol_factory, host=None, port=None, *, family=<AddressFamily.AF_UNSPEC: 0>, flags=<AddressInfo.AI_PASSIVE: 1>, sock=None, backlog=100, ssl=None, reuse_address=None, reuse_port=None, ssl_handshake_timeout=None, ssl_shutdown_timeout=None, start_serving=True)" # ruff: ignore[line-too-long]
else:
expected_signature = "(protocol_factory, host=None, port=None, *, family=<AddressFamily.AF_UNSPEC: 0>, flags=<AddressInfo.AI_PASSIVE: 1>, sock=None, backlog=100, ssl=None, reuse_address=None, reuse_port=None, ssl_handshake_timeout=None, start_serving=True)" # noqa: E501
expected_signature = "(protocol_factory, host=None, port=None, *, family=<AddressFamily.AF_UNSPEC: 0>, flags=<AddressInfo.AI_PASSIVE: 1>, sock=None, backlog=100, ssl=None, reuse_address=None, reuse_port=None, ssl_handshake_timeout=None, start_serving=True)" # ruff: ignore[line-too-long]
assert str(inspect.signature(method)) == expected_signature
assert hasattr(base_selector_event_loop, "_start_serving")
method = getattr(base_selector_event_loop, "_start_serving")
assert inspect.ismethod(method)
if sys.version_info >= (3, 11):
expected_signature = "(protocol_factory, sock, sslcontext=None, server=None, backlog=100, ssl_handshake_timeout=60.0, ssl_shutdown_timeout=30.0)" # noqa: E501
expected_signature = "(protocol_factory, sock, sslcontext=None, server=None, backlog=100, ssl_handshake_timeout=60.0, ssl_shutdown_timeout=30.0)" # ruff: ignore[line-too-long]
else:
expected_signature = (
"(protocol_factory, sock, sslcontext=None, server=None, backlog=100, ssl_handshake_timeout=60.0)"
@@ -60,11 +60,11 @@ def test_base_event_loop_has_methods() -> None:
assert inspect.ismethod(method)
assert (
inspect.getsource(method)
== " async def create_server(self, *args, **kwargs) -> PausableServer: # type: ignore[no-untyped-def]\n return await _chia_create_server(super(), *args, **kwargs)\n" # noqa: E501
== " async def create_server(self, *args, **kwargs) -> PausableServer: # type: ignore[no-untyped-def]\n return await _chia_create_server(super(), *args, **kwargs)\n" # ruff: ignore[line-too-long]
)
assert inspect.isfunction(_chia_create_server)
expected_signature = "(cls: 'Any', protocol_factory: '_ProtocolFactory', host: 'Any', port: 'Any', *, family: 'socket.AddressFamily' = <AddressFamily.AF_UNSPEC: 0>, flags: 'socket.AddressInfo' = <AddressInfo.AI_PASSIVE: 1>, sock: 'Any' = None, backlog: 'int' = 100, ssl: '_SSLContext' = None, reuse_address: 'bool | None' = None, reuse_port: 'bool | None' = None, ssl_handshake_timeout: 'float | None' = 30, start_serving: 'bool' = True) -> 'PausableServer'" # noqa: E501
expected_signature = "(cls: 'Any', protocol_factory: '_ProtocolFactory', host: 'Any', port: 'Any', *, family: 'socket.AddressFamily' = <AddressFamily.AF_UNSPEC: 0>, flags: 'socket.AddressInfo' = <AddressInfo.AI_PASSIVE: 1>, sock: 'Any' = None, backlog: 'int' = 100, ssl: '_SSLContext' = None, reuse_address: 'bool | None' = None, reuse_port: 'bool | None' = None, ssl_handshake_timeout: 'float | None' = 30, start_serving: 'bool' = True) -> 'PausableServer'" # ruff: ignore[line-too-long]
assert str(inspect.signature(_chia_create_server)) == expected_signature
class EchoProtocol(asyncio.Protocol):
+2 -2
View File
@@ -166,7 +166,7 @@ async def test_loop(tmp_path: pathlib.Path) -> None:
logger.info(" ==== launching serve.py")
# TODO: is there some reason not to use an async process here?
with subprocess.Popen( # noqa: ASYNC220
with subprocess.Popen( # ruff: ignore[create-subprocess-in-async-function]
[sys.executable, "-m", "chia._tests.core.server.serve", os.fspath(serve_file)],
):
logger.info(" ==== serve.py running")
@@ -175,7 +175,7 @@ async def test_loop(tmp_path: pathlib.Path) -> None:
logger.info(" ==== launching flood.py")
# TODO: is there some reason not to use an async process here?
with subprocess.Popen( # noqa: ASYNC220
with subprocess.Popen( # ruff: ignore[create-subprocess-in-async-function]
[sys.executable, "-m", "chia._tests.core.server.flood", os.fspath(flood_file)],
):
logger.info(" ==== flood.py running")
+1 -1
View File
@@ -218,7 +218,7 @@ async def test_connection_string_conversion(
_, _, server_1, server_2, _ = two_nodes_one_block
peer = await connect_and_get_peer(server_1, server_2, self_hostname)
# 1100 is based on the current implementation (example below), should be reconsidered/adjusted if this test fails
# WSChiaConnection(local_type=<NodeType.FULL_NODE: 1>, local_port=50632, local_capabilities=[<Capability.BASE: 1>, <Capability.BLOCK_HEADERS: 2>, <Capability.RATE_LIMITS_V2: 3>, <Capability.MEMPOOL_UPDATES: 5>, <Capability.HARD_FORK_2: 6>], peer_info=PeerInfo(_ip=IPv4Address('127.0.0.1'), _port=50640), peer_node_id=<bytes32: 566a318f0f656125b4fef0e85fbddcf9bc77f8003d35293c392479fc5d067f4d>, outbound_rate_limiter=<chia.server.rate_limits.RateLimiter object at 0x114a13f50>, inbound_rate_limiter=<chia.server.rate_limits.RateLimiter object at 0x114a13e90>, is_outbound=False, creation_time=1675271096.275591, bytes_read=68, bytes_written=162, last_message_time=1675271096.276271, peer_server_port=50636, closed=False, connection_type=<NodeType.FULL_NODE: 1>, request_nonce=32768, peer_capabilities=[<Capability.BASE: 1>, <Capability.BLOCK_HEADERS: 2>, <Capability.RATE_LIMITS_V2: 3>, <Capability.MEMPOOL_UPDATES: 5>, <Capability.HARD_FORK_2: 6>], version='', protocol_version=<Version('0.0.36')>) # noqa
# WSChiaConnection(local_type=<NodeType.FULL_NODE: 1>, local_port=50632, local_capabilities=[<Capability.BASE: 1>, <Capability.BLOCK_HEADERS: 2>, <Capability.RATE_LIMITS_V2: 3>, <Capability.MEMPOOL_UPDATES: 5>, <Capability.HARD_FORK_2: 6>], peer_info=PeerInfo(_ip=IPv4Address('127.0.0.1'), _port=50640), peer_node_id=<bytes32: 566a318f0f656125b4fef0e85fbddcf9bc77f8003d35293c392479fc5d067f4d>, outbound_rate_limiter=<chia.server.rate_limits.RateLimiter object at 0x114a13f50>, inbound_rate_limiter=<chia.server.rate_limits.RateLimiter object at 0x114a13e90>, is_outbound=False, creation_time=1675271096.275591, bytes_read=68, bytes_written=162, last_message_time=1675271096.276271, peer_server_port=50636, closed=False, connection_type=<NodeType.FULL_NODE: 1>, request_nonce=32768, peer_capabilities=[<Capability.BASE: 1>, <Capability.BLOCK_HEADERS: 2>, <Capability.RATE_LIMITS_V2: 3>, <Capability.MEMPOOL_UPDATES: 5>, <Capability.HARD_FORK_2: 6>], version='', protocol_version=<Version('0.0.36')>) # ruff: ignore[line-too-long]
converted = method(peer)
print(converted)
assert len(converted) < 1200
+6 -6
View File
@@ -183,7 +183,7 @@ class TestKeychain:
# This must be compared to a tuple because the `.mnemonic` property is a list which makes the
# class unhashable. We should eventually add support in streamable for varadic tuples and maybe remove
# support for the mutable `list`.
key_data in (key_data_0, key_data_1, key_data_2) # noqa: PLR6201
key_data in (key_data_0, key_data_1, key_data_2) # ruff: ignore[literal-membership]
for key_data in keychain.get_keys(include_secrets=True)
)
@@ -235,10 +235,10 @@ class TestKeychain:
# Copyright (c) 2017 mruddy
# https://github.com/trezor/python-mnemonic/blob/master/tests/test_mnemonic.py
# The same sentence in various UTF-8 forms
words_nfkd = "Pr\u030ci\u0301s\u030cerne\u030c z\u030clut\u030couc\u030cky\u0301 ku\u030an\u030c u\u0301pe\u030cl d\u030ca\u0301belske\u0301 o\u0301dy za\u0301ker\u030cny\u0301 uc\u030cen\u030c be\u030cz\u030ci\u0301 pode\u0301l zo\u0301ny u\u0301lu\u030a" # noqa: E501
words_nfc = "P\u0159\xed\u0161ern\u011b \u017elu\u0165ou\u010dk\xfd k\u016f\u0148 \xfap\u011bl \u010f\xe1belsk\xe9 \xf3dy z\xe1ke\u0159n\xfd u\u010de\u0148 b\u011b\u017e\xed pod\xe9l z\xf3ny \xfal\u016f" # noqa: E501
words_nfkc = "P\u0159\xed\u0161ern\u011b \u017elu\u0165ou\u010dk\xfd k\u016f\u0148 \xfap\u011bl \u010f\xe1belsk\xe9 \xf3dy z\xe1ke\u0159n\xfd u\u010de\u0148 b\u011b\u017e\xed pod\xe9l z\xf3ny \xfal\u016f" # noqa: E501
words_nfd = "Pr\u030ci\u0301s\u030cerne\u030c z\u030clut\u030couc\u030cky\u0301 ku\u030an\u030c u\u0301pe\u030cl d\u030ca\u0301belske\u0301 o\u0301dy za\u0301ker\u030cny\u0301 uc\u030cen\u030c be\u030cz\u030ci\u0301 pode\u0301l zo\u0301ny u\u0301lu\u030a" # noqa: E501
words_nfkd = "Pr\u030ci\u0301s\u030cerne\u030c z\u030clut\u030couc\u030cky\u0301 ku\u030an\u030c u\u0301pe\u030cl d\u030ca\u0301belske\u0301 o\u0301dy za\u0301ker\u030cny\u0301 uc\u030cen\u030c be\u030cz\u030ci\u0301 pode\u0301l zo\u0301ny u\u0301lu\u030a" # ruff: ignore[line-too-long]
words_nfc = "P\u0159\xed\u0161ern\u011b \u017elu\u0165ou\u010dk\xfd k\u016f\u0148 \xfap\u011bl \u010f\xe1belsk\xe9 \xf3dy z\xe1ke\u0159n\xfd u\u010de\u0148 b\u011b\u017e\xed pod\xe9l z\xf3ny \xfal\u016f" # ruff: ignore[line-too-long]
words_nfkc = "P\u0159\xed\u0161ern\u011b \u017elu\u0165ou\u010dk\xfd k\u016f\u0148 \xfap\u011bl \u010f\xe1belsk\xe9 \xf3dy z\xe1ke\u0159n\xfd u\u010de\u0148 b\u011b\u017e\xed pod\xe9l z\xf3ny \xfal\u016f" # ruff: ignore[line-too-long]
words_nfd = "Pr\u030ci\u0301s\u030cerne\u030c z\u030clut\u030couc\u030cky\u0301 ku\u030an\u030c u\u0301pe\u030cl d\u030ca\u0301belske\u0301 o\u0301dy za\u0301ker\u030cny\u0301 uc\u030cen\u030c be\u030cz\u030ci\u0301 pode\u0301l zo\u0301ny u\u0301lu\u030a" # ruff: ignore[line-too-long]
seed_nfkd = mnemonic_to_seed(words_nfkd)
seed_nfc = mnemonic_to_seed(words_nfc)
@@ -435,7 +435,7 @@ async def test_set_label(get_temp_keyring: Keychain) -> None:
# This must be compared to a tuple because the `.mnemonic` property is a list which makes the
# class unhashable. We should eventually add support in streamable for varadic tuples and maybe remove
# support for the mutable `list`.
assert all(key_data in (key_data_0, key_data_1) for key_data in keychain.get_keys(include_secrets=True)) # noqa: PLR6201
assert all(key_data in (key_data_0, key_data_1) for key_data in keychain.get_keys(include_secrets=True)) # ruff: ignore[literal-membership]
@pytest.mark.parametrize(
+3 -3
View File
@@ -1616,12 +1616,12 @@ async def test_farmer_to_pool_protocol(
path = str(URL(url).path).rstrip("/")
if path.endswith("/auth"):
assert method == "GET"
yield DummyAuthResponse(ok=True) # noqa: RUF075
yield DummyAuthResponse(ok=True) # ruff: ignore[fallible-context-manager]
if path.endswith("/farmer"):
if method == "POST":
yield DummyPostFarmerResponse(ok=True) # noqa: RUF075
yield DummyPostFarmerResponse(ok=True) # ruff: ignore[fallible-context-manager]
if method == "PUT":
yield DummyPutFarmerResponse(ok=True) # noqa: RUF075
yield DummyPutFarmerResponse(ok=True) # ruff: ignore[fallible-context-manager]
if method == "GET":
yield DummyGetFarmerResponse(ok=True)
+1 -1
View File
@@ -1,4 +1,4 @@
# ruff: noqa: E501
# ruff: file-ignore[line-too-long]
from __future__ import annotations
import io
+2 -2
View File
@@ -208,7 +208,7 @@ def output_benchmark(
else:
output.write("# Benchmark Metrics\n\n")
output.write("| Test | 🍿 | Mean | Max | 3σ | Limit | Percent |\n") # noqa: RUF001
output.write("| Test | 🍿 | Mean | Max | 3σ | Limit | Percent |\n") # ruff: ignore[ambiguous-unicode-character-string]
output.write("| --- | --- | --- | --- | --- | --- | --- |\n")
for result in sorted(results):
link_url = result.link(prefix=link_prefix, line_separator=link_line_separator)
@@ -285,7 +285,7 @@ def output_time_out_assert(
else:
output.write("# Time Out Assert Metrics\n\n")
output.write("| Test | 🍿 | Mean | Max | 3σ | Limit | Percent |\n") # noqa: RUF001
output.write("| Test | 🍿 | Mean | Max | 3σ | Limit | Percent |\n") # ruff: ignore[ambiguous-unicode-character-string]
output.write("| --- | --- | --- | --- | --- | --- | --- |\n")
for result in sorted(results):
link_url = result.link(prefix=link_prefix, line_separator=link_line_separator)
+2 -2
View File
@@ -2,7 +2,7 @@ from __future__ import annotations
import contextlib
import os
import pickle # noqa: S403 # TODO: use explicit serialization instead of pickle
import pickle # ruff: ignore[suspicious-pickle-import] # TODO: use explicit serialization instead of pickle
from collections.abc import AsyncIterator
from pathlib import Path
@@ -74,7 +74,7 @@ def persistent_blocks(
try:
bytes_list = file_path.read_bytes()
# TODO: use explicit serialization instead of pickle
block_bytes_list: list[bytes] = pickle.loads(bytes_list) # noqa: S301
block_bytes_list: list[bytes] = pickle.loads(bytes_list) # ruff: ignore[suspicious-pickle-usage]
blocks: list[FullBlock] = []
for block_bytes in block_bytes_list:
blocks.append(FullBlock.from_bytes_unchecked(block_bytes))
@@ -1,4 +1,4 @@
# ruff: noqa: F405
# ruff: file-ignore[undefined-local-with-import-star-usage]
from __future__ import annotations
import os
@@ -10,7 +10,7 @@ from typing import Any
from chia_rs.sized_ints import uint32
from chia._tests.util.network_protocol_data import * # noqa: F403
from chia._tests.util.network_protocol_data import * # ruff: ignore[undefined-local-with-import-star]
version = "1.0"
@@ -196,7 +196,7 @@ def get_protocol_bytes() -> bytes:
def build_protocol_test() -> str:
result = """# ruff: noqa: F405
result = """# ruff: file-ignore[undefined-local-with-import-star-usage]
# this file is generated by build_network_protocol_files.py
from __future__ import annotations
@@ -204,8 +204,8 @@ from __future__ import annotations
from pathlib import Path
from chia._tests.util.build_network_protocol_files import get_network_protocol_filename
from chia._tests.util.network_protocol_data import * # noqa: F403
from chia._tests.util.protocol_messages_json import * # noqa: F403
from chia._tests.util.network_protocol_data import * # ruff: ignore[undefined-local-with-import-star]
from chia._tests.util.protocol_messages_json import * # ruff: ignore[undefined-local-with-import-star]
def parse_blob(input_bytes: bytes) -> tuple[bytes, bytes]:
@@ -246,7 +246,7 @@ def test_protocol_bytes() -> None:
def get_protocol_json() -> str:
result = """# ruff: noqa: E501
result = """# ruff: file-ignore[line-too-long]
# this file is generated by build_network_protocol_files.py
from __future__ import annotations
@@ -266,13 +266,13 @@ from typing import Any
def build_json_test() -> str:
result = """# ruff: noqa: F405
result = """# ruff: file-ignore[undefined-local-with-import-star-usage]
# this file is generated by build_network_protocol_files.py
from __future__ import annotations
from chia._tests.util.network_protocol_data import * # noqa: F403
from chia._tests.util.protocol_messages_json import * # noqa: F403
from chia._tests.util.network_protocol_data import * # ruff: ignore[undefined-local-with-import-star]
from chia._tests.util.protocol_messages_json import * # ruff: ignore[undefined-local-with-import-star]
def test_protocol_json() -> None:
+2 -2
View File
@@ -14,7 +14,7 @@ from __future__ import annotations
import atexit
import logging
import pickle # noqa: S403
import pickle # ruff: ignore[suspicious-pickle-import]
from pathlib import Path
from typing import Any
@@ -50,7 +50,7 @@ def _load_from_disk(path: Path) -> tuple[dict[Any, Any], dict[Any, Any], dict[An
if not path.exists():
return {}, {}, {}
try:
data = pickle.loads(path.read_bytes()) # noqa: S301
data = pickle.loads(path.read_bytes()) # ruff: ignore[suspicious-pickle-usage]
if isinstance(data, tuple) and len(data) == 3:
return data[0], data[1], data[2]
except Exception:
+1 -1
View File
@@ -1,4 +1,4 @@
# ruff: noqa: E501
# ruff: file-ignore[line-too-long]
# this file is generated by build_network_protocol_files.py
from __future__ import annotations
@@ -1,4 +1,4 @@
# ruff: noqa: F405
# ruff: file-ignore[undefined-local-with-import-star-usage]
# this file is generated by build_network_protocol_files.py
from __future__ import annotations
@@ -6,8 +6,8 @@ from __future__ import annotations
from pathlib import Path
from chia._tests.util.build_network_protocol_files import get_network_protocol_filename
from chia._tests.util.network_protocol_data import * # noqa: F403
from chia._tests.util.protocol_messages_json import * # noqa: F403
from chia._tests.util.network_protocol_data import * # ruff: ignore[undefined-local-with-import-star]
from chia._tests.util.protocol_messages_json import * # ruff: ignore[undefined-local-with-import-star]
def parse_blob(input_bytes: bytes) -> tuple[bytes, bytes]:
@@ -1,10 +1,10 @@
# ruff: noqa: F405
# ruff: file-ignore[undefined-local-with-import-star-usage]
# this file is generated by build_network_protocol_files.py
from __future__ import annotations
from chia._tests.util.network_protocol_data import * # noqa: F403
from chia._tests.util.protocol_messages_json import * # noqa: F403
from chia._tests.util.network_protocol_data import * # ruff: ignore[undefined-local-with-import-star]
from chia._tests.util.protocol_messages_json import * # ruff: ignore[undefined-local-with-import-star]
def test_protocol_json() -> None:
+1 -1
View File
@@ -1,6 +1,6 @@
from __future__ import annotations
import pickle # noqa: S403
import pickle # ruff: ignore[suspicious-pickle-import]
from pathlib import Path
from unittest.mock import MagicMock
@@ -214,5 +214,5 @@ pks: [<G1Element aa1a1c26055a329817a5759d877a2795f9499b97d6056edde0eea39512f24e8
msgs: ['0000000000000000000000000000000000000000000000000000000000000000']
add_data: ccd5bb71183532bff220ba46c268991a3ff07eb358e8255a65c30a2dce0e5fbb
signature: a458f8f379a4bec00f36cd38e36790210f0b7c4ee772417c0cd20513d75c7505a0532d220ab03a471e9e255e2c54472a03abd31a9feb56d551bf482e31e48747b04fe90f4e3c2af98a2de0d11f869cde360f93b8efa37ec1c28950aa52bfbacd
""" # noqa: E501
""" # ruff: ignore[line-too-long]
)
File diff suppressed because one or more lines are too long
+1 -1
View File
@@ -207,7 +207,7 @@ def print_min_max_derivation_for_wallets(derivation_paths: list[DerivationPath])
class WalletDBReader:
db_wrapper: DBWrapper2 # TODO: Remove db_wrapper member
# TODO: make this a dataclass and make this an instance attribute instead of a mutable classvar
config = {"db_readers": 1} # noqa: RUF012
config = {"db_readers": 1} # ruff: ignore[mutable-class-default]
sql_log_path: Path | None = None
verbose = False
+1 -1
View File
@@ -34,7 +34,7 @@ from chia.wallet.wallet_spend_bundle import WalletSpendBundle
def _clear_screen() -> None:
# Cross-platform screen clear
# TODO: consider if not-nt anyways could avoid os.system()
os.system("cls" if os.name == "nt" else "clear") # noqa: S605
os.system("cls" if os.name == "nt" else "clear") # ruff: ignore[start-process-with-a-shell]
@click.group("signer", help="Get information for an external signer")
+3 -3
View File
@@ -316,7 +316,7 @@ async def get_transactions(
else:
# Ignoring this because it seems useful to the loop
# But we should probably consider a better loop
j -= 1 # noqa: PLW2901
j -= 1 # ruff: ignore[redefined-loop-name]
skipped += 1
continue
print_transaction(
@@ -664,7 +664,7 @@ async def make_offer(
)
total_amounts_requested[summary["asset"]] += summary["amount"]
print(
f" - {converted_amount} {summary['asset']} ({summary['amount']} mojos) to {summary['address']}" # noqa
f" - {converted_amount} {summary['asset']} ({summary['amount']} mojos) to {summary['address']}" # ruff: ignore[line-too-long]
)
print()
@@ -922,7 +922,7 @@ async def take_offer(
)
total_amounts_requested[summary["asset"]] += summary["amount"]
print(
f" - {converted_amount} {summary['asset']} ({summary['amount']} mojos) to {summary['address']}" # noqa
f" - {converted_amount} {summary['asset']} ({summary['amount']} mojos) to {summary['address']}" # ruff: ignore[line-too-long]
)
print()
+1 -1
View File
@@ -401,7 +401,7 @@ class WebSocketServer:
show_traceback=False,
):
await connection.ping()
except: # noqa E722
except: # ruff: ignore[bare-except] E722
self.remove_connection(connection)
await connection.close()
+1 -1
View File
@@ -352,7 +352,7 @@ class Farmer:
# Wait until the task in `Farmer._start` is done so that we have keys available for the handshake. Bail out
# early if we need to shut down or if the harvester is not longer connected.
# TODO: switch to event driven code
while not self.started and not self._shut_down and peer in self.server.get_connections(): # noqa: ASYNC110
while not self.started and not self._shut_down and peer in self.server.get_connections(): # ruff: ignore[async-busy-wait]
await asyncio.sleep(1)
if self._shut_down:
+1 -1
View File
@@ -201,7 +201,7 @@ class Sender:
start = time.time()
assert self._response is not None
# TODO: switch to event driven code
while time.time() - start < Constants.message_timeout and self._response.message is None: # noqa: ASYNC110
while time.time() - start < Constants.message_timeout and self._response.message is None: # ruff: ignore[async-busy-wait]
await asyncio.sleep(0.1)
return self._response.message is not None
+2 -2
View File
@@ -62,7 +62,7 @@ class PoolingShareState:
loaded_list = []
else:
loaded_list = loaded_content["pooling_information"]
yield loaded_list # noqa: RUF075 # write YAML only on successful exit
yield loaded_list # ruff: ignore[fallible-context-manager] # write YAML only on successful exit
if not read_only:
f.seek(0)
f.truncate()
@@ -106,7 +106,7 @@ class PoolingShareState:
key_derivation_index=config["key_derivation_index"],
version=config.get("version", 1),
)
yield self # noqa: RUF075 # update in-memory entry only on successful exit
yield self # ruff: ignore[fallible-context-manager] # update in-memory entry only on successful exit
for i, conf in enumerate(loaded_list):
if conf["p2_singleton_puzzle_hash"] == p2_singleton_puzzle_hash.hex():
loaded_list[i] = self.to_json_dict()
+1 -1
View File
@@ -167,7 +167,7 @@ def get_seconds_and_delayed_puzhash_from_p2_singleton_puzzle(puzzle: Program) ->
# Verify that a puzzle is a Pool Wallet Singleton
def is_pool_singleton_inner_puzzle(inner_puzzle: Program) -> bool:
inner_f = get_template_singleton_inner_puzzle(inner_puzzle)
return inner_f in (POOL_WAITING_ROOM_MOD, POOL_MEMBER_MOD) # noqa: PLR6201
return inner_f in (POOL_WAITING_ROOM_MOD, POOL_MEMBER_MOD) # ruff: ignore[literal-membership]
def is_pool_waitingroom_inner_puzzle(inner_puzzle: Program) -> bool:
+1 -1
View File
@@ -89,7 +89,7 @@ class UDPDNSServerProtocol(asyncio.DatagramProtocol):
async def respond(self) -> None:
log.info("UDP DNS responder started.")
# TODO: switch to event driven code
while self.transport is None: # we wait for the transport to be set. # noqa: ASYNC110
while self.transport is None: # we wait for the transport to be set. # ruff: ignore[async-busy-wait]
await asyncio.sleep(0.1)
while not self.transport.is_closing():
try:
+2 -2
View File
@@ -275,7 +275,7 @@ if sys.platform == "win32":
async def _chia_accept_loop(self, listener: socket.socket) -> tuple[socket.socket, tuple[object, ...]]:
while True:
# TODO: switch to event drive code
while not self.allow_connections: # noqa: ASYNC110
while not self.allow_connections: # ruff: ignore[async-busy-wait]
await asyncio.sleep(0.01)
try:
@@ -320,7 +320,7 @@ if sys.platform == "win32":
future = self._register(ov, listener, finish_accept)
coro = accept_coro(self, future, conn)
asyncio.ensure_future(coro, loop=self._loop) # noqa: RUF006
asyncio.ensure_future(coro, loop=self._loop) # ruff: ignore[asyncio-dangling-task]
return future
def accept(self, listener: socket.socket) -> asyncio.Future[tuple[socket.socket, tuple[object, ...]]]:
+2 -2
View File
@@ -64,7 +64,7 @@ def ssl_context_for_server(
if check_permissions:
verify_ssl_certs_and_keys([ca_cert, cert_path], [ca_key, key_path], log)
ssl_context = ssl._create_unverified_context(purpose=ssl.Purpose.CLIENT_AUTH, cafile=str(ca_cert)) # noqa: S323
ssl_context = ssl._create_unverified_context(purpose=ssl.Purpose.CLIENT_AUTH, cafile=str(ca_cert)) # ruff: ignore[suspicious-unverified-context-usage]
ssl_context.check_hostname = False
ssl_context.minimum_version = ssl.TLSVersion.TLSv1_3
ssl_context.load_cert_chain(certfile=str(cert_path), keyfile=str(key_path))
@@ -94,7 +94,7 @@ def ssl_context_for_client(
if check_permissions:
verify_ssl_certs_and_keys([ca_cert, cert_path], [ca_key, key_path], log)
ssl_context = ssl._create_unverified_context(purpose=ssl.Purpose.SERVER_AUTH, cafile=str(ca_cert)) # noqa: S323
ssl_context = ssl._create_unverified_context(purpose=ssl.Purpose.SERVER_AUTH, cafile=str(ca_cert)) # ruff: ignore[suspicious-unverified-context-usage]
ssl_context.check_hostname = False
ssl_context.load_cert_chain(certfile=str(cert_path), keyfile=str(key_path))
ssl_context.verify_mode = ssl.CERT_REQUIRED
+1 -1
View File
@@ -106,7 +106,7 @@ class Service(Generic[_T_RpcServiceProtocol, _T_ApiProtocol, _T_RpcApiProtocol])
outbound_rlp = 60
capabilities_to_use: list[tuple[uint16, str]] = default_capabilities[node_type]
if self.config.get("rate_limits", 2) >= 3:
capabilities_to_use = capabilities_to_use + _rate_limits_v3 # noqa: PLR6104 -- += would mutate the shared default_capabilities list
capabilities_to_use = capabilities_to_use + _rate_limits_v3 # ruff: ignore[non-augmented-assignment] -- += would mutate the shared default_capabilities list
if override_capabilities is not None:
capabilities_to_use = override_capabilities
+2 -2
View File
@@ -34,8 +34,8 @@ assert len(DEFAULT_SEED) == 32
class WalletTool:
next_address = 0
# TODO: make this a dataclass to make these instance attributes instead of mutable class attributes
pubkey_num_lookup: dict[bytes, uint32] = {} # noqa: RUF012
puzzle_pk_cache: dict[bytes32, PrivateKey] = {} # noqa: RUF012
pubkey_num_lookup: dict[bytes, uint32] = {} # ruff: ignore[mutable-class-default]
puzzle_pk_cache: dict[bytes32, PrivateKey] = {} # ruff: ignore[mutable-class-default]
def __init__(self, constants: ConsensusConstants, sk: PrivateKey | None = None):
self.constants = constants
+3 -3
View File
@@ -23,10 +23,10 @@ from chia.util.file_keyring import FileKeyring
# WARNING: Changing the default passphrase will prevent passphrase-less users from accessing
# their existing keys. Using a new default passphrase requires migrating existing users to
# the new passphrase.
DEFAULT_PASSPHRASE_IF_NO_MASTER_PASSPHRASE = "$ chia passphrase set # all the cool kids are doing it!" # noqa: S105
DEFAULT_PASSPHRASE_IF_NO_MASTER_PASSPHRASE = "$ chia passphrase set # all the cool kids are doing it!" # ruff: ignore[hardcoded-password-string]
MASTER_PASSPHRASE_SERVICE_NAME = "Chia Passphrase" # noqa: S105
MASTER_PASSPHRASE_USER_NAME = "Chia Passphrase" # noqa: S105
MASTER_PASSPHRASE_SERVICE_NAME = "Chia Passphrase" # ruff: ignore[hardcoded-password-string]
MASTER_PASSPHRASE_USER_NAME = "Chia Passphrase" # ruff: ignore[hardcoded-password-string]
OSPassphraseStore = MacKeyring | WinKeyring
+1 -1
View File
@@ -207,7 +207,7 @@ class PriorityThreadPoolExecutor:
max_wait = 0.0
with q.mutex:
for item in q.queue:
if item._sentinel or item.enqueue_time == 0.0: # noqa: RUF069
if item._sentinel or item.enqueue_time == 0.0: # ruff: ignore[float-equality-comparison]
continue
assert item.future is not None
if not item.future.running() and not item.future.done():
+1 -1
View File
@@ -39,7 +39,7 @@ class _TaskReferencer:
name: str | None = None,
known_unreferenced: bool = False,
) -> asyncio.Task[T]:
task = asyncio.create_task(coro=coroutine, name=name) # noqa: TID251
task = asyncio.create_task(coro=coroutine, name=name) # ruff: ignore[banned-api]
task.add_done_callback(self._task_done)
self.tasks[task] = _TaskInfo(task=task, known_unreferenced=known_unreferenced)
+1 -1
View File
@@ -15,7 +15,7 @@ from chia.wallet.util.curry_and_treehash import NIL_TREEHASH
def did_recovery_is_nil(recovery_program: Program) -> bool:
# cannot use set as not hashable
if recovery_program in (Program.NIL, NIL_TREEHASH): # noqa: PLR6201
if recovery_program in (Program.NIL, NIL_TREEHASH): # ruff: ignore[literal-membership]
return True
else:
return False
+1 -1
View File
@@ -42,7 +42,7 @@ def read_module_list(path: Path) -> list[str]:
def build_exclusion_list(mypy_failures: list[str]) -> list[str]:
# Create content for `mypy-exclusions.txt` from a list of mypy failures which look like:
# # chia/cmds/wallet_funcs.py:1251: error: Incompatible types in assignment (expression has type "str", variable has type "int") [assignment] # noqa
# # chia/cmds/wallet_funcs.py:1251: error: Incompatible types in assignment (expression has type "str", variable has type "int") [assignment] # ruff: ignore[line-too-long]
return sorted({".".join(split_mypy_failure(line)) for line in mypy_failures[:-1]})
+20 -20
View File
@@ -4173,31 +4173,31 @@ jupyter = ["ipywidgets (>=7.5.1,<9)"]
[[package]]
name = "ruff"
version = "0.15.21"
version = "0.16.0"
description = "An extremely fast Python linter and code formatter, written in Rust."
optional = true
python-versions = ">=3.7"
groups = ["main"]
markers = "extra == \"dev\""
files = [
{file = "ruff-0.15.21-py3-none-linux_armv6l.whl", hash = "sha256:63ea0e965e5d73c90e95b2434beeafc70820536717f561b32ab6e777cb9bdf5d"},
{file = "ruff-0.15.21-py3-none-macosx_10_12_x86_64.whl", hash = "sha256:0f212c5d7d54c01bbfe6dcab02b724a39300f3e34ed7acbe995ccb320a2c58bd"},
{file = "ruff-0.15.21-py3-none-macosx_11_0_arm64.whl", hash = "sha256:e6312e41bc96791299614995ea3a977c5857c3b5662b1ecef6755b02b87cb646"},
{file = "ruff-0.15.21-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:01d65b4831c6b2a4ba8ee6faa84049d44d982b7a706e622c4094c509e51673be"},
{file = "ruff-0.15.21-py3-none-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:2c5a913a589120ce67933d5d05fd6ddbcc2481c6a054980ee767f7414c72b4fd"},
{file = "ruff-0.15.21-py3-none-manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:5ef04b681d02ad4dc9620f00f83ac5c22f652d0e9a9cfe431d219b16ad5ccc41"},
{file = "ruff-0.15.21-py3-none-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:16d090c0740916594157e75b80d666eab8e78083b39b3b0e1d698f4670a17b86"},
{file = "ruff-0.15.21-py3-none-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:3a10e74757dd65004d779b73e2f3c5210156d9980b41224d50d2ebcf1db51e67"},
{file = "ruff-0.15.21-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:bab0905d2f29e0d9fbc3c373ed23db0095edaa3f71f1f4f519ec15134d9e85c8"},
{file = "ruff-0.15.21-py3-none-manylinux_2_31_riscv64.whl", hash = "sha256:00eca240af5789fec6fe7df74c088cc1f9644ed83027113468efba7c92b94075"},
{file = "ruff-0.15.21-py3-none-musllinux_1_2_aarch64.whl", hash = "sha256:262ab31557a75141325e32d3357f3597645a7f084e732b6b054dde428ecd9341"},
{file = "ruff-0.15.21-py3-none-musllinux_1_2_armv7l.whl", hash = "sha256:659c4e7a4212f83306045ec7c5e5a356d16d9a6ef4ae0c7a4d872914fc655d9d"},
{file = "ruff-0.15.21-py3-none-musllinux_1_2_i686.whl", hash = "sha256:9e866eab611a5f959d36df2d10e446973a3610bc42b0c15b31dc27977d59c233"},
{file = "ruff-0.15.21-py3-none-musllinux_1_2_x86_64.whl", hash = "sha256:e89bc93c0d3803ba870b55c29671bad9dc6d94bb1eb181b056b52eb05b52854f"},
{file = "ruff-0.15.21-py3-none-win32.whl", hash = "sha256:01f8d5be84823c172b389e123174f781f9daf86d6c58719d603f941932195cdd"},
{file = "ruff-0.15.21-py3-none-win_amd64.whl", hash = "sha256:d4b8d9a2f0f12b816b50447f6eccb9f4bb01a6b82c86b50fb3b5354b458dc6d3"},
{file = "ruff-0.15.21-py3-none-win_arm64.whl", hash = "sha256:6e83115d4b9377c1cbc13abf0e051f069fab0ef815ea0504a8a008cee24dd0a8"},
{file = "ruff-0.15.21.tar.gz", hash = "sha256:d0cfc841c572283c36548f82664a54ce6565567f1b0d5b4cf2caac693d8b7500"},
{file = "ruff-0.16.0-py3-none-linux_armv6l.whl", hash = "sha256:e5115729eb08c585e5121978ba5d5b60caeae394ce21b9fb5e6cd33a1c6c9b1e"},
{file = "ruff-0.16.0-py3-none-macosx_10_12_x86_64.whl", hash = "sha256:3c954b1d580bfa035b41654f7858cc7e71d5fc3ac5b723dd62bd9133830ed522"},
{file = "ruff-0.16.0-py3-none-macosx_11_0_arm64.whl", hash = "sha256:e01c21d10eb1b29f47b7454e1f4056db9a3f0260c646aa88457c610291db9f81"},
{file = "ruff-0.16.0-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:6e364e5ed22ed8dc05082fd78e35308618260907ac2d3c1d637b2e682415b6c9"},
{file = "ruff-0.16.0-py3-none-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:d327b8fc113a1d4421a04f3839d3752057c8dd1ee320223a6f3f52d04ada462a"},
{file = "ruff-0.16.0-py3-none-manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:a9b50c55e263103586b3dcf5f73d479eb8cb5fdb6098fec59a62891dab653717"},
{file = "ruff-0.16.0-py3-none-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:0ff4a79ce3ec0172f3241943835de1c4cb4e2dcd07f0f8c2d02603dbbbee4b17"},
{file = "ruff-0.16.0-py3-none-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:e95c448fca1fb2a18372a9440926c5a6ee789639bb975c72e7ae6d0b04218ab4"},
{file = "ruff-0.16.0-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:4f11a8d11010301d0a398a2fdef67691feca7294da6aef55e2150e8fa2cd520b"},
{file = "ruff-0.16.0-py3-none-manylinux_2_31_riscv64.whl", hash = "sha256:48044c678e9cb8698246c99b14aaccfa6601dea7379eb48a6f8f73f7a6d86cd0"},
{file = "ruff-0.16.0-py3-none-musllinux_1_2_aarch64.whl", hash = "sha256:7aa0959bad8eb8bef50340154fc9b58678dae31fa4293afa38b44b6e552c0213"},
{file = "ruff-0.16.0-py3-none-musllinux_1_2_armv7l.whl", hash = "sha256:28ea2b7df8ebf7f9da6b7d47b230ab48f387c0a29be3b474c4d0740e197bb9af"},
{file = "ruff-0.16.0-py3-none-musllinux_1_2_i686.whl", hash = "sha256:33a3dfac8c35f81498dea9181bccc2f4c4bc8f1521a1dd9406e77643e0f0fb09"},
{file = "ruff-0.16.0-py3-none-musllinux_1_2_x86_64.whl", hash = "sha256:a5237a0bda500d30d81b8e07a6973a5cbc772864cbf746ae2f4e8a2e01c9f4ed"},
{file = "ruff-0.16.0-py3-none-win32.whl", hash = "sha256:7fab76fa065c873f41ff744347c6e77bcc3dfec4bcc754dc26b63d23c0f7f5fb"},
{file = "ruff-0.16.0-py3-none-win_amd64.whl", hash = "sha256:429c117f022bf481fabd9d551e7a3952b24c65e6ef44337ea09d90bebef14472"},
{file = "ruff-0.16.0-py3-none-win_arm64.whl", hash = "sha256:14296fedcd2705c77ab8235439278bbb38f285cf7da5528b00b3e330c3d4872d"},
{file = "ruff-0.16.0.tar.gz", hash = "sha256:e460aafd5495ec89efaa6ced2e4a9a581116451e1c88b9d37ef497e0f8e93982"},
]
[[package]]
@@ -5243,4 +5243,4 @@ upnp = ["miniupnpc"]
[metadata]
lock-version = "2.1"
python-versions = ">=3.10, <4"
content-hash = "eced213a988f3eb2dfeec4353519e42ef319e9f3872013ead2f425abf68da805"
content-hash = "042b95df79d743a0ef6ec0b508d9bb82f572d348109670f3d5953282a0e3a79d"
+1 -1
View File
@@ -114,7 +114,7 @@ miniupnpc = {version = ">=2.3.2, <3", source = "chia", optional = true}
# numpy = [
# {version="<=1.24.4", python = "<3.10", optional = true},
# {version=">=1.26.4", python = ">=3.10", optional = true}]
ruff = { version = ">=0.15.16", optional = true }
ruff = { version = ">=0.16.0", optional = true }
[project.optional-dependencies]
dev = ["aiohttp_cors", "build", "coverage", "diff-cover", "mypy", "pre-commit", "py3createtorrent", "pyinstaller", "pytest", "pytest-cov", "pytest-mock", "pytest-monitor", "pytest-xdist", "pytest-rerunfailures", "ruff", "tach", "types-aiofiles", "types-pyyaml", "types-setuptools", "types-colorama", "types-zstd", "types-lxml", "types-psutil", "boto3-stubs[essential]", "lxml", "sortedcontainers-stubs"]
+4 -2
View File
@@ -26,9 +26,11 @@ cache_path = root.joinpath(".chia_cache", "manage_clvm.json")
# accessible via entry points.
sys.path = [path for path in sys.path if path != os.fspath(here)]
from chialisp import compile_clvm # noqa: E402
from chialisp import compile_clvm # ruff: ignore[module-import-not-at-top-of-file]
from chia.types.blockchain_format.serialized_program import SerializedProgram # noqa: E402
from chia.types.blockchain_format.serialized_program import ( # ruff: ignore[module-import-not-at-top-of-file]
SerializedProgram,
)
clvm_suffix = ".clvm"
clsp_suffix = ".clsp"
+1 -1
View File
@@ -104,7 +104,7 @@ def analyze() -> None:
print(f"{input_file}")
# TODO: would indeed be nice to not use shell=True, but this is
# all local data and piping is verbose. maybe still do it though.
check_call(f"gprof2dot -f pstats {quote(input_file)} | dot -T png >{quote(output)}", shell=True) # noqa: S602
check_call(f"gprof2dot -f pstats {quote(input_file)} | dot -T png >{quote(output)}", shell=True) # ruff: ignore[subprocess-popen-with-shell-equals-true]
@main.command("create-checkpoint", help="sync the full node up to specified height and save its state")