updates to add type hinting to uses of Callable

This commit is contained in:
Blake Harnden 2020-01-15 11:56:23 -08:00
parent b3118513fa
commit dcabd8d6f8
9 changed files with 22 additions and 18 deletions

View file

@ -21,7 +21,6 @@ from core.nodes.network import CoreNetwork, CtrlNet
if TYPE_CHECKING:
from core.emulator.session import Session
LOCK = threading.Lock()
CMD_HIDE = True
@ -139,7 +138,7 @@ class DistributedController:
cmd = f"mkdir -p {self.session.session_dir}"
server.remote_cmd(cmd)
def execute(self, func: Callable) -> None:
def execute(self, func: Callable[[DistributedServer], None]) -> None:
"""
Convenience for executing logic against all distributed servers.

View file

@ -1206,7 +1206,7 @@ class Session:
ExceptionLevels.ERROR, "Session.run_state_hooks", None, message
)
def add_state_hook(self, state: int, hook: Callable) -> None:
def add_state_hook(self, state: int, hook: Callable[[int], None]) -> None:
"""
Add a state hook.
@ -1222,7 +1222,7 @@ class Session:
if self.state == state:
hook(state)
def del_state_hook(self, state: int, hook: Callable) -> None:
def del_state_hook(self, state: int, hook: Callable[[int], None]) -> None:
"""
Delete a state hook.