From f5d145ea23eb6b6463e1fea0ed07b4b1e0ffe934 Mon Sep 17 00:00:00 2001 From: Jakub Jezek Date: Thu, 31 Aug 2023 10:42:57 +0200 Subject: [PATCH] hound and todos --- openpype/pipeline/colorspace.py | 11 +++++++++-- openpype/scripts/ocio_wrapper.py | 10 +++++++--- 2 files changed, 16 insertions(+), 5 deletions(-) diff --git a/openpype/pipeline/colorspace.py b/openpype/pipeline/colorspace.py index f1acd18a70..e315633d41 100644 --- a/openpype/pipeline/colorspace.py +++ b/openpype/pipeline/colorspace.py @@ -261,9 +261,11 @@ def get_config_file_rules_colorspace_from_filepath(config_path, filepath): if result_data: return result_data[0] - from openpype.scripts.ocio_wrapper import _get_config_file_rules_colorspace_from_filepath + # TODO: refactor this so it is not imported but part of this file + from openpype.scripts.ocio_wrapper import _get_config_file_rules_colorspace_from_filepath # noqa: E501 - result_data = _get_config_file_rules_colorspace_from_filepath(config_path, filepath) + result_data = _get_config_file_rules_colorspace_from_filepath( + config_path, filepath) if result_data: return result_data[0] @@ -424,6 +426,7 @@ def _get_wrapped_with_subprocess(command_group, command, **kwargs): return json.load(f_) +# TODO: this should be part of ocio_wrapper.py def compatibility_check(): """Making sure PyOpenColorIO is importable""" if CachedData.python3compatible is not None: @@ -439,11 +442,13 @@ def compatibility_check(): return CachedData.python3compatible +# TODO: this should be part of ocio_wrapper.py def compatibility_check_config_version(config_path, major=1, minor=None): """Making sure PyOpenColorIO config version is compatible""" if not CachedData.config_version_data: if compatibility_check(): + # TODO: refactor this so it is not imported but part of this file from openpype.scripts.ocio_wrapper import _get_version_data CachedData.config_version_data = _get_version_data(config_path) @@ -488,6 +493,7 @@ def get_ocio_config_colorspaces(config_path): "config", "get_colorspace", in_path=config_path ) else: + # TODO: refactor this so it is not imported but part of this file from openpype.scripts.ocio_wrapper import _get_colorspace_data CachedData.ocio_config_colorspaces[config_path] = \ @@ -533,6 +539,7 @@ def get_ocio_config_views(config_path): "config", "get_views", in_path=config_path ) + # TODO: refactor this so it is not imported but part of this file from openpype.scripts.ocio_wrapper import _get_views_data return _get_views_data(config_path) diff --git a/openpype/scripts/ocio_wrapper.py b/openpype/scripts/ocio_wrapper.py index 1515cb4e40..56399f10a2 100644 --- a/openpype/scripts/ocio_wrapper.py +++ b/openpype/scripts/ocio_wrapper.py @@ -264,7 +264,9 @@ def _get_version_data(config_path): @click.option("--out_path", required=True, help="path where to write output json file", type=click.Path()) -def get_config_file_rules_colorspace_from_filepath(config_path, filepath, out_path): +def get_config_file_rules_colorspace_from_filepath( + config_path, filepath, out_path +): """Get colorspace from file path wrapper. Python 2 wrapped console command @@ -275,12 +277,14 @@ def get_config_file_rules_colorspace_from_filepath(config_path, filepath, out_pa out_path (str): temp json file path string Example of use: - > pyton.exe ./ocio_wrapper.py colorspace get_config_file_rules_colorspace_from_filepath \ + > pyton.exe ./ocio_wrapper.py \ + colorspace get_config_file_rules_colorspace_from_filepath \ --config_path= --filepath= --out_path= """ json_path = Path(out_path) - colorspace = _get_config_file_rules_colorspace_from_filepath(config_path, filepath) + colorspace = _get_config_file_rules_colorspace_from_filepath( + config_path, filepath) with open(json_path, "w") as f_: json.dump(colorspace, f_)