Skip to content

Commit 2e61816

Browse files
authored
Update precommit (#8852)
1 parent 4b65be0 commit 2e61816

Some content is hidden

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

62 files changed

+374
-306
lines changed

.flake8

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@ ignore =
2222
B028
2323
# do not compare types, for exact checks use `is` / `is not`, for instance checks use `isinstance()`
2424
E721
25+
# multiple statements on one line; required for black compat
26+
E701, E704
2527

2628
per-file-ignores =
2729
**/tests/*:

.pre-commit-config.yaml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,37 +12,37 @@ repos:
1212
- id: isort
1313
language_version: python3
1414
- repo: https://github.com/asottile/pyupgrade
15-
rev: v3.15.0
15+
rev: v3.17.0
1616
hooks:
1717
- id: pyupgrade
1818
args:
1919
- --py39-plus
2020
- repo: https://github.com/psf/black
21-
rev: 23.12.1
21+
rev: 24.8.0
2222
hooks:
2323
- id: black
2424
language_version: python3
2525
args:
2626
- --target-version=py39
2727
- repo: https://github.com/pycqa/flake8
28-
rev: 7.0.0
28+
rev: 7.1.1
2929
hooks:
3030
- id: flake8
3131
language_version: python3
3232
additional_dependencies:
3333
# NOTE: autoupdate does not pick up flake8-bugbear since it is a transitive
3434
# dependency. Make sure to update flake8-bugbear manually on a regular basis.
35-
- flake8-bugbear==23.12.2
35+
- flake8-bugbear==24.8.19
3636
- repo: https://github.com/codespell-project/codespell
37-
rev: v2.2.6
37+
rev: v2.3.0
3838
hooks:
3939
- id: codespell
4040
additional_dependencies:
4141
- tomli
4242
types_or: [rst, markdown]
4343
files: docs
4444
- repo: https://github.com/pre-commit/mirrors-mypy
45-
rev: v1.8.0
45+
rev: v1.11.2
4646
hooks:
4747
- id: mypy
4848
# Override default --ignore-missing-imports

continuous_integration/scripts/host_info.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,7 @@ def main() -> None:
3838
else:
3939
print("CPU frequency:")
4040
for freq in freqs:
41-
# FIXME types-psutil
42-
print(f" - current={freq.current}, min={freq.min}, max={freq.max}") # type: ignore
41+
print(f" - current={freq.current}, min={freq.min}, max={freq.max}")
4342

4443
mem = psutil.virtual_memory()
4544
print("Memory:")

continuous_integration/scripts/parse_stdout.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
"""On Windows, pytest-timeout kills off the whole test suite, leaving no junit report
22
behind. Parse the stdout of pytest to generate one.
33
"""
4+
45
from __future__ import annotations
56

67
import html

distributed/_concurrent_futures_thread.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,9 @@
3131
# workers to exit when their work queues are empty and then waits until the
3232
# threads finish.
3333

34-
_threads_queues: weakref.WeakKeyDictionary[
35-
threading.Thread, queue.Queue
36-
] = weakref.WeakKeyDictionary()
34+
_threads_queues: weakref.WeakKeyDictionary[threading.Thread, queue.Queue] = (
35+
weakref.WeakKeyDictionary()
36+
)
3737
_shutdown = False
3838

3939

distributed/active_memory_manager.py

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
See also :mod:`distributed.worker_memory` and :mod:`distributed.spill`, which implement
55
spill/pause/terminate mechanics on the Worker side.
66
"""
7+
78
from __future__ import annotations
89

910
import abc
@@ -392,12 +393,12 @@ def _enact_suggestions(self) -> None:
392393
logger.debug("Enacting suggestions for %d tasks:", len(self.pending))
393394

394395
validate = self.scheduler.validate
395-
drop_by_worker: (
396-
defaultdict[scheduler_module.WorkerState, list[Key]]
397-
) = defaultdict(list)
398-
repl_by_worker: (
399-
defaultdict[scheduler_module.WorkerState, list[Key]]
400-
) = defaultdict(list)
396+
drop_by_worker: defaultdict[scheduler_module.WorkerState, list[Key]] = (
397+
defaultdict(list)
398+
)
399+
repl_by_worker: defaultdict[scheduler_module.WorkerState, list[Key]] = (
400+
defaultdict(list)
401+
)
401402

402403
for ts, (pending_repl, pending_drop) in self.pending.items():
403404
if not ts.who_has:

distributed/actor.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -245,12 +245,10 @@ class BaseActorFuture(abc.ABC, Awaitable[_T]):
245245
"""
246246

247247
@abc.abstractmethod
248-
def result(self, timeout: str | timedelta | float | None = None) -> _T:
249-
...
248+
def result(self, timeout: str | timedelta | float | None = None) -> _T: ...
250249

251250
@abc.abstractmethod
252-
def done(self) -> bool:
253-
...
251+
def done(self) -> bool: ...
254252

255253
def __repr__(self) -> Literal["<ActorFuture>"]:
256254
return "<ActorFuture>"

distributed/broker.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -84,14 +84,12 @@ def _send_to_subscribers(self, topic: str, event: Any) -> None:
8484
self._scheduler.send_all(client_msgs, worker_msgs={})
8585

8686
@overload
87-
def get_events(self, topic: str) -> tuple[tuple[float, Any], ...]:
88-
...
87+
def get_events(self, topic: str) -> tuple[tuple[float, Any], ...]: ...
8988

9089
@overload
9190
def get_events(
9291
self, topic: None = None
93-
) -> dict[str, tuple[tuple[float, Any], ...]]:
94-
...
92+
) -> dict[str, tuple[tuple[float, Any], ...]]: ...
9593

9694
def get_events(
9795
self, topic: str | None = None

distributed/cfexecutor.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ def _cascade_future(future, cf_future):
3030
try:
3131
typ, exc, tb = result
3232
raise exc.with_traceback(tb)
33-
except BaseException as exc:
33+
except BaseException as exc: # noqa: B036
3434
cf_future.set_exception(exc)
3535

3636

distributed/cli/dask_worker.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -406,9 +406,11 @@ async def run():
406406
host=host,
407407
dashboard=dashboard,
408408
dashboard_address=dashboard_address,
409-
name=name
410-
if n_workers == 1 or name is None or name == ""
411-
else str(name) + "-" + str(i),
409+
name=(
410+
name
411+
if n_workers == 1 or name is None or name == ""
412+
else str(name) + "-" + str(i)
413+
),
412414
**kwargs,
413415
**port_kwargs_i,
414416
)

0 commit comments

Comments
 (0)