Skip to content

Commit

Permalink
flake8 implicit str concat (#18908)
Browse files Browse the repository at this point in the history
* ISC001

* ISC002

* ISC003 (not)

* fewer comments

* indentation
  • Loading branch information
altendky authored Nov 20, 2024
1 parent dd02857 commit d3b5fde
Show file tree
Hide file tree
Showing 7 changed files with 20 additions and 14 deletions.
2 changes: 1 addition & 1 deletion chia/_tests/core/cmds/test_keys.py
Original file line number Diff line number Diff line change
Expand Up @@ -1322,7 +1322,7 @@ def test_derive_wallet_address(self, tmp_path, keyring_with_one_public_one_priva
assert result.exit_code == 0
assert (
result.output.find(
"Wallet address 9 (m/12381/8444/2/9): " "xch1p33y7kv48u7l68m490mr8levl6nkyxm3x8tfcnnec555egxzd3gs829wkl"
"Wallet address 9 (m/12381/8444/2/9): xch1p33y7kv48u7l68m490mr8levl6nkyxm3x8tfcnnec555egxzd3gs829wkl"
)
!= -1
)
Expand Down
4 changes: 2 additions & 2 deletions chia/cmds/wallet_funcs.py
Original file line number Diff line number Diff line change
Expand Up @@ -638,11 +638,11 @@ async def print_trade_record(record: TradeRecord, wallet_client: WalletRpcClient
print(f"Included Fees: {fees / units['chia']} XCH, {fees} mojos")
print("Timelock information:")
if record.valid_times.min_time is not None:
print(" - Not valid until " f"{format_timestamp_with_timezone(record.valid_times.min_time)}")
print(f" - Not valid until {format_timestamp_with_timezone(record.valid_times.min_time)}")
if record.valid_times.min_height is not None:
print(f" - Not valid until height {record.valid_times.min_height}")
if record.valid_times.max_time is not None:
print(" - Expires at " f"{format_timestamp_with_timezone(record.valid_times.max_time)} " "(+/- 10 min)")
print(f" - Expires at {format_timestamp_with_timezone(record.valid_times.max_time)} (+/- 10 min)")
if record.valid_times.max_height is not None:
print(f" - Expires at height {record.valid_times.max_height} (wait ~10 blocks after to be reorg safe)")
print("---------------")
Expand Down
6 changes: 3 additions & 3 deletions chia/full_node/block_store.py
Original file line number Diff line number Diff line change
Expand Up @@ -422,7 +422,7 @@ async def get_blocks_by_hash(self, header_hashes: list[bytes32]) -> list[FullBlo
async def get_block_record(self, header_hash: bytes32) -> Optional[BlockRecord]:
async with self.db_wrapper.reader_no_transaction() as conn:
async with conn.execute(
"SELECT block_record " "FROM full_blocks " "WHERE header_hash=?",
"SELECT block_record FROM full_blocks WHERE header_hash=?",
(header_hash,),
) as cursor:
row = await cursor.fetchone()
Expand All @@ -445,7 +445,7 @@ async def get_block_records_in_range(
ret: dict[bytes32, BlockRecord] = {}
async with self.db_wrapper.reader_no_transaction() as conn:
async with conn.execute(
"SELECT header_hash,block_record " "FROM full_blocks " "WHERE height >= ? AND height <= ?",
"SELECT header_hash,block_record FROM full_blocks WHERE height >= ? AND height <= ?",
(start, stop),
) as cursor:
for row in await cursor.fetchall():
Expand Down Expand Up @@ -504,7 +504,7 @@ async def get_block_records_close_to_peak(
ret: dict[bytes32, BlockRecord] = {}
async with self.db_wrapper.reader_no_transaction() as conn:
async with conn.execute(
"SELECT header_hash, block_record " "FROM full_blocks " "WHERE height >= ?",
"SELECT header_hash, block_record FROM full_blocks WHERE height >= ?",
(peak[1] - blocks_n,),
) as cursor:
for row in await cursor.fetchall():
Expand Down
2 changes: 1 addition & 1 deletion chia/full_node/full_node.py
Original file line number Diff line number Diff line change
Expand Up @@ -2826,7 +2826,7 @@ async def broadcast_removed_tx(self, mempool_removals: list[MempoolRemoveInfo])

transaction_id = internal_mempool_item.spend_bundle.name()

self.log.debug(f"Broadcasting removed transaction {transaction_id} to " f"wallet peers {peer_ids}")
self.log.debug(f"Broadcasting removed transaction {transaction_id} to wallet peers {peer_ids}")

for peer_id in peer_ids:
peer = self.server.all_connections.get(peer_id)
Expand Down
2 changes: 1 addition & 1 deletion chia/timelord/timelord_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ async def new_peak_timelord(self, new_peak: timelord_protocol.NewPeakTimelord) -
new_peak.reward_chain_block.height == self.timelord.last_state.last_height + 1
and self.check_orphaned_unfinished_block(new_peak) is True
):
log.info("there is an unfinished block that this peak would orphan - " "skip peak")
log.info("there is an unfinished block that this peak would orphan - skip peak")
self.timelord.state_changed("skipping_peak", {"height": new_peak.reward_chain_block.height})
return

Expand Down
2 changes: 1 addition & 1 deletion chia/wallet/trading/trade_store.py
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@ async def add_trade_record(self, record: TradeRecord, offer_name: bytes32, repla
)
await cursor.close()
cursor = await conn.execute(
"INSERT OR REPLACE INTO trade_record_times " "(trade_id, valid_times) " "VALUES(?, ?)",
"INSERT OR REPLACE INTO trade_record_times (trade_id, valid_times) VALUES(?, ?)",
(
record.trade_id,
bytes(record.valid_times),
Expand Down
16 changes: 11 additions & 5 deletions ruff.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,10 @@ select = [
"I", # Isort
"FA", # Flake8: future-annotations
"UP", # Pyupgrade
"RUF", # Ruff specific
# Flake8 core
"F",
# Flake8 async
"ASYNC",
"RUF", # Ruff specific
"F", # Flake8 core
"ASYNC", # Flake8 async
"ISC", # flake8-implicit-str-concat
"E",
"W",
]
Expand Down Expand Up @@ -53,6 +52,9 @@ ignore = [
# Should probably fix these after dealing with shielding for anyio
"ASYNC109", # async-function-with-timeout

# flake8-implicit-str-concat
"ISC003", # explicit-string-concatenation

# Ruff Specific

# This code is problematic because using instantiated types as defaults is so common across the codebase.
Expand All @@ -64,6 +66,10 @@ ignore = [
]


[lint.flake8-implicit-str-concat]
# Found 3279 errors.
# allow-multiline = false

[lint.isort]
required-imports = ["from __future__ import annotations"]

Expand Down

0 comments on commit d3b5fde

Please sign in to comment.