fix: fix refactor issues again

This commit is contained in:
2026-09-06 14:30:00 +08:00
parent 44ba5fbbee
commit db04b9c809
2 changed files with 14 additions and 3 deletions
@@ -16,8 +16,8 @@ class Prologue(LowPrologue):
"""The render kind for SVG""" """The render kind for SVG"""
temp_dir_initializer: Callable[[Path], None] | None temp_dir_initializer: Callable[[Path], None] | None
""" """
The extra initializer for temporary directory. The extra initializer for user temporary directory.
The only argument in function is the path to temporary directory. The only argument in function is the path to user temporary directory.
``None`` for no extra initializer. ``None`` for no extra initializer.
""" """
@@ -68,7 +68,7 @@ class Environment(Generic[P]):
# construct user custom temporary layout of possible # construct user custom temporary layout of possible
if self.__prologue.temp_dir_initializer is not None: if self.__prologue.temp_dir_initializer is not None:
temp_dir = self.__temporary_artifact() temp_dir = self.user_temporary_artifact()
self.__prologue.temp_dir_initializer(temp_dir) self.__prologue.temp_dir_initializer(temp_dir)
# region: With Visitor Requirements # region: With Visitor Requirements
@@ -28,5 +28,16 @@ class TempArtSink(Sink):
LOGGER.info("Saving temporary artifact: %s", p) LOGGER.info("Saving temporary artifact: %s", p)
artio.save_artifact(art, p) artio.save_artifact(art, p)
def repull(self, env: Environment) -> Artifact:
"""
Re-pull the artifact from this sink, after the artifact has
been pushed to it (usually via a direct rendering).
Only meaningful for artifacts produced by the job declaring
this sink.
"""
p = self.push_hint(env)
LOGGER.info("Re-pulling temporary artifact: %s", p)
return artio.load_artifact(p)
def push_hint(self, env: Environment) -> Path: def push_hint(self, env: Environment) -> Path:
return env.user_temporary_artifact(*self.__comps) return env.user_temporary_artifact(*self.__comps)