don't use dataclass for now

This commit is contained in:
Jakub Trllo 2025-06-27 13:16:03 +02:00
parent 0fb5220738
commit 3c3b165e36

View file

@ -1,3 +1,4 @@
from __future__ import annotations
import os import os
import re import re
import copy import copy
@ -6,7 +7,6 @@ import shutil
import subprocess import subprocess
from abc import ABC, abstractmethod from abc import ABC, abstractmethod
from typing import Any, Optional from typing import Any, Optional
from dataclasses import dataclass, field
import tempfile import tempfile
import clique import clique
@ -36,37 +36,68 @@ from ayon_core.pipeline.publish import (
from ayon_core.pipeline.publish.lib import add_repre_files_for_cleanup from ayon_core.pipeline.publish.lib import add_repre_files_for_cleanup
@dataclass
class TempData: class TempData:
"""Temporary data used across extractor's process.""" """Temporary data used across extractor's process."""
fps: float def __init__(
frame_start: int self,
frame_end: int fps: float,
handle_start: int frame_start: int,
handle_end: int frame_end: int,
frame_start_handle: int handle_start: int,
frame_end_handle: int handle_end: int,
output_frame_start: int frame_start_handle: int,
output_frame_end: int frame_end_handle: int,
pixel_aspect: float output_frame_start: int,
resolution_width: int output_frame_end: int,
resolution_height: int pixel_aspect: float,
origin_repre: "dict[str, Any]" resolution_width: int,
input_is_sequence: bool resolution_height: int,
first_sequence_frame: int origin_repre: dict[str, Any],
input_allow_bg: bool input_is_sequence: bool,
with_audio: bool first_sequence_frame: int,
without_handles: bool input_allow_bg: bool,
handles_are_set: bool with_audio: bool,
input_ext: str without_handles: bool,
explicit_input_paths: "list[str]" handles_are_set: bool,
paths_to_remove: "list[str]" input_ext: str,
explicit_input_paths: list[str],
paths_to_remove: list[str],
# Set later # Set later
full_output_path: str = "" full_output_path: str = "",
filled_files: "dict[int, str]" = field(default_factory=dict) filled_files: dict[int, str] = None,
output_ext_is_image: bool = True output_ext_is_image: bool = True,
output_is_sequence: bool = True output_is_sequence: bool = True,
):
if filled_files is None:
filled_files = {}
self.fps = fps
self.frame_start = frame_start
self.frame_end = frame_end
self.handle_start = handle_start
self.handle_end = handle_end
self.frame_start_handle = frame_start_handle
self.frame_end_handle = frame_end_handle
self.output_frame_start = output_frame_start
self.output_frame_end = output_frame_end
self.pixel_aspect = pixel_aspect
self.resolution_width = resolution_width
self.resolution_height = resolution_height
self.origin_repre = origin_repre
self.input_is_sequence = input_is_sequence
self.first_sequence_frame = first_sequence_frame
self.input_allow_bg = input_allow_bg
self.with_audio = with_audio
self.without_handles = without_handles
self.handles_are_set = handles_are_set
self.input_ext = input_ext
self.explicit_input_paths = explicit_input_paths
self.paths_to_remove = paths_to_remove
self.full_output_path = full_output_path
self.filled_files = filled_files
self.output_ext_is_image = output_ext_is_image
self.output_is_sequence = output_is_sequence
def frame_to_timecode(frame: int, fps: float) -> str: def frame_to_timecode(frame: int, fps: float) -> str:
@ -1019,7 +1050,7 @@ class ExtractReview(pyblish.api.InstancePlugin):
current_repre_name: str, current_repre_name: str,
start_frame: int, start_frame: int,
end_frame: int end_frame: int
) -> Optional["dict[int, str]"]: ) -> Optional[dict[int, str]]:
"""Tries to replace missing frames from ones from last version""" """Tries to replace missing frames from ones from last version"""
repre_file_paths = self._get_last_version_files( repre_file_paths = self._get_last_version_files(
instance, current_repre_name) instance, current_repre_name)