From dbb38e78af2c663816d17d78005f835623ed1190 Mon Sep 17 00:00:00 2001 From: crusaderky Date: Wed, 22 Jun 2022 11:20:19 +0100 Subject: [PATCH] mypy --no-implicit-optional --- distributed/client.py | 2 +- distributed/shuffle/shuffle.py | 2 +- distributed/worker.py | 2 +- distributed/worker_state_machine.py | 2 +- setup.cfg | 2 ++ 5 files changed, 6 insertions(+), 4 deletions(-) diff --git a/distributed/client.py b/distributed/client.py index e62d3449df9..e63a3173502 100644 --- a/distributed/client.py +++ b/distributed/client.py @@ -4057,7 +4057,7 @@ def log_event(self, topic: str | Collection[str], msg: Any): """ return self.sync(self.scheduler.log_event, topic=topic, msg=msg) - def get_events(self, topic: str = None): + def get_events(self, topic: str | None = None): """Retrieve structured topic logs Parameters diff --git a/distributed/shuffle/shuffle.py b/distributed/shuffle/shuffle.py index 1181e713569..01eba81b7b3 100644 --- a/distributed/shuffle/shuffle.py +++ b/distributed/shuffle/shuffle.py @@ -36,7 +36,7 @@ def get_ext() -> ShuffleWorkerExtension: def shuffle_transfer( input: pd.DataFrame, id: ShuffleId, - npartitions: int = None, + npartitions: int | None = None, column: str | None = None, ) -> None: get_ext().add_partition(input, id, npartitions=npartitions, column=column) diff --git a/distributed/worker.py b/distributed/worker.py index c3754d9fbd0..4ebe9d69f86 100644 --- a/distributed/worker.py +++ b/distributed/worker.py @@ -1714,7 +1714,7 @@ def update_data( self, data: dict[str, object], report: bool = True, - stimulus_id: str = None, + stimulus_id: str | None = None, ) -> dict[str, Any]: self.handle_stimulus( UpdateDataEvent( diff --git a/distributed/worker_state_machine.py b/distributed/worker_state_machine.py index 0ea9ef8394a..ff5d096435b 100644 --- a/distributed/worker_state_machine.py +++ b/distributed/worker_state_machine.py @@ -1033,7 +1033,7 @@ def __init__( *, nthreads: int = 1, address: str | None = None, - data: MutableMapping[str, object] = None, + data: MutableMapping[str, object] | None = None, threads: dict[str, int] | None = None, plugins: dict[str, WorkerPlugin] | None = None, resources: Mapping[str, float] | None = None, diff --git a/setup.cfg b/setup.cfg index 8e7a3a7f423..ef74f86b6f2 100644 --- a/setup.cfg +++ b/setup.cfg @@ -113,6 +113,7 @@ platform = linux allow_incomplete_defs = false allow_untyped_decorators = false ignore_missing_imports = true +no_implicit_optional = true show_error_codes = true warn_redundant_casts = true warn_unused_ignores = true @@ -123,6 +124,7 @@ warn_unreachable = true allow_incomplete_defs = true [mypy-distributed.scheduler] allow_incomplete_defs = true +no_implicit_optional = false warn_unreachable = false [mypy-distributed.worker] allow_incomplete_defs = true