Skip to content

Commit

Permalink
Merge pull request #304 from PyMoDAQ/feature/typing_pyleco
Browse files Browse the repository at this point in the history
Feature/typing pyleco
  • Loading branch information
seb5g committed May 17, 2024
2 parents 16e0469 + 7157e6a commit 279cf6d
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 12 deletions.
2 changes: 1 addition & 1 deletion src/pymodaq/control_modules/daq_move.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
from numbers import Number
from random import randint
import sys
from typing import List, Tuple, Union, Optional
from typing import List, Tuple, Union, Optional, Type
import numpy as np

from qtpy.QtCore import QObject, Signal, QThread, Slot, Qt, QTimer
Expand Down
4 changes: 2 additions & 2 deletions src/pymodaq/control_modules/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
@author: Sebastien Weber
"""
from random import randint
from typing import Optional
from typing import Optional, Type

from easydict import EasyDict as edict

Expand Down Expand Up @@ -354,7 +354,7 @@ class ParameterControlModule(ParameterManager, ControlModule):

_update_settings_signal = Signal(edict)

listener_class: type[ActorListener] = ActorListener
listener_class: Type[ActorListener] = ActorListener

def __init__(self, **kwargs):
QObject.__init__(self)
Expand Down
4 changes: 2 additions & 2 deletions src/pymodaq/utils/leco/director_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
These directors correspond to the PymodaqListener
"""

from typing import Optional, Union
from typing import Optional, Union, List

from pyleco.directors.director import Director

Expand All @@ -26,7 +26,7 @@ def set_info(self, param: Parameter):
self.set_info_str(path=putils.get_param_path(param)[2:],
param_dict_str=ioxml.parameter_to_xml_string(param).decode())

def set_info_str(self, path: list[str], param_dict_str: str) -> None:
def set_info_str(self, path: List[str], param_dict_str: str) -> None:
self.ask_rpc(method="sef_info", path=path, param_dict_str=param_dict_str)


Expand Down
6 changes: 3 additions & 3 deletions src/pymodaq/utils/leco/leco_director.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@

import random

from typing import Callable, Sequence
from typing import Callable, Sequence, List

import pymodaq.utils.parameter.utils as putils
# object used to send info back to the main thread:
Expand Down Expand Up @@ -38,7 +38,7 @@ class LECODirector:
"move_abs", 'move_home', 'move_rel', 'get_actuator_value', 'stop_motion',
'position_is', 'move_done',
]
socket_types: list[str]
socket_types: List[str]

controller: GenericDirector
settings: Parameter
Expand Down Expand Up @@ -84,5 +84,5 @@ def emit_status(self, status: ThreadCommand) -> None:
super().emit_status(status=status) # type: ignore

# Methods accessible via remote calls
def set_info(self, path: list[str], param_dict_str: str) -> None:
def set_info(self, path: List[str], param_dict_str: str) -> None:
self.emit_status(ThreadCommand("set_info", attribute=[path, param_dict_str]))
8 changes: 4 additions & 4 deletions src/pymodaq/utils/leco/pymodaq_listener.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ class StrEnum(str, Enum):
pass
import logging
from threading import Event
from typing import Optional, Union
from typing import Optional, Union, List, Type

from pyleco.core import COORDINATOR_PORT
from pyleco.utils.listener import Listener, PipeHandler
Expand Down Expand Up @@ -78,7 +78,7 @@ def extract_dwa_object(data_string: str) -> DataWithAxes:
return desererializer.dwa_deserialization()

# generic commands
def set_info(self, path: list[str], param_dict_str: str) -> None:
def set_info(self, path: List[str], param_dict_str: str) -> None:
self.signals.cmd_signal.emit(ThreadCommand("set_info", attribute=[path, param_dict_str]))

# detector commands
Expand Down Expand Up @@ -125,7 +125,7 @@ class PymodaqListener(Listener):

def __init__(self,
name: str,
handler_class: type[PymodaqPipeHandler] = PymodaqPipeHandler,
handler_class: Type[PymodaqPipeHandler] = PymodaqPipeHandler,
host: str = "localhost",
port: int = COORDINATOR_PORT,
logger: Optional[logging.Logger] = None,
Expand Down Expand Up @@ -168,7 +168,7 @@ class ActorListener(PymodaqListener):

def __init__(self,
name: str,
handler_class: type[ActorHandler] = ActorHandler,
handler_class: Type[ActorHandler] = ActorHandler,
host: str = "localhost",
port: int = COORDINATOR_PORT,
logger: Optional[logging.Logger] = None,
Expand Down

0 comments on commit 279cf6d

Please sign in to comment.