feat: add todo

This commit is contained in:
2026-09-03 19:33:07 +08:00
parent 28fa01992e
commit 49edad7d33
5 changed files with 51 additions and 3 deletions
@@ -1,6 +1,7 @@
from abc import ABC, abstractmethod
from ..utils import Artifact
class Sink(ABC):
"""
Abstract base class for all sinks.
@@ -8,4 +9,13 @@ class Sink(ABC):
@abstractmethod
def push_artifact(self, art: Artifact) -> None:
"""Push given artifact into this sink."""
pass
@abstractmethod
def __hash__(self) -> int:
pass
@abstractmethod
def __eq__(self, other) -> bool:
pass
@@ -1,12 +1,24 @@
from ..utils import Artifact
from .common import Sink
class TempDirSink(Sink):
__args: tuple[str, ...]
class TempDirSink(Sink):
__path_comps: tuple[str, ...]
def __init__(self, *args: str) -> None:
self.__args = tuple(args)
self.__path_comps = tuple(args)
def push_artifact(self, art: Artifact) -> None:
pass
def __hash__(self) -> int:
return hash(self.__path_comps)
def __eq__(self, other) -> bool:
if self is other:
return True
if not isinstance(other, TempDirSink):
return NotImplemented
return self.__path_comps == other.__path_comps
@@ -1,6 +1,7 @@
from abc import ABC, abstractmethod
from ..utils import Artifact
class Source(ABC):
"""
Abstract base class for all sources.
@@ -8,4 +9,13 @@ class Source(ABC):
@abstractmethod
def pull_artifact(self) -> Artifact:
"""Pull artifact from this source."""
pass
@abstractmethod
def __hash__(self) -> int:
pass
@abstractmethod
def __eq__(self, other) -> bool:
pass
@@ -10,3 +10,15 @@ class TempDirSource(Source):
def pull_artifact(self) -> Artifact:
pass
def __hash__(self) -> int:
return hash(self.__path_comps)
def __eq__(self, other) -> bool:
if self is other:
return True
if not isinstance(other, TempDirSource):
return NotImplemented
return self.__path_comps == other.__path_comps