Files
imagepipeline/imagepipeline/core/context.py
T
Frank Schwenk a60a18a253 chore: add Ruff and apply formatting across codebase
Introduce ruff lint/format config, expand .gitignore, and reformat Python sources.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-07-18 17:34:14 +02:00

32 lines
964 B
Python

from __future__ import annotations
from dataclasses import dataclass, field
from pathlib import Path
from typing import TYPE_CHECKING, Any
if TYPE_CHECKING:
from imagepipeline.core.log import PipelineLogger
@dataclass
class ModuleContext:
"""Runtime context passed to each module's run() method."""
input_paths: list[Path]
output_dir: Path
params: dict[str, Any]
pipeline_output_root: Path
step_id: str
matched_groups: list[list[Path]] = field(default_factory=list)
input_refs: list[str] = field(default_factory=list)
input_layer_dirs: list[tuple[str, Path]] = field(default_factory=list)
logger: PipelineLogger | None = None
@property
def is_multi_input(self) -> bool:
return len(self.matched_groups) > 1
def log_image(self, module_name: str, index: int, total: int, path: Path) -> None:
if self.logger is not None:
self.logger.image(module_name, index, total, path.name)