Skip to content

Commit

Permalink
topotato: make topobase not abstract
Browse files Browse the repository at this point in the history
Having this abstract hurts type checking more than it helps anything.

Signed-off-by: David Lamparter <[email protected]>
  • Loading branch information
eqvinox committed Sep 16, 2024
1 parent 7c27fe9 commit 3a0b7b1
Showing 1 changed file with 5 additions and 7 deletions.
12 changes: 5 additions & 7 deletions topotato/topobase.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
appropriate implementation at runtime. For type checking, only the methods
and attributes defined here should be used outside OS-specific code.
"""
# pylint: disable=unused-argument

from abc import ABC, abstractmethod
import os
Expand Down Expand Up @@ -36,7 +37,7 @@
from .timeline import Timeline


class BaseNS(ABC):
class BaseNS:
"""
Common interface to a virtual host/router.
Expand All @@ -54,13 +55,12 @@ class BaseNS(ABC):
def __init__(self, _instance: "NetworkInstance", name: str) -> None:
pass

@abstractmethod
def tempfile(self, name: str) -> str:
"""
Get a path for a temporary file.
"""
return ""

@abstractmethod
def start(self) -> None:
"""
Start this virtual system.
Expand All @@ -80,13 +80,11 @@ def start_post(self, timeline: "Timeline", failed: List[Tuple[str, str]]) -> Non
rework/remove "failed" parameter.
"""

@abstractmethod
def end_prep(self) -> None:
"""
Prepare for shutdown.
"""

@abstractmethod
def end(self) -> None:
"""
Stop this virtual system.
Expand Down Expand Up @@ -122,8 +120,8 @@ def report_state(self) -> Optional[Dict[str, Any]]:
"""
Retrieve state for HTML test report.
"""
return None

@abstractmethod
def routes(
self, af: Union[Literal[4], Literal[6]] = 4, local=False
) -> Dict[str, Any]:
Expand All @@ -134,8 +132,8 @@ def routes(
Implement a type/protocol for the return value.
"""
return {}

@abstractmethod
def link_set(self, iface: "toponom.LinkIface", state: bool) -> None:
"""
Set one of this systems interfaces up or down.
Expand Down

0 comments on commit 3a0b7b1

Please sign in to comment.