44from PyQt5 .QtWidgets import QWidget
55
66from village .classes .enums import Active
7- from village .pybpodapi .session import Session
87from village .scripts .time_utils import time_utils
98from village .settings import settings
109
1110
12- class PyBpodBase :
13- """Base class for Bpod interface.
11+ class NullBpod :
12+ def close (self ) -> None :
13+ pass
1414
15- Attributes:
16- error (str): Error message.
17- session (Session | Any): Bpod session object.
18- connected (bool): Connection status.
19- """
15+ def send_state_machine (self , sma : Any ) -> None :
16+ pass
2017
21- error : str = "Error connecting to the bpod "
22- session : Session | Any = None
23- connected : bool = False
18+ def run_state_machine (self , sma : Any ) -> None :
19+ pass
2420
25- def connect (self , functions : list [ Callable ] ) -> None :
26- """Connects to the Bpod device.
21+ def register_value (self , name : str , value : Any ) -> None :
22+ pass
2723
28- Args:
29- functions (list[Callable]): List of callback functions for softcodes.
30- """
31- return
24+ def manual_override (
25+ self ,
26+ channel_type : Any ,
27+ channel_name : Any ,
28+ channel_number : Any ,
29+ value : Any ,
30+ ) -> None :
31+ pass
3232
33+
34+ class NullStateMachine :
3335 def add_state (
3436 self ,
3537 state_name : Any ,
@@ -45,7 +47,7 @@ def add_state(
4547 state_change_conditions (Any): Conditions to transition to other states.
4648 output_actions (Any): Actions to perform in this state.
4749 """
48- return
50+ pass
4951
5052 def set_global_timer (
5153 self ,
@@ -74,7 +76,7 @@ def set_global_timer(
7476 send_events (int): Whether to send events.
7577 oneset_triggers (Any | None): Triggers to set.
7678 """
77- return
79+ pass
7880
7981 def set_condition (
8082 self , condition_number : Any , condition_channel : Any , channel_value : Any
@@ -86,104 +88,28 @@ def set_condition(
8688 condition_channel (Any): The channel to check.
8789 channel_value (Any): The value to match.
8890 """
89- return
91+ pass
9092
9193 def set_global_counter (
9294 self , counter_number : Any , target_event : Any , threshold : Any
9395 ) -> None :
94- """Configures a global counter.
95-
96- Args:
97- counter_number (Any): The counter ID.
98- target_event (Any): The event to count.
99- threshold (Any): The count threshold.
100- """
101- return
102-
103- def create_state_machine (self ) -> None :
104- """Creates and initializes a new state machine."""
105- return
106-
107- def send_and_run_state_machine (self ) -> None :
108- """Sends the current state machine to the Bpod and starts it."""
109- return
110-
111- def close (self ) -> None :
112- """Closes the connection to the Bpod."""
113- return
114-
115- def stop (self ) -> None :
116- """Stops the current trial or operation."""
117- return
118-
119- def manual_override_input (self , message : str ) -> None :
120- """Simulates an input event manually.
121-
122- Args:
123- message (str): The input message/event string.
124- """
125- return
126-
127- def manual_override_output (self , message : str | tuple ) -> None :
128- """Manually triggers an output.
129-
130- Args:
131- message (str | tuple): The output command.
132- """
133- return
96+ pass
13497
135- def register_value (self , name : str , value : Any ) -> None :
136- """Registers a value to be tracked or logged.
137-
138- Args:
139- name (str): Name of the value.
140- value (Any): The value itself.
141- """
142- return
143-
144- def receive_softcode (self , idx : int ) -> None :
145- """Handles received softcodes.
146-
147- Args:
148- idx (int): The softcode index.
149- """
150- return
15198
152- def led (self , i : int , close : bool ) -> None :
153- """Controls an LED.
99+ class NullSoftCodeToBpod :
100+ def send (self , idx : int ) -> None :
101+ pass
154102
155- Args:
156- i (int): The LED index.
157- close (bool): Whether to turn it off (or close the circuit).
158- """
159- return
103+ def kill (self ) -> None :
104+ pass
160105
161- def water (self , i : int , close : bool ) -> None :
162- """Controls a water valve.
163106
164- Args:
165- i (int): The valve index.
166- close (bool): Whether to close the valve.
167- """
168- return
107+ class NullSession :
108+ def current_trial (self ) -> None :
109+ pass
169110
170- def poke (self , i : int , close : bool ) -> None :
171- """Simulates a poke event.
172-
173- Args:
174- i (int): The poke index.
175- close (bool): State of the poke.
176- """
177- return
178-
179-
180- class TelegramBotBase :
181- """Base class for Telegram Bot interface.
182-
183- Attributes:
184- error (str): Error message.
185- """
186111
112+ class NullTelegramBot :
187113 error : str = "Error connecting to the telegram_bot "
188114
189115 def alarm (self , message : str ) -> None :
@@ -195,13 +121,7 @@ def alarm(self, message: str) -> None:
195121 return
196122
197123
198- class ScaleBase :
199- """Base class for Scale interface.
200-
201- Attributes:
202- error (str): Error message.
203- """
204-
124+ class NullScale :
205125 error : str = "Error connecting to the scale "
206126
207127 def tare (self ) -> None :
@@ -225,13 +145,7 @@ def get_weight(self) -> float:
225145 return 0.0
226146
227147
228- class TempSensorBase :
229- """Base class for Temperature Sensor interface.
230-
231- Attributes:
232- error (str): Error message.
233- """
234-
148+ class NullTempSensor :
235149 error : str = "Error connecting to the temp_sensor "
236150
237151 def start (self ) -> None :
@@ -247,15 +161,7 @@ def get_temperature(self) -> tuple[float, float, str]:
247161 return 0.0 , 0.0 , ""
248162
249163
250- class MotorBase :
251- """Base class for Motor interface.
252-
253- Attributes:
254- error (str): Error message.
255- open_angle (int): Angle for open position.
256- close_angle (int): Angle for close position.
257- """
258-
164+ class NullMotor :
259165 error : str = "Error connecting to the motor "
260166 open_angle : int = 0
261167 close_angle : int = 0
@@ -269,14 +175,7 @@ def close(self) -> None:
269175 return
270176
271177
272- class SoundDeviceBase :
273- """Base class for Sound Device interface.
274-
275- Attributes:
276- samplerate (int): Audio sample rate.
277- error (str): Error message.
278- """
279-
178+ class NullSoundDevice :
280179 samplerate : int = 44100
281180 error : str = (
282181 ""
@@ -310,9 +209,7 @@ def load_wav(self, file: str) -> None:
310209 return
311210
312211
313- class EventBase :
314- """Base class for event logging interfaces."""
315-
212+ class NullCollection :
316213 def log (self , date : str , type : str , subject : str , description : str ) -> None :
317214 """Logs a generic event.
318215
@@ -335,31 +232,7 @@ def log_temp(self, date: str, temperature: float, humidity: float) -> None:
335232 return
336233
337234
338- class CameraBase :
339- """Base class for Camera interface.
340-
341- Attributes:
342- area1 (list[int]): Coordinates for area 1.
343- area2 (list[int]): Coordinates for area 2.
344- area3 (list[int]): Coordinates for area 3.
345- area4 (list[int]): Coordinates for area 4.
346- areas (list[list[int]]): List of all area coordinates.
347- area1_is_triggered (bool): Trigger status for area 1.
348- area2_is_triggered (bool): Trigger status for area 2.
349- area3_is_triggered (bool): Trigger status for area 3.
350- area4_is_triggered (bool): Trigger status for area 4.
351- change (bool): Flag for property changes.
352- annotation (str): Current annotation text.
353- path_picture (str): Path to save pictures.
354- error (str): Error message.
355- trial (int): Current trial number.
356- is_recording (bool): Recording status.
357- show_time_info (bool): Time info display flag.
358- x_position (int): X coordinate of tracked object.
359- y_position (int): Y coordinate of tracked object.
360- chrono (time_utils.Chrono): Timer utility.
361- """
362-
235+ class NullCamera :
363236 area1 : list [int ] = []
364237 area2 : list [int ] = []
365238 area3 : list [int ] = []
@@ -478,13 +351,7 @@ def take_picture(self) -> None:
478351 return
479352
480353
481- class BehaviorWindowBase (QWidget ):
482- """Base class for Behavior Window GUI.
483-
484- Attributes:
485- background_color: The background color.
486- """
487-
354+ class NullBehaviorWindow (QWidget ):
488355 background_color = None
489356
490357 def start_drawing (self ) -> None :
0 commit comments