Skip to content

Commit a3e8905

Browse files
authored
Merge pull request #279 from input-output-hk/more_ruff_checks
refactor: use max function for clarity
2 parents 11a5e1c + 4b57d89 commit a3e8905

File tree

4 files changed

+5
-5
lines changed

4 files changed

+5
-5
lines changed

cardano_clusterlib/clusterlib_klass.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -368,7 +368,7 @@ def wait_for_slot(self, slot: int) -> int:
368368
no_block_time = 0
369369

370370
_sleep_time = slots_diff * self.slot_length
371-
sleep_time = _sleep_time if _sleep_time > min_sleep else min_sleep
371+
sleep_time = max(min_sleep, _sleep_time)
372372

373373
if not printed and sleep_time > long_sleep:
374374
LOGGER.info(f"Waiting for {sleep_time:.2f} sec for slot no {slot}.")

cardano_clusterlib/txtools.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ def _select_utxos(
120120
utxo_ids.update(f"{rec.utxo_hash}#{rec.utxo_ix}" for rec in coin_txins)
121121
continue
122122

123-
tx_fee = fee if fee > 1 else 1
123+
tx_fee = max(1, fee)
124124
funds_needed = total_output_amount + tx_fee + deposit + treasury_donation
125125
total_withdrawals_amount = functools.reduce(lambda x, y: x + y.amount, withdrawals, 0)
126126
# Fee needs an input, even if withdrawal would cover all needed funds
@@ -188,7 +188,7 @@ def _balance_txouts(
188188
max_address = coin_txouts.pop(max_index[0]).address
189189

190190
total_output_amount = functools.reduce(lambda x, y: x + y.amount, coin_txouts, 0)
191-
tx_fee = fee if fee > 0 else 0
191+
tx_fee = max(0, fee)
192192
total_withdrawals_amount = functools.reduce(lambda x, y: x + y.amount, withdrawals, 0)
193193
funds_available = total_input_amount + total_withdrawals_amount
194194
funds_needed = total_output_amount + tx_fee + deposit + treasury_donation

docs/source/conf.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ def find_source():
9292
for part in info["fullname"].split("."):
9393
try:
9494
obj = getattr(obj, part)
95-
except Exception:
95+
except Exception: # noqa: PERF203
9696
return None
9797

9898
# strip decorators, which would resolve to the source of the decorator

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ force_single_line = true
4343
line-length = 100
4444

4545
[tool.ruff.lint]
46-
select = ["ARG", "B", "C4", "C90", "D", "DTZ", "E", "EM", "F", "I001", "ISC", "N", "PIE", "PL", "PLE", "PLR", "PLW", "PT", "PTH", "Q", "RET", "RSE", "RUF", "SIM", "TRY", "UP", "W", "YTT"]
46+
select = ["ARG", "B", "C4", "C90", "D", "DTZ", "E", "EM", "F", "FURB", "I001", "ISC", "N", "PERF", "PIE", "PL", "PLE", "PLR", "PLW", "PT", "PTH", "Q", "RET", "RSE", "RUF", "SIM", "TRY", "UP", "W", "YTT"]
4747
ignore = ["D10", "D203", "D212", "D213", "D214", "D215", "D404", "D405", "D406", "D407", "D408", "D409", "D410", "D411", "D413", "ISC001", "PLR0912", "PLR0913", "PLR0915", "PT001", "PT007", "PT012", "PT018", "PT023", "PTH123", "RET504", "TRY002", "TRY301", "UP006", "UP007", "UP035"]
4848

4949
[tool.ruff.lint.isort]

0 commit comments

Comments
 (0)