added some typehints

This commit is contained in:
Jakub Trllo 2025-12-17 14:34:36 +01:00
parent 3fe508e773
commit a9af964f4c

View file

@ -401,7 +401,7 @@ class ExtractThumbnail(pyblish.api.InstancePlugin):
return review_repres + other_repres return review_repres + other_repres
def _is_valid_images_repre(self, repre): def _is_valid_images_repre(self, repre: dict) -> bool:
"""Check if representation contains valid image files """Check if representation contains valid image files
Args: Args:
@ -421,10 +421,10 @@ class ExtractThumbnail(pyblish.api.InstancePlugin):
def _create_colorspace_thumbnail( def _create_colorspace_thumbnail(
self, self,
src_path, src_path: str,
dst_path, dst_path: str,
colorspace_data, colorspace_data: dict,
thumbnail_def thumbnail_def: ThumbnailDef,
): ):
"""Create thumbnail using OIIO tool oiiotool """Create thumbnail using OIIO tool oiiotool
@ -437,11 +437,12 @@ class ExtractThumbnail(pyblish.api.InstancePlugin):
config (dict) config (dict)
display (Optional[str]) display (Optional[str])
view (Optional[str]) view (Optional[str])
thumbnail_def (ThumbnailDefinition): Thumbnail definition.
Returns: Returns:
str: path to created thumbnail str: path to created thumbnail
""" """
self.log.info("Extracting thumbnail {}".format(dst_path)) self.log.info(f"Extracting thumbnail {dst_path}")
resolution_arg = self._get_resolution_args( resolution_arg = self._get_resolution_args(
"oiiotool", src_path, thumbnail_def "oiiotool", src_path, thumbnail_def
) )
@ -600,10 +601,10 @@ class ExtractThumbnail(pyblish.api.InstancePlugin):
def _create_frame_from_video( def _create_frame_from_video(
self, self,
video_file_path, video_file_path: str,
output_dir, output_dir: str,
thumbnail_def thumbnail_def: ThumbnailDef,
): ) -> Optional[str]:
"""Convert video file to one frame image via ffmpeg""" """Convert video file to one frame image via ffmpeg"""
# create output file path # create output file path
base_name = os.path.basename(video_file_path) base_name = os.path.basename(video_file_path)
@ -704,10 +705,10 @@ class ExtractThumbnail(pyblish.api.InstancePlugin):
def _get_resolution_args( def _get_resolution_args(
self, self,
application, application: str,
input_path, input_path: str,
thumbnail_def thumbnail_def: ThumbnailDef,
): ) -> list:
# get settings # get settings
if thumbnail_def.target_size["type"] == "source": if thumbnail_def.target_size["type"] == "source":
return [] return []