2
2
from collections import defaultdict
3
3
from collections .abc import Callable
4
4
from types import MethodType
5
- from typing import Any
6
5
7
6
from softioc .asyncio_dispatcher import AsyncioDispatcher
8
7
13
12
14
13
15
14
class Backend :
16
- _initial_tasks : list [Callable ] = []
17
- _context : dict [str , Any ] = {}
18
-
19
15
def __init__ (
20
16
self , controller : Controller , loop : asyncio .AbstractEventLoop | None = None
21
17
):
22
18
self ._dispatcher = AsyncioDispatcher (loop )
23
19
self ._loop = self ._dispatcher .loop
24
20
self ._controller = controller
25
21
26
- self ._initial_tasks . append ( controller .connect )
22
+ self ._initial_tasks = [ controller .connect ]
27
23
28
24
asyncio .run_coroutine_threadsafe (
29
25
self ._controller .initialise (), self ._loop
@@ -32,13 +28,11 @@ def __init__(
32
28
self ._mapping = Mapping (self ._controller )
33
29
self ._link_process_tasks ()
34
30
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
+ }
42
36
43
37
def _link_process_tasks (self ):
44
38
for single_mapping in self ._mapping .get_controller_mappings ():
0 commit comments