Skip to content

Commit 37cc448

Browse files
author
Joel Collins
committed
Fixed ActionView deque being common to all subclasses
1 parent dee38d3 commit 37cc448

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

src/labthings/views/__init__.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -134,12 +134,18 @@ class ActionView(View):
134134
} # Mapping of Thing Description ops to class methods
135135
_cls_tags = {"actions"}
136136
_deque = Deque() # Action queue
137-
_emergency_pool = Pool()
137+
_emergency_pool = Pool() # Emergency thread pool (common to all ActionView subclasses)
138138

139139
def __init__(self, *args, **kwargs):
140-
141140
super().__init__(*args, **kwargs)
142141

142+
def __init_subclass__(cls):
143+
"""
144+
Here we handle all class attributes that should be specific to each subclass of ActionView.
145+
Without this block, for example, all subclasses of ActionView will share the superclass _deque.
146+
"""
147+
cls._deque = Deque() # Action queue
148+
143149
@classmethod
144150
def get(cls):
145151
"""

0 commit comments

Comments
 (0)