Skip to content

Commit 4370011

Browse files
authored
Merge pull request #51 from DiamondLightSource/backend-attributes
Convert Backend class attributes to instance attributes
2 parents 8e04689 + 45b7fe6 commit 4370011

File tree

1 file changed

+6
-12
lines changed

1 file changed

+6
-12
lines changed

src/fastcs/backend.py

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
from collections import defaultdict
33
from collections.abc import Callable
44
from types import MethodType
5-
from typing import Any
65

76
from softioc.asyncio_dispatcher import AsyncioDispatcher
87

@@ -13,17 +12,14 @@
1312

1413

1514
class Backend:
16-
_initial_tasks: list[Callable] = []
17-
_context: dict[str, Any] = {}
18-
1915
def __init__(
2016
self, controller: Controller, loop: asyncio.AbstractEventLoop | None = None
2117
):
2218
self._dispatcher = AsyncioDispatcher(loop)
2319
self._loop = self._dispatcher.loop
2420
self._controller = controller
2521

26-
self._initial_tasks.append(controller.connect)
22+
self._initial_tasks = [controller.connect]
2723

2824
asyncio.run_coroutine_threadsafe(
2925
self._controller.initialise(), self._loop
@@ -32,13 +28,11 @@ def __init__(
3228
self._mapping = Mapping(self._controller)
3329
self._link_process_tasks()
3430

35-
self._context.update(
36-
{
37-
"dispatcher": self._dispatcher,
38-
"controller": self._controller,
39-
"mapping": self._mapping,
40-
}
41-
)
31+
self._context = {
32+
"dispatcher": self._dispatcher,
33+
"controller": self._controller,
34+
"mapping": self._mapping,
35+
}
4236

4337
def _link_process_tasks(self):
4438
for single_mapping in self._mapping.get_controller_mappings():

0 commit comments

Comments
 (0)