Skip to content

Commit 5af14d6

Browse files
authored
Tweak abstractmethods (#8427)
1 parent e6c7d66 commit 5af14d6

File tree

5 files changed

+11
-7
lines changed

5 files changed

+11
-7
lines changed

distributed/actor.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -246,11 +246,11 @@ class BaseActorFuture(abc.ABC, Awaitable[_T]):
246246

247247
@abc.abstractmethod
248248
def result(self, timeout: str | timedelta | float | None = None) -> _T:
249-
... # pragma: nocover
249+
...
250250

251251
@abc.abstractmethod
252252
def done(self) -> bool:
253-
... # pragma: nocover
253+
...
254254

255255
def __repr__(self) -> Literal["<ActorFuture>"]:
256256
return "<ActorFuture>"

distributed/scheduler.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -2823,7 +2823,7 @@ def transition_memory_forgotten(self, key: Key, stimulus_id: str) -> RecsMsgs:
28232823
# It's ok to forget a task that nobody needs
28242824
pass
28252825
else:
2826-
raise AssertionError("Unreachable", ts) # pragma: nocover
2826+
raise AssertionError("Unreachable", str(ts)) # pragma: nocover
28272827

28282828
if ts.actor:
28292829
for ws in ts.who_has or ():

distributed/shuffle/_buffer.py

+4-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
from __future__ import annotations
22

3+
import abc
34
import asyncio
45
import contextlib
56
import logging
@@ -126,11 +127,12 @@ async def process(self, id: str, shards: list[ShardType], size: int) -> None:
126127
await self.memory_limiter.decrease(size)
127128
self.bytes_memory -= size
128129

130+
@abc.abstractmethod
129131
async def _process(self, id: str, shards: list[ShardType]) -> None:
130-
raise NotImplementedError()
132+
...
131133

132134
def read(self, id: str) -> ShardType:
133-
raise NotImplementedError()
135+
raise NotImplementedError() # pragma: nocover
134136

135137
@property
136138
def empty(self) -> bool:

distributed/shuffle/_core.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -434,10 +434,10 @@ class ShuffleSpec(abc.ABC, Generic[_T_partition_id]):
434434
id: ShuffleId
435435
disk: bool
436436

437-
@abc.abstractproperty
437+
@property
438+
@abc.abstractmethod
438439
def output_partitions(self) -> Generator[_T_partition_id, None, None]:
439440
"""Output partitions"""
440-
raise NotImplementedError
441441

442442
@abc.abstractmethod
443443
def pick_worker(self, partition: _T_partition_id, workers: Sequence[str]) -> str:

pyproject.toml

+2
Original file line numberDiff line numberDiff line change
@@ -243,6 +243,8 @@ exclude_lines = [
243243
"TYPE_CHECKING",
244244
"except ImportError",
245245
"@overload",
246+
"@abstractmethod",
247+
"@abc.abstractmethod"
246248
]
247249

248250
[tool.coverage.html]

0 commit comments

Comments
 (0)