HomePhabricator

sort python imports in abc* functional tests with isort

Description

sort python imports in abc* functional tests with isort

Summary:
This is preparation work to add a new linter that will enforce this new sorting.

The command used was:

isort --profile=black --line-length=79 test/functional/abc*

The rationale for --profile=black is that this generate the same style of multiline imports that we already use: one import per line with trailing commas, use parentheses, ensure newline before comments.

Also, black is increasingly popular as a python liner and we may want to use it instead of autopep8 some day in the future. So it is a good idea to stay compatible.

The rationale for --line-length=79 is that it is the standard for autopep8, and is more strict (hence compatible with) black which uses 88.

Note that it also orders the imports by type: CONSTANT_VARIABLE, the CamelCaseClass, then functions_and_variables.

It can also affect the number of blank lines after the imports: one line before simple variables, two lines before top-level classes and functions.

Test Plan: ninja check-functional

Reviewers: #bitcoin_abc, Fabien

Reviewed By: #bitcoin_abc, Fabien

Subscribers: Fabien

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

Details

Provenance
PiRKAuthored on Sep 27 2021, 08:09
PiRKPushed on Sep 29 2021, 15:45
Reviewer
Restricted Project
Differential Revision
D10200: sort python imports in abc* functional tests with isort
Parents
rABC85aad1446581: refactor: Add BerkeleyDatabaseVersion() function
Branches
Unknown
Tags
Unknown