Skip to content

Commit 20a55e9

Browse files
authored
Add isort to pre-commit hooks, package resorting (#4647)
1 parent bb067a1 commit 20a55e9

File tree

193 files changed

+1187
-1057
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

193 files changed

+1187
-1057
lines changed

.github/PULL_REQUEST_TEMPLATE.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
- [ ] Closes #xxxx
22
- [ ] Tests added / passed
3-
- [ ] Passes `black distributed` / `flake8 distributed`
3+
- [ ] Passes `black distributed` / `flake8 distributed` / `isort distributed`

.pre-commit-config.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,9 @@
11
repos:
2+
- repo: https://github.com/pycqa/isort
3+
rev: 5.8.0
4+
hooks:
5+
- id: isort
6+
language_version: python3
27
- repo: https://github.com/psf/black
38
rev: 20.8b1
49
hooks:

conftest.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
# https://pytest.org/latest/example/simple.html#control-skipping-of-tests-according-to-command-line-option
22
import pytest
33

4-
54
# Uncomment to enable more logging and checks
65
# (https://docs.python.org/3/library/asyncio-dev.html)
76
# Note this makes things slower and might consume much memory.

distributed/__init__.py

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,42 +1,42 @@
1-
from . import config
1+
from . import config # isort:skip; load distributed configuration first
22
import dask
33
from dask.config import config
4+
5+
from ._version import get_versions
46
from .actor import Actor, ActorFuture
5-
from .core import connect, rpc, Status
6-
from .deploy import LocalCluster, Adaptive, SpecCluster, SSHCluster
7-
from .diagnostics.progressbar import progress
8-
from .diagnostics.plugin import WorkerPlugin, SchedulerPlugin, PipInstall
97
from .client import (
108
Client,
11-
Executor,
129
CompatibleExecutor,
13-
wait,
10+
Executor,
11+
Future,
1412
as_completed,
1513
default_client,
1614
fire_and_forget,
17-
Future,
1815
futures_of,
16+
get_task_metadata,
1917
get_task_stream,
2018
performance_report,
21-
get_task_metadata,
19+
wait,
2220
)
21+
from .core import Status, connect, rpc
22+
from .deploy import Adaptive, LocalCluster, SpecCluster, SSHCluster
23+
from .diagnostics.plugin import PipInstall, SchedulerPlugin, WorkerPlugin
24+
from .diagnostics.progressbar import progress
25+
from .event import Event
2326
from .lock import Lock
2427
from .multi_lock import MultiLock
2528
from .nanny import Nanny
2629
from .pubsub import Pub, Sub
2730
from .queues import Queue
31+
from .scheduler import Scheduler
2832
from .security import Security
2933
from .semaphore import Semaphore
30-
from .event import Event
31-
from .scheduler import Scheduler
3234
from .threadpoolexecutor import rejoin
33-
from .utils import sync, TimeoutError, CancelledError
35+
from .utils import CancelledError, TimeoutError, sync
3436
from .variable import Variable
35-
from .worker import Worker, get_worker, get_client, secede, Reschedule
37+
from .worker import Reschedule, Worker, get_client, get_worker, secede
3638
from .worker_client import local_client, worker_client
3739

38-
from ._version import get_versions
39-
4040
versions = get_versions()
4141
__version__ = versions["version"]
4242
__git_revision__ = versions["full-revisionid"]

distributed/_concurrent_futures_thread.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,16 +8,17 @@
88
__author__ = "Brian Quinlan ([email protected])"
99

1010
import atexit
11-
from concurrent.futures import _base
1211
import itertools
12+
from concurrent.futures import _base
1313

1414
try:
1515
import queue
1616
except ImportError:
1717
import Queue as queue
18+
19+
import os
1820
import threading
1921
import weakref
20-
import os
2122

2223
# Workers are created as daemon threads. This is done to allow the interpreter
2324
# to exit when there are still idle threads in a ThreadPoolExecutor's thread

distributed/_ipython_utils.py

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -12,19 +12,17 @@
1212
except ImportError:
1313
# Python 2
1414
import Queue as queue
15-
from subprocess import Popen
15+
1616
import sys
17-
from threading import Thread
17+
from subprocess import Popen
18+
from threading import Event, Thread
1819
from uuid import uuid4
1920

20-
from tornado.gen import TimeoutError
21-
from tornado.ioloop import IOLoop
22-
from threading import Event
23-
2421
from IPython import get_ipython
2522
from jupyter_client import BlockingKernelClient, write_connection_file
2623
from jupyter_core.paths import jupyter_runtime_dir
27-
24+
from tornado.gen import TimeoutError
25+
from tornado.ioloop import IOLoop
2826

2927
OUTPUT_TIMEOUT = 10
3028

distributed/actor.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
from .client import Future, default_client
77
from .protocol import to_serialize
8-
from .utils import iscoroutinefunction, thread_state, sync
8+
from .utils import iscoroutinefunction, sync, thread_state
99
from .utils_comm import WrappedKey
1010
from .worker import get_worker
1111

distributed/batched.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
1-
from collections import deque
21
import logging
2+
from collections import deque
33

4-
import dask
54
from tornado import gen, locks
65
from tornado.ioloop import IOLoop
76

7+
import dask
8+
89
from .core import CommClosedError
910
from .utils import parse_timedelta
1011

11-
1212
logger = logging.getLogger(__name__)
1313

1414

distributed/cfexecutor.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,10 @@
22
import weakref
33

44
from tlz import merge
5-
65
from tornado import gen
76

87
from .metrics import time
9-
from .utils import sync, TimeoutError, parse_timedelta
8+
from .utils import TimeoutError, parse_timedelta, sync
109

1110

1211
@gen.coroutine

distributed/cli/dask_scheduler.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,17 @@
11
import atexit
2-
import logging
32
import gc
3+
import logging
44
import os
55
import re
66
import sys
77
import warnings
88

99
import click
10-
1110
from tornado.ioloop import IOLoop
1211

1312
from distributed import Scheduler
14-
from distributed.preloading import validate_preload_argv
1513
from distributed.cli.utils import check_python_3, install_signal_handlers
14+
from distributed.preloading import validate_preload_argv
1615
from distributed.proctitle import (
1716
enable_proctitle_on_children,
1817
enable_proctitle_on_current,

0 commit comments

Comments
 (0)