From 49edad7d33acc9a29de00ea2201c3c1fe8c85b4b Mon Sep 17 00:00:00 2001 From: yyc12345 Date: Thu, 3 Sep 2026 19:33:07 +0800 Subject: [PATCH] feat: add todo --- TODO.md | 4 ++++ .../assemblicon/highlevel/sink/common.py | 10 ++++++++++ .../assemblicon/highlevel/sink/tempdir_sink.py | 18 +++++++++++++++--- .../assemblicon/highlevel/source/common.py | 10 ++++++++++ .../highlevel/source/tempdir_source.py | 12 ++++++++++++ 5 files changed, 51 insertions(+), 3 deletions(-) create mode 100644 TODO.md diff --git a/TODO.md b/TODO.md new file mode 100644 index 0000000..b7d9030 --- /dev/null +++ b/TODO.md @@ -0,0 +1,4 @@ +# Todo + +- Use "source" and "sink" to explicitly represent the input and output of job to replace current circumstance that use explicit job name to declare dependencies. After this change, the dependency network will be automaticlaly calculated from "source" and "sink" relation. +- Peel `assemblicon` off as an independent repository and let the builder of this repository refer it. diff --git a/tool/src/aurora_iconset_builder/assemblicon/highlevel/sink/common.py b/tool/src/aurora_iconset_builder/assemblicon/highlevel/sink/common.py index d5fdfbc..c812b1a 100644 --- a/tool/src/aurora_iconset_builder/assemblicon/highlevel/sink/common.py +++ b/tool/src/aurora_iconset_builder/assemblicon/highlevel/sink/common.py @@ -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 diff --git a/tool/src/aurora_iconset_builder/assemblicon/highlevel/sink/tempdir_sink.py b/tool/src/aurora_iconset_builder/assemblicon/highlevel/sink/tempdir_sink.py index 606083d..ebccdcd 100644 --- a/tool/src/aurora_iconset_builder/assemblicon/highlevel/sink/tempdir_sink.py +++ b/tool/src/aurora_iconset_builder/assemblicon/highlevel/sink/tempdir_sink.py @@ -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 diff --git a/tool/src/aurora_iconset_builder/assemblicon/highlevel/source/common.py b/tool/src/aurora_iconset_builder/assemblicon/highlevel/source/common.py index 18c3a75..8b78b07 100644 --- a/tool/src/aurora_iconset_builder/assemblicon/highlevel/source/common.py +++ b/tool/src/aurora_iconset_builder/assemblicon/highlevel/source/common.py @@ -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 diff --git a/tool/src/aurora_iconset_builder/assemblicon/highlevel/source/tempdir_source.py b/tool/src/aurora_iconset_builder/assemblicon/highlevel/source/tempdir_source.py index e952c65..0b30073 100644 --- a/tool/src/aurora_iconset_builder/assemblicon/highlevel/source/tempdir_source.py +++ b/tool/src/aurora_iconset_builder/assemblicon/highlevel/source/tempdir_source.py @@ -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