hound and todos

This commit is contained in:
Jakub Jezek 2023-08-31 10:42:57 +02:00
parent a6b8fdfe33
commit f5d145ea23
No known key found for this signature in database
GPG key ID: 730D7C02726179A7
2 changed files with 16 additions and 5 deletions

View file

@ -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)

View file

@ -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=<path> --filepath=<path> --out_path=<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_)