updates to add type hinting to uses of Callable
This commit is contained in:
parent
b3118513fa
commit
dcabd8d6f8
9 changed files with 22 additions and 18 deletions
|
@ -16,7 +16,7 @@ if TYPE_CHECKING:
|
|||
|
||||
|
||||
class DockerClient:
|
||||
def __init__(self, name: str, image: str, run: Callable) -> None:
|
||||
def __init__(self, name: str, image: str, run: Callable[..., str]) -> None:
|
||||
self.name = name
|
||||
self.image = image
|
||||
self.run = run
|
||||
|
|
|
@ -366,7 +366,7 @@ class TunTap(CoreInterface):
|
|||
self.up = False
|
||||
|
||||
def waitfor(
|
||||
self, func: Callable, attempts: int = 10, maxretrydelay: float = 0.25
|
||||
self, func: Callable[[], int], attempts: int = 10, maxretrydelay: float = 0.25
|
||||
) -> bool:
|
||||
"""
|
||||
Wait for func() to return zero with exponential backoff.
|
||||
|
|
|
@ -17,7 +17,7 @@ if TYPE_CHECKING:
|
|||
|
||||
|
||||
class LxdClient:
|
||||
def __init__(self, name: str, image: str, run: Callable) -> None:
|
||||
def __init__(self, name: str, image: str, run: Callable[..., str]) -> None:
|
||||
self.name = name
|
||||
self.image = image
|
||||
self.run = run
|
||||
|
|
|
@ -12,7 +12,7 @@ class LinuxNetClient:
|
|||
Client for creating Linux bridges and ip interfaces for nodes.
|
||||
"""
|
||||
|
||||
def __init__(self, run: Callable) -> None:
|
||||
def __init__(self, run: Callable[..., str]) -> None:
|
||||
"""
|
||||
Create LinuxNetClient instance.
|
||||
|
||||
|
@ -360,7 +360,7 @@ class OvsNetClient(LinuxNetClient):
|
|||
self.run(f"{OVS_BIN} set bridge {name} other_config:mac-aging-time=0")
|
||||
|
||||
|
||||
def get_net_client(use_ovs: bool, run: Callable) -> LinuxNetClient:
|
||||
def get_net_client(use_ovs: bool, run: Callable[..., str]) -> LinuxNetClient:
|
||||
"""
|
||||
Retrieve desired net client for running network commands.
|
||||
|
||||
|
|
|
@ -239,7 +239,7 @@ class EbtablesQueue:
|
|||
ebq = EbtablesQueue()
|
||||
|
||||
|
||||
def ebtablescmds(call: Callable, cmds: List[str]) -> None:
|
||||
def ebtablescmds(call: Callable[..., str], cmds: List[str]) -> None:
|
||||
"""
|
||||
Run ebtable commands.
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue