Skip to content

Commit 845a7d6

Browse files
committed
Using typing-extensions for 3.9 support of @OverRide
1 parent 15ce0fe commit 845a7d6

File tree

6 files changed

+14
-5
lines changed

6 files changed

+14
-5
lines changed

pyproject.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ dependencies = [
3232
'kiwipy[rmq]~=0.8.5',
3333
'nest_asyncio~=1.5,>=1.5.1',
3434
'pyyaml~=6.0',
35+
'typing-extensions~=4.12'
3536
]
3637

3738
[project.urls]

src/plumpy/base/state_machine.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -275,6 +275,8 @@ def state(self) -> State | None:
275275
def state_label(self) -> Any:
276276
if self._state is None:
277277
return None
278+
# XXX: should not use `.value` to access the printable output from LABEL
279+
# LABEL as the ClassVar should have __str__
278280
return self._state.LABEL
279281

280282
def add_state_event_callback(self, hook: Hashable, callback: EVENT_CALLBACK_TYPE) -> None:

src/plumpy/persistence.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
# -*- coding: utf-8 -*-
2+
from __future__ import annotations
3+
24
import abc
35
import asyncio
46
import collections

src/plumpy/process_states.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,10 @@
1717
Union,
1818
cast,
1919
final,
20-
override,
2120
)
2221

2322
import yaml
23+
from typing_extensions import override
2424
from yaml.loader import Loader
2525

2626
from plumpy.message import MessageBuilder, MessageType

src/plumpy/processes.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -285,20 +285,20 @@ def recreate_from(
285285
if 'loop' in load_context:
286286
proc._loop = load_context.loop
287287
else:
288-
_LOGGER.warning(f'cannot find `loop` store in load_context, use default event loop')
288+
_LOGGER.warning('cannot find `loop` store in load_context, use default event loop')
289289
proc._loop = asyncio.get_event_loop()
290290

291291
proc._state = proc.recreate_state(saved_state['_state'])
292292

293293
if 'coordinator' in load_context:
294294
proc._coordinator = load_context.coordinator
295295
else:
296-
_LOGGER.warning(f'cannot find `coordinator` store in load_context')
296+
_LOGGER.warning('cannot find `coordinator` store in load_context')
297297

298298
if 'logger' in load_context:
299299
proc._logger = load_context.logger
300300
else:
301-
_LOGGER.warning(f'cannot find `logger` store in load_context')
301+
_LOGGER.warning('cannot find `logger` store in load_context')
302302

303303
# Need to call this here as things downstream may rely on us having the runtime variable above
304304
persistence.load_auto_persist_params(proc, saved_state, load_context)
@@ -760,7 +760,9 @@ def on_entered(self, from_state: Optional[state_machine.State]) -> None:
760760
try:
761761
self._coordinator.broadcast_send(body=None, sender=self.pid, subject=subject)
762762
except exceptions.CoordinatorCommunicationError:
763-
message = f'Process<{self.pid}>: cannot broadcast state change from {from_label} to {self.state.value}'
763+
message = (
764+
f'Process<{self.pid}>: cannot broadcast state change from {from_label} to {self.state_label.value}'
765+
)
764766
self.logger.warning(message)
765767
self.logger.debug(message, exc_info=True)
766768
except Exception:

uv.lock

Lines changed: 2 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)