Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
88 changes: 47 additions & 41 deletions opencolorio_config_aces/clf/discover/classify.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@
"TRANSFORM_FILTERERS_DEFAULT_CLF",
"PATTERNS_DESCRIPTION_CLF",
"ROOT_TRANSFORMS_CLF",
"VALUE_DEFAULT_UNDEFINED",
"clf_transform_relative_path",
"CLFTransformID",
"CLFTransform",
Expand Down Expand Up @@ -140,6 +141,11 @@
the local 'transforms/clf' directory.
"""

VALUE_DEFAULT_UNDEFINED: str = "undefined"
"""
Default undefined value, i.e., *undefined*.
"""


def clf_transform_relative_path(
path: str, root_directory: str = ROOT_TRANSFORMS_CLF
Expand Down Expand Up @@ -194,23 +200,23 @@ class CLFTransformID:
__repr__
"""

def __init__(self, clf_transform_id: str) -> None:
def __init__(self, clf_transform_id: str = VALUE_DEFAULT_UNDEFINED) -> None:
self._clf_transform_id: str = clf_transform_id

self._urn: str | None = None
self._type: str | None = None
self._namespace: str | None = None
self._name: str | None = None
self._major_version: str | None = None
self._minor_version: str | None = None
self._patch_version: str | None = None
self._source: str | None = None
self._target: str | None = None
self._urn: str = VALUE_DEFAULT_UNDEFINED
self._type: str = VALUE_DEFAULT_UNDEFINED
self._namespace: str = VALUE_DEFAULT_UNDEFINED
self._name: str = VALUE_DEFAULT_UNDEFINED
self._major_version: str = VALUE_DEFAULT_UNDEFINED
self._minor_version: str = VALUE_DEFAULT_UNDEFINED
self._patch_version: str = VALUE_DEFAULT_UNDEFINED
self._source: str = VALUE_DEFAULT_UNDEFINED
self._target: str = VALUE_DEFAULT_UNDEFINED

self._parse()

@property
def clf_transform_id(self) -> str | None:
def clf_transform_id(self) -> str:
"""
Getter property for the *CLFtransformID*, e.g.,
*urn:aswf:ocio:transformId:v1.0:ACES.OCIO.AP0_to_AP1-Gamma2pnt2.c1.v1*.
Expand All @@ -228,7 +234,7 @@ def clf_transform_id(self) -> str | None:
return self._clf_transform_id

@property
def urn(self) -> str | None:
def urn(self) -> str:
"""
Getter property for the *CLFtransformID* Uniform Resource Name (*URN*),
e.g., *urn:aswf:ocio:transformId:v1.0*.
Expand All @@ -246,7 +252,7 @@ def urn(self) -> str | None:
return self._urn

@property
def type(self) -> str | None:
def type(self) -> str:
"""
Getter property for the *CLFtransformID* type, e.g., *ACES*.

Expand All @@ -263,7 +269,7 @@ def type(self) -> str | None:
return self._type

@property
def namespace(self) -> str | None:
def namespace(self) -> str:
"""
Getter property for the *CLFtransformID* namespace, e.g., *OCIO*.

Expand All @@ -280,7 +286,7 @@ def namespace(self) -> str | None:
return self._namespace

@property
def name(self) -> str | None:
def name(self) -> str:
"""
Getter property for the *CLFtransformID* name, e.g.,
*AP0_to_AP1-Gamma2pnt2*.
Expand All @@ -298,7 +304,7 @@ def name(self) -> str | None:
return self._name

@property
def major_version(self) -> str | None:
def major_version(self) -> str:
"""
Getter property for the *CLFtransformID* major version number, e.g., *c1*.

Expand All @@ -315,7 +321,7 @@ def major_version(self) -> str | None:
return self._major_version

@property
def minor_version(self) -> str | None:
def minor_version(self) -> str:
"""
Getter property for the *CLFtransformID* minor version number, e.g., *v1*.

Expand All @@ -332,7 +338,7 @@ def minor_version(self) -> str | None:
return self._minor_version

@property
def patch_version(self) -> str | None:
def patch_version(self) -> str:
"""
Getter property for the *CLFtransformID* patch version number.

Expand All @@ -349,7 +355,7 @@ def patch_version(self) -> str | None:
return self._patch_version

@property
def source(self) -> str | None:
def source(self) -> str:
"""
Getter property for the *CLFtransformID* source colourspace.

Expand All @@ -366,7 +372,7 @@ def source(self) -> str | None:
return self._source

@property
def target(self) -> str | None:
def target(self) -> str:
"""
Getter property for the *CLFtransformID* target colourspace.

Expand Down Expand Up @@ -409,7 +415,7 @@ def __repr__(self) -> str:
def _parse(self) -> None:
"""Parse the *CLFtransformID*."""

if self._clf_transform_id is None:
if self._clf_transform_id == VALUE_DEFAULT_UNDEFINED:
return

clf_transform_id = self._clf_transform_id
Expand Down Expand Up @@ -489,30 +495,30 @@ class CLFTransform:
def __init__(
self,
path: str,
family: str | None = None,
genus: str | None = None,
family: str = VALUE_DEFAULT_UNDEFINED,
genus: str = VALUE_DEFAULT_UNDEFINED,
siblings: Sequence | None = None,
) -> None:
siblings = optional(siblings, [])

self._path: str = os.path.abspath(os.path.normpath(path))

self._code: str | None = None
self._clf_transform_id: CLFTransformID | None = None
self._user_name: str | None = None
self._description: str | None = ""
self._input_descriptor: str | None = ""
self._output_descriptor: str | None = ""
self._code: str = VALUE_DEFAULT_UNDEFINED
self._clf_transform_id: CLFTransformID = CLFTransformID()
self._user_name: str = VALUE_DEFAULT_UNDEFINED
self._description: str = VALUE_DEFAULT_UNDEFINED
self._input_descriptor: str = VALUE_DEFAULT_UNDEFINED
self._output_descriptor: str = VALUE_DEFAULT_UNDEFINED
self._information: dict = {}

self._family: str | None = family
self._genus: str | None = genus
self._family: str = family
self._genus: str = genus
self._siblings: Sequence | None = siblings

self._parse()

@property
def path(self) -> str | None:
def path(self) -> str:
"""
Getter property for the *CLF* transform path.

Expand All @@ -529,7 +535,7 @@ def path(self) -> str | None:
return self._path

@property
def code(self) -> str | None:
def code(self) -> str:
"""
Getter property for the *CLF* transform code, i.e., the *CLF* transform
file content.
Expand All @@ -549,7 +555,7 @@ def code(self) -> str | None:
return self._code

@property
def clf_transform_id(self) -> CLFTransformID | None:
def clf_transform_id(self) -> CLFTransformID:
"""
Getter property for the *CLF* transform *CLFtransformID*.

Expand All @@ -566,7 +572,7 @@ def clf_transform_id(self) -> CLFTransformID | None:
return self._clf_transform_id

@property
def user_name(self) -> str | None:
def user_name(self) -> str:
"""
Getter property for the *CLF* transform user name.

Expand All @@ -583,7 +589,7 @@ def user_name(self) -> str | None:
return self._user_name

@property
def description(self) -> str | None:
def description(self) -> str:
"""
Getter property for the *CLF* transform description extracted from
parsing the file content header.
Expand All @@ -601,7 +607,7 @@ def description(self) -> str | None:
return self._description

@property
def input_descriptor(self) -> str | None:
def input_descriptor(self) -> str:
"""
Getter property for the *CLF* transform input descriptor extracted from
parsing the file content header.
Expand All @@ -619,7 +625,7 @@ def input_descriptor(self) -> str | None:
return self._input_descriptor

@property
def output_descriptor(self) -> str | None:
def output_descriptor(self) -> str:
"""
Getter property for the *CLF* transform output descriptor extracted
from parsing the file content header.
Expand Down Expand Up @@ -655,7 +661,7 @@ def information(self) -> dict:
return self._information

@property
def family(self) -> str | None:
def family(self) -> str:
"""
Getter property for the *CLF* transform family, e.g., *aces*, a value in
:attr:`opencolorio_config_aces.clf.reference.\
Expand All @@ -674,7 +680,7 @@ def family(self) -> str | None:
return self._family

@property
def genus(self) -> str | None:
def genus(self) -> str:
"""
Getter property for the *CLF* transform genus, e.g., *undefined*.

Expand Down Expand Up @@ -824,7 +830,7 @@ def _parse(self) -> None:
)
if aces_transform_id is not None:
self._information["ACEStransformID"] = ACESTransformID(
aces_transform_id.text
aces_transform_id.text # pyright: ignore
)

builtin_transform = next(
Expand Down
23 changes: 17 additions & 6 deletions opencolorio_config_aces/clf/transforms/apple/generate.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,12 @@
- :func:`opencolorio_config_aces.clf.generate_clf_transforms_apple`
"""

from __future__ import annotations

from pathlib import Path

import PyOpenColorIO as ocio

from opencolorio_config_aces.clf.transforms import (
clf_basename,
format_clf_transform_id,
Expand All @@ -32,29 +36,36 @@
"generate_clf_transforms_apple",
]

FAMILY = "Apple"
FAMILY: str = "Apple"
"""
*CLF* transforms family.
"""

GENUS = "Input"
GENUS: str = "Input"
"""
*CLF* transforms genus.
"""

VERSION = "1.0"
VERSION: str = "1.0"
"""
*CLF* transforms version.
"""


def generate_clf_transforms_apple(output_directory):
def generate_clf_transforms_apple(
output_directory: Path,
) -> dict[Path, ocio.GroupTransform]:
"""
Make the CLF file for Apple Log and for Apple Log curve CLF.
Generate the *CLF* transforms for *Apple Log* and for *Apple Log* curve.

Parameters
----------
output_directory
Directory to write the *CLF* transform(s) to.

Returns
-------
dict
:class:`dict`
Dictionary of *CLF* transforms and *OpenColorIO* `GroupTransform`
instances.

Expand Down
Loading
Loading