HomePhabricator

[lint] address new errors introduced by flake8-comprehensions 3.12.0

Description

[lint] address new errors introduced by flake8-comprehensions 3.12.0

Summary:
From the doc:

C419 Unnecessary list comprehension in <any/all>() prevents short-circuiting - rewrite as a generator.

Using a list comprehension inside a call to any()/all() prevents short-circuiting when a True / False value is found. The whole list will be constructed before calling any()/all(), potentially wasting work. Rewrite to use a generator expression, which can stop part way.

Another new error code C418 (dict({}) --> {}) is also introduced, but we don't have any instance of it in the codebase.

Test Plan:

pip install flake8-comprehensions --upgrade
flake8 . | grep C41[89]
cd build && ninja check-functional-extended

Reviewers: #bitcoin_abc, Fabien

Reviewed By: #bitcoin_abc, Fabien

Differential Revision: https://reviews.bitcoinabc.org/D13808

Details

Provenance
PiRKAuthored on Apr 27 2023, 14:56
PiRKPushed on Apr 28 2023, 07:24
Reviewer
Restricted Project
Differential Revision
D13808: [lint] address new errors introduced by flake8-comprehensions 3.12.0
Parents
rABCea8445a150c0: [Chronik] Add `block_tx_num_range` to `TxReader`
Branches
Unknown
Tags
Unknown