Skip to content

Commit 3894d79

Browse files
committed
pre-commit: sort Python imports with isort
Signed-off-by: Benjamin Gilbert <[email protected]>
1 parent c7cc449 commit 3894d79

File tree

4 files changed

+23
-5
lines changed

4 files changed

+23
-5
lines changed

.gitattributes

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,5 @@
77
/.github export-ignore
88
/.pre-commit-config.yaml export-ignore
99
/misc export-ignore
10+
/pyproject.toml export-ignore
1011
/test/cases export-ignore

.pre-commit-config.yaml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ repos:
1818
args: [--maxkb=200]
1919
- id: check-case-conflict
2020
- id: check-merge-conflict
21+
- id: check-toml
2122
- id: check-vcs-permalinks
2223
- id: check-yaml
2324
- id: end-of-file-fixer
@@ -33,6 +34,13 @@ repos:
3334
exclude: ^misc/
3435
args: ["--py38-plus"]
3536

37+
- repo: https://github.com/PyCQA/isort
38+
rev: 5.12.0
39+
hooks:
40+
- id: isort
41+
name: Reorder python imports with isort
42+
exclude: ^misc/
43+
3644
- repo: meta
3745
hooks:
3846
- id: check-hooks-apply

pyproject.toml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
[tool.isort]
2+
profile = "black"
3+
force_sort_within_sections = true
4+
line_length = 79

test/driver.in

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -33,22 +33,27 @@ from lzma import LZMACompressor
3333
import os
3434
import platform
3535
import re
36-
import requests
3736
import shlex
3837
from shutil import copytree, rmtree
3938
import socket
4039
import subprocess
4140
import sys
4241
import tarfile
43-
from tempfile import (mkdtemp, TemporaryDirectory, TemporaryFile,
44-
NamedTemporaryFile)
42+
from tempfile import (
43+
NamedTemporaryFile,
44+
TemporaryDirectory,
45+
TemporaryFile,
46+
mkdtemp,
47+
)
4548
import textwrap
4649
from threading import Thread
4750
from time import time as curtime
4851
from urllib.parse import urljoin
49-
import yaml
5052
from zipfile import ZipFile
5153

54+
import requests
55+
import yaml
56+
5257
TESTDATA_URL = os.getenv(
5358
'OPENSLIDE_TESTDATA_URL',
5459
'https://openslide.cs.cmu.edu/download/openslide-testdata/'
@@ -564,8 +569,8 @@ def _fusefs_init(shadowdir):
564569
# the distro's error reporting, so reset the excepthook to default.
565570
sys.excepthook = sys.__excepthook__
566571

567-
from pyfuse3 import FUSEError
568572
import pyfuse3
573+
from pyfuse3 import FUSEError
569574

570575
class Operations(pyfuse3.Operations):
571576
def __init__(self):

0 commit comments

Comments
 (0)