31 lines
668 B
Python
31 lines
668 B
Python
"""Typings."""
|
|
import asyncssh
|
|
|
|
from typing import Any, AsyncContextManager, Protocol
|
|
from dataclasses import dataclass
|
|
from collections.abc import Callable, Awaitable
|
|
|
|
from .clients import ClientData
|
|
|
|
|
|
PortFactory = Callable[[], int]
|
|
|
|
AdminServer = tuple[str, tuple[str, str]]
|
|
|
|
@dataclass
|
|
class TestPorts:
|
|
"""Test port dataclass."""
|
|
|
|
backend: int
|
|
admin: int
|
|
sshd: int
|
|
|
|
|
|
CommandRunner = Callable[[ClientData, str], Awaitable[asyncssh.SSHCompletedProcess]]
|
|
|
|
class ProcessRunner(Protocol):
|
|
"""Process runner typing."""
|
|
|
|
def __call__(self, test_client: ClientData, command: str) -> AsyncContextManager[asyncssh.SSHClientProcess[Any]]:
|
|
...
|