From dc019ed2398411549cdf738be4327a601ec7dfca Mon Sep 17 00:00:00 2001 From: crusaderky Date: Thu, 23 Jun 2022 17:45:46 +0100 Subject: [PATCH] mypy --no-implicit-optional (#6606) --- 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 eb6c3c39bfd..68294004ea9 100644 --- a/distributed/worker.py +++ b/distributed/worker.py @@ -1715,7 +1715,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 1b320d22f40..f55b468c9f8 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 9d3b8e1b950..681f8c7678f 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 [mypy-distributed.worker] allow_incomplete_defs = true