diff --git a/.github/workflows/configuration-artifacts.yml b/.github/workflows/configuration-artifacts.yml index bb3c6679..71b6c98b 100644 --- a/.github/workflows/configuration-artifacts.yml +++ b/.github/workflows/configuration-artifacts.yml @@ -8,87 +8,87 @@ jobs: strategy: matrix: os: [ubuntu-20.04] - python-version: [3.9] + python-version: [3.11] fail-fast: false runs-on: ${{ matrix.os }} steps: - - uses: actions/checkout@v1 - with: - submodules: recursive - - name: Environment Variables - run: | - echo "CI_PYTHON_VERSION=${{ matrix.python-version }}" >> $GITHUB_ENV - echo "CI_PACKAGE=opencolorio_config_aces" >> $GITHUB_ENV - echo "CI_SHA=${{ github.sha }}" >> $GITHUB_ENV - shell: bash - - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v1 - with: - python-version: ${{ matrix.python-version }} - - name: Install Dependencies - run: | - sudo apt-get --yes install graphviz graphviz-dev - - name: Install Poetry - run: | - curl -sSL https://install.python-poetry.org | POETRY_HOME=$HOME/.poetry python3 - - echo "$HOME/.poetry/bin" >> $GITHUB_PATH - shell: bash - - name: Install Package Dependencies - run: | - poetry run python -m pip install --upgrade pip - poetry install --with graphviz,optional - shell: bash - - name: ACES - Conversion Graph - run: | - poetry run invoke build-aces-conversion-graph - shell: bash - - uses: actions/upload-artifact@v2 - with: - name: aces-conversion-graph - path: | - build/aces/graph/ - - name: Generation - Config - Common Tests - run: | - poetry run invoke build-config-common-tests - shell: bash - - uses: actions/upload-artifact@v2 - with: - name: config-common-tests - path: | - build/config/common/tests/ - - name: Generation - Config - ACES Reference (Analytical) - run: | - poetry run invoke build-config-reference-analytical - shell: bash - - uses: actions/upload-artifact@v2 - with: - name: config-reference-analytical - path: | - build/config/aces/analytical/ - - name: Generation - Config - ACES Reference - run: | - poetry run invoke build-config-reference - shell: bash - - uses: actions/upload-artifact@v2 - with: - name: config-reference - path: | - build/config/aces/reference/ - - name: Generation - Config - ACES CG - run: | - poetry run invoke build-config-cg - shell: bash - - uses: actions/upload-artifact@v2 - with: - name: config-cg - path: | - build/config/aces/cg/ - - name: Generation - Config - ACES Studio - run: | - poetry run invoke build-config-studio - shell: bash - - uses: actions/upload-artifact@v2 - with: - name: config-studio - path: | - build/config/aces/studio/ + - uses: actions/checkout@v4 + with: + submodules: recursive + - name: Environment Variables + run: | + echo "CI_PYTHON_VERSION=${{ matrix.python-version }}" >> $GITHUB_ENV + echo "CI_PACKAGE=opencolorio_config_aces" >> $GITHUB_ENV + echo "CI_SHA=${{ github.sha }}" >> $GITHUB_ENV + shell: bash + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v4 + with: + python-version: ${{ matrix.python-version }} + - name: Install Dependencies + run: | + sudo apt-get --yes install graphviz graphviz-dev + - name: Install Poetry + run: | + curl -sSL https://install.python-poetry.org | POETRY_HOME=$HOME/.poetry python3 - + echo "$HOME/.poetry/bin" >> $GITHUB_PATH + shell: bash + - name: Install Package Dependencies + run: | + poetry run python -m pip install --upgrade pip + poetry install + shell: bash + - name: ACES - Conversion Graph + run: | + poetry run invoke build-aces-conversion-graph + shell: bash + - uses: actions/upload-artifact@v4 + with: + name: aces-conversion-graph + path: | + build/aces/graph/ + - name: Generation - Config - Common Tests + run: | + poetry run invoke build-config-common-tests + shell: bash + - uses: actions/upload-artifact@v4 + with: + name: config-common-tests + path: | + build/config/common/tests/ + - name: Generation - Config - ACES Reference (Analytical) + run: | + poetry run invoke build-config-reference-analytical + shell: bash + - uses: actions/upload-artifact@v4 + with: + name: config-reference-analytical + path: | + build/config/aces/analytical/ + - name: Generation - Config - ACES Reference + run: | + poetry run invoke build-config-reference + shell: bash + - uses: actions/upload-artifact@v4 + with: + name: config-reference + path: | + build/config/aces/reference/ + - name: Generation - Config - ACES CG + run: | + poetry run invoke build-config-cg + shell: bash + - uses: actions/upload-artifact@v4 + with: + name: config-cg + path: | + build/config/aces/cg/ + - name: Generation - Config - ACES Studio + run: | + poetry run invoke build-config-studio + shell: bash + - uses: actions/upload-artifact@v4 + with: + name: config-studio + path: | + build/config/aces/studio/ diff --git a/.github/workflows/continuous-integration-quality-unit-tests.yml b/.github/workflows/continuous-integration-quality-unit-tests.yml index af7ab4da..6fe84407 100644 --- a/.github/workflows/continuous-integration-quality-unit-tests.yml +++ b/.github/workflows/continuous-integration-quality-unit-tests.yml @@ -7,53 +7,48 @@ jobs: name: ${{ matrix.os }} - Python ${{ matrix.python-version }} strategy: matrix: - os: [macOS-latest, ubuntu-20.04, windows-latest] - python-version: [3.9, '3.10'] + os: [macOS-13, ubuntu-20.04, windows-latest] + python-version: [3.11] fail-fast: false runs-on: ${{ matrix.os }} steps: - - uses: actions/checkout@v1 - with: - submodules: recursive - - name: Environment Variables - run: | - echo "CI_PYTHON_VERSION=${{ matrix.python-version }}" >> $GITHUB_ENV - echo "CI_PACKAGE=opencolorio_config_aces" >> $GITHUB_ENV - echo "CI_SHA=${{ github.sha }}" >> $GITHUB_ENV - echo "COVERALLS_REPO_TOKEN=${{ secrets.COVERALLS_REPO_TOKEN }}" >> $GITHUB_ENV - shell: bash - - name: Set up Python 3.9 for Pre-Commit - uses: actions/setup-python@v1 - with: - python-version: 3.9 - - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v1 - with: - python-version: ${{ matrix.python-version }} - - name: Install Poetry - run: | - curl -sSL https://install.python-poetry.org | POETRY_HOME=$HOME/.poetry python3 - - echo "$HOME/.poetry/bin" >> $GITHUB_PATH - shell: bash - - name: Install Package Dependencies - run: | - poetry run python -m pip install --upgrade pip - poetry install --without graphviz - shell: bash - - name: Pre-Commit (All Files) - run: | - poetry run pre-commit run --all-files - shell: bash - - name: Test Optimised Python Execution - run: | - poetry run python -OO -c "import $CI_PACKAGE" - shell: bash - - name: Test with Pytest - run: | - poetry run python -W ignore -m pytest --disable-warnings --doctest-modules --ignore=$CI_PACKAGE/config/reference/aces-dev --cov=$CI_PACKAGE $CI_PACKAGE - shell: bash -# - name: Upload Coverage to coveralls.io -# run: | -# if [ -z "$COVERALLS_REPO_TOKEN" ]; then echo \"COVERALLS_REPO_TOKEN\" secret is undefined!; else poetry run coveralls; fi -# shell: bash - + - uses: actions/checkout@v4 + with: + submodules: recursive + - name: Environment Variables + run: | + echo "CI_PYTHON_VERSION=${{ matrix.python-version }}" >> $GITHUB_ENV + echo "CI_PACKAGE=opencolorio_config_aces" >> $GITHUB_ENV + echo "CI_SHA=${{ github.sha }}" >> $GITHUB_ENV + echo "COVERALLS_REPO_TOKEN=${{ secrets.COVERALLS_REPO_TOKEN }}" >> $GITHUB_ENV + shell: bash + - name: Set up Python 3.9 for Pre-Commit + uses: actions/setup-python@v4 + with: + python-version: 3.9 + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v4 + with: + python-version: ${{ matrix.python-version }} + - name: Install Poetry + run: | + curl -sSL https://install.python-poetry.org | POETRY_HOME=$HOME/.poetry python3 - + echo "$HOME/.poetry/bin" >> $GITHUB_PATH + shell: bash + - name: Install Package Dependencies + run: | + poetry run python -m pip install --upgrade pip + poetry install --without graphviz + shell: bash + - name: Pre-Commit (All Files) + run: | + poetry run pre-commit run --all-files + shell: bash + - name: Test Optimised Python Execution + run: | + poetry run python -OO -c "import $CI_PACKAGE" + shell: bash + - name: Test with Pytest + run: | + poetry run python -W ignore -m pytest --disable-warnings --doctest-modules --ignore=$CI_PACKAGE/config/reference/aces-dev --cov=$CI_PACKAGE $CI_PACKAGE + shell: bash diff --git a/.github/workflows/continuous-integration-static-type-checking.yml b/.github/workflows/continuous-integration-static-type-checking.yml index aa5c27b4..425308c1 100644 --- a/.github/workflows/continuous-integration-static-type-checking.yml +++ b/.github/workflows/continuous-integration-static-type-checking.yml @@ -7,29 +7,23 @@ jobs: name: ${{ matrix.os }} - Python ${{ matrix.python-version }} strategy: matrix: - os: [macOS-latest] + os: [macOS-13] python-version: [3.11] fail-fast: false runs-on: ${{ matrix.os }} steps: - - uses: actions/checkout@v1 - - name: Environment Variables - run: | - echo "CI_PACKAGE=opencolorio_config_aces" >> $GITHUB_ENV - shell: bash - - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v1 - with: - python-version: ${{ matrix.python-version }} - - name: Install Dependencies (macOS) - if: matrix.os == 'macOS-latest' - run: | - brew install graphviz - export GRAPHVIZ_DIR="/usr/local/Cellar/graphviz/" - pip install pygraphviz --global-option=build_ext --global-option="-I$GRAPHVIZ_DIR/include" --global-option="-L$GRAPHVIZ_DIR/lib" - - name: Install Package Dependencies - run: | - pip install -r requirements.txt - - name: Static Type Checking - run: | - pyright --skipunannotated \ No newline at end of file + - uses: actions/checkout@v4 + - name: Environment Variables + run: | + echo "CI_PACKAGE=opencolorio_config_aces" >> $GITHUB_ENV + shell: bash + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v4 + with: + python-version: ${{ matrix.python-version }} + - name: Install Package Dependencies + run: | + pip install -r requirements.txt + - name: Static Type Checking + run: | + pyright --skipunannotated diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 8282692b..4a04f725 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,14 +1,52 @@ repos: -- repo: https://github.com/ikamensh/flynt/ - rev: '0.76' + - repo: https://github.com/pre-commit/pre-commit-hooks + rev: "v4.5.0" hooks: - - id: flynt -- repo: https://github.com/charliermarsh/ruff-pre-commit - rev: 'v0.0.272' + - id: check-added-large-files + - id: check-case-conflict + - id: check-merge-conflict + - id: check-symlinks + - id: check-yaml + - id: debug-statements + - id: end-of-file-fixer + - id: mixed-line-ending + - id: name-tests-test + args: ["--pytest-test-first"] + - id: requirements-txt-fixer + - id: trailing-whitespace + - repo: https://github.com/codespell-project/codespell + rev: v2.2.6 hooks: - - id: ruff -- repo: https://github.com/psf/black - rev: 22.3.0 + - id: codespell + args: ["--ignore-words-list=co-ordinates,exitance,fro,hart,ist"] + - repo: https://github.com/ikamensh/flynt + rev: "1.0.1" hooks: - - id: black - language_version: python3.9 + - id: flynt + args: [--verbose] + - repo: https://github.com/PyCQA/isort + rev: "5.13.2" + hooks: + - id: isort + - repo: https://github.com/astral-sh/ruff-pre-commit + rev: "v0.1.14" + hooks: + - id: ruff-format + - id: ruff + - repo: https://github.com/adamchainz/blacken-docs + rev: 1.16.0 + hooks: + - id: blacken-docs + language_version: python3.9 + - repo: https://github.com/pre-commit/mirrors-prettier + rev: "v3.1.0" + hooks: + - id: prettier + exclude: config-aces-reference.ocio.yaml + - repo: https://github.com/pre-commit/pygrep-hooks + rev: "v1.10.0" + hooks: + - id: rst-backticks + - id: rst-directive-colons + - id: rst-inline-touching-normal +exclude: aces-dev diff --git a/.readthedocs.yaml b/.readthedocs.yaml index 753ceffa..8e185f78 100644 --- a/.readthedocs.yaml +++ b/.readthedocs.yaml @@ -9,7 +9,7 @@ build: - graphviz-dev sphinx: - configuration: docs/conf.py + configuration: docs/conf.py formats: - htmlzip @@ -17,4 +17,4 @@ formats: python: install: - - requirements: docs/requirements.txt \ No newline at end of file + - requirements: docs/requirements.txt diff --git a/Dockerfile b/Dockerfile index 654df093..88cffe0f 100644 --- a/Dockerfile +++ b/Dockerfile @@ -12,7 +12,7 @@ RUN yum install --setopt=tsflags=nodocs -y \ # OpenColorIO Build WORKDIR /tmp ARG OCIO_INSTALL_DIRECTORY=/usr/local -RUN git clone https://github.com/AcademySoftwareFoundation/OpenColorIO \ +RUN git clone --depth 1 https://github.com/AcademySoftwareFoundation/OpenColorIO \ && cd OpenColorIO \ && mkdir build \ && mkdir -p ${OCIO_INSTALL_DIRECTORY} \ diff --git a/README.rst b/README.rst index dff11a95..923b2da3 100644 --- a/README.rst +++ b/README.rst @@ -65,7 +65,7 @@ thus cloning the repository requires initializing them:: git clone --recursive https://github.com/AcademySoftwareFoundation/OpenColorIO-Config-ACES.git -If you have already cloned the repository and forgot the `--recursive` +If you have already cloned the repository and forgot the ``--recursive`` argument, it is possible to initialize the submodules as follows:: git submodule update --init --recursive @@ -139,10 +139,8 @@ Optional Dependencies Development Dependencies ************************ -- `black `__ - `coverage `__ - `coveralls `__ -- `flynt `__ - `invoke `__ - `pre-commit `__ - `pydata-sphinx-theme `__ @@ -150,7 +148,6 @@ Development Dependencies - `pytest `__ - `pytest-cov `__ - `restructuredtext-lint `__ -- `ruff `__ - `sphinx >= 4, < 5 `__ - `twine `__ @@ -209,41 +206,41 @@ Listing the tasks is done as follows:: Reference Config **************** -+-----------------------+--------------------------------------------+ -| Task | Command | -+-----------------------+--------------------------------------------+ -| Build | `invoke build-config-reference` | -+-----------------------+--------------------------------------------+ -| Build (Docker) | `invoke docker-run-build-config-reference` | -+-----------------------+--------------------------------------------+ -| Updating Mapping File | `invoke update-mapping-file-reference` | -+-----------------------+--------------------------------------------+ ++-----------------------+----------------------------------------------+ +| Task | Command | ++-----------------------+----------------------------------------------+ +| Build | ``invoke build-config-reference`` | ++-----------------------+----------------------------------------------+ +| Build (Docker) | ``invoke docker-run-build-config-reference`` | ++-----------------------+----------------------------------------------+ +| Updating Mapping File | ``invoke update-mapping-file-reference`` | ++-----------------------+----------------------------------------------+ CG Config ********* -+-----------------------+-------------------------------------+ -| Task | Command | -+-----------------------+-------------------------------------+ -| Build | `invoke build-config-cg` | -+-----------------------+-------------------------------------+ -| Build (Docker) | `invoke docker-run-build-config-cg` | -+-----------------------+-------------------------------------+ -| Updating Mapping File | `invoke update-mapping-file-cg` | -+-----------------------+-------------------------------------+ ++-----------------------+---------------------------------------+ +| Task | Command | ++-----------------------+---------------------------------------+ +| Build | ``invoke build-config-cg`` | ++-----------------------+---------------------------------------+ +| Build (Docker) | ``invoke docker-run-build-config-cg`` | ++-----------------------+---------------------------------------+ +| Updating Mapping File | ``invoke update-mapping-file-cg`` | ++-----------------------+---------------------------------------+ Studio Config -**************** - -+-----------------------+-----------------------------------------+ -| Task | Command | -+-----------------------+-----------------------------------------+ -| Build | `invoke build-config-studio` | -+-----------------------+-----------------------------------------+ -| Build (Docker) | `invoke docker-run-build-config-studio` | -+-----------------------+-----------------------------------------+ -| Updating Mapping File | `invoke update-mapping-file-studio` | -+-----------------------+-----------------------------------------+ +************* + ++-----------------------+-------------------------------------------+ +| Task | Command | ++-----------------------+-------------------------------------------+ +| Build | ``invoke build-config-studio`` | ++-----------------------+-------------------------------------------+ +| Build (Docker) | ``invoke docker-run-build-config-studio`` | ++-----------------------+-------------------------------------------+ +| Updating Mapping File | ``invoke update-mapping-file-studio`` | ++-----------------------+-------------------------------------------+ API Reference ------------- diff --git a/docs/installation.rst b/docs/installation.rst index 13cb4f49..8ce9514a 100644 --- a/docs/installation.rst +++ b/docs/installation.rst @@ -13,7 +13,7 @@ thus cloning the repository requires initializing them:: git clone --recursive https://github.com/AcademySoftwareFoundation/OpenColorIO-Config-ACES.git -If you have already cloned the repository and forgot the `--recursive` +If you have already cloned the repository and forgot the ``--recursive`` argument, it is possible to initialize the submodules as follows:: git submodule update --init --recursive @@ -87,10 +87,8 @@ Optional Dependencies Development Dependencies ************************ -- `black `__ - `coverage `__ - `coveralls `__ -- `flynt `__ - `invoke `__ - `pre-commit `__ - `pydata-sphinx-theme `__ @@ -98,6 +96,5 @@ Development Dependencies - `pytest `__ - `pytest-cov `__ - `restructuredtext-lint `__ -- `ruff `__ - `sphinx >= 4, < 5 `__ - `twine `__ diff --git a/docs/opencolorio_config_aces.config.rst b/docs/opencolorio_config_aces.config.rst index 3fa52b2e..33ef240d 100644 --- a/docs/opencolorio_config_aces.config.rst +++ b/docs/opencolorio_config_aces.config.rst @@ -128,4 +128,4 @@ Reference Configuration .. autosummary:: :toctree: generated/ - generate_config_studio \ No newline at end of file + generate_config_studio diff --git a/docs/opencolorio_config_aces.utilities.rst b/docs/opencolorio_config_aces.utilities.rst index cb5a9859..66c80842 100644 --- a/docs/opencolorio_config_aces.utilities.rst +++ b/docs/opencolorio_config_aces.utilities.rst @@ -38,4 +38,4 @@ Common google_sheet_title slugify attest - timestamp \ No newline at end of file + timestamp diff --git a/docs/process.rst b/docs/process.rst index e3276aa4..4234a276 100644 --- a/docs/process.rst +++ b/docs/process.rst @@ -25,7 +25,7 @@ Using ``ACES2065-1`` and ``OCES`` as connection spaces, it is possible to build .. image:: _static/ACES_Conversion_Graph.svg -An initial mapping of *ACES* **AMF** components is generated after the classification process. The mapping defines the ``ACEStransformID`` relationships. Its generation is automated but needs to be guided by an external file, i.e. `opencolorio_config_aces/config/reference/discover/resources/ACES_AMF_Components.json`, because a few relationships cannot be derived automatically. +An initial mapping of *ACES* **AMF** components is generated after the classification process. The mapping defines the ``ACEStransformID`` relationships. Its generation is automated but needs to be guided by an external file, i.e., ``opencolorio_config_aces/config/reference/discover/resources/ACES_AMF_Components.json``, because a few relationships cannot be derived automatically. Analytical & Reference Configs Generation ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -52,7 +52,7 @@ The repository contains code to generate, discover and classify the additional * CG Config Generation ^^^^^^^^^^^^^^^^^^^^ -The *CG* config generator also uses a *CSV* file generated from a `spreadsheet `__ that expresses which ``ACEStransformID`` should be used from the `Reference` config and which ``CLFtransformID`` should be used from the shipped *CLF* transforms. +The *CG* config generator also uses a *CSV* file generated from a `spreadsheet `__ that expresses which ``ACEStransformID`` should be used from the ``Reference`` config and which ``CLFtransformID`` should be used from the shipped *CLF* transforms. - :func:`opencolorio_config_aces.generate_config_cg` diff --git a/docs/requirements.txt b/docs/requirements.txt index 75cba3a4..5a85dd7d 100644 --- a/docs/requirements.txt +++ b/docs/requirements.txt @@ -1,31 +1,39 @@ accessible-pygments==0.0.4 ; python_version >= "3.9" and python_version < "3.12" -alabaster==0.7.13 ; python_version >= "3.9" and python_version < "3.12" -babel==2.12.1 ; python_version >= "3.9" and python_version < "3.12" -beautifulsoup4==4.12.2 ; python_version >= "3.9" and python_version < "3.12" -certifi==2023.5.7 ; python_version >= "3.9" and python_version < "3.12" -charset-normalizer==3.1.0 ; python_version >= "3.9" and python_version < "3.12" +alabaster==0.7.16 ; python_version >= "3.9" and python_version < "3.12" +babel==2.14.0 ; python_version >= "3.9" and python_version < "3.12" +beautifulsoup4==4.12.3 ; python_version >= "3.9" and python_version < "3.12" +certifi==2024.2.2 ; python_version >= "3.9" and python_version < "3.12" +charset-normalizer==3.3.2 ; python_version >= "3.9" and python_version < "3.12" colorama==0.4.6 ; python_version >= "3.9" and python_version < "3.12" and sys_platform == "win32" +colour-science==0.4.4 ; python_version >= "3.9" and python_version < "3.12" docutils==0.17.1 ; python_version >= "3.9" and python_version < "3.12" -idna==3.4 ; python_version >= "3.9" and python_version < "3.12" +idna==3.7 ; python_version >= "3.9" and python_version < "3.12" +imageio==2.34.1 ; python_version >= "3.9" and python_version < "3.12" imagesize==1.4.1 ; python_version >= "3.9" and python_version < "3.12" -importlib-metadata==6.6.0 ; python_version >= "3.9" and python_version < "3.10" -jinja2==3.1.2 ; python_version >= "3.9" and python_version < "3.12" -markupsafe==2.1.3 ; python_version >= "3.9" and python_version < "3.12" -opencolorio==2.3.0 ; python_version >= "3.9" and python_version < "3.12" -packaging==23.1 ; python_version >= "3.9" and python_version < "3.12" +importlib-metadata==7.1.0 ; python_version >= "3.9" and python_version < "3.10" +jinja2==3.1.3 ; python_version >= "3.9" and python_version < "3.12" +jsonpickle==2.2.0 ; python_version >= "3.9" and python_version < "3.12" +markupsafe==2.1.5 ; python_version >= "3.9" and python_version < "3.12" +networkx==3.2.1 ; python_version >= "3.9" and python_version < "3.12" +numpy==1.26.4 ; python_version >= "3.9" and python_version < "3.12" +opencolorio==2.3.2 ; python_version >= "3.9" and python_version < "3.12" +packaging==24.0 ; python_version >= "3.9" and python_version < "3.12" +pillow==10.3.0 ; python_version >= "3.9" and python_version < "3.12" pydata-sphinx-theme==0.13.3 ; python_version >= "3.9" and python_version < "3.12" -pygments==2.15.1 ; python_version >= "3.9" and python_version < "3.12" +pygments==2.17.2 ; python_version >= "3.9" and python_version < "3.12" +pygraphviz==1.11 ; python_version >= "3.9" and python_version < "3.12" requests==2.31.0 ; python_version >= "3.9" and python_version < "3.12" -semver==3.0.1 ; python_version >= "3.9" and python_version < "3.12" +scipy==1.13.0 ; python_version >= "3.9" and python_version < "3.12" +semver==3.0.2 ; python_version >= "3.9" and python_version < "3.12" snowballstemmer==2.2.0 ; python_version >= "3.9" and python_version < "3.12" -soupsieve==2.4.1 ; python_version >= "3.9" and python_version < "3.12" +soupsieve==2.5 ; python_version >= "3.9" and python_version < "3.12" sphinx==4.5.0 ; python_version >= "3.9" and python_version < "3.12" -sphinxcontrib-applehelp==1.0.4 ; python_version >= "3.9" and python_version < "3.12" -sphinxcontrib-devhelp==1.0.2 ; python_version >= "3.9" and python_version < "3.12" -sphinxcontrib-htmlhelp==2.0.1 ; python_version >= "3.9" and python_version < "3.12" +sphinxcontrib-applehelp==1.0.8 ; python_version >= "3.9" and python_version < "3.12" +sphinxcontrib-devhelp==1.0.6 ; python_version >= "3.9" and python_version < "3.12" +sphinxcontrib-htmlhelp==2.0.5 ; python_version >= "3.9" and python_version < "3.12" sphinxcontrib-jsmath==1.0.1 ; python_version >= "3.9" and python_version < "3.12" -sphinxcontrib-qthelp==1.0.3 ; python_version >= "3.9" and python_version < "3.12" -sphinxcontrib-serializinghtml==1.1.5 ; python_version >= "3.9" and python_version < "3.12" -typing-extensions==4.6.3 ; python_version >= "3.9" and python_version < "3.12" -urllib3==2.0.3 ; python_version >= "3.9" and python_version < "3.12" -zipp==3.15.0 ; python_version >= "3.9" and python_version < "3.10" +sphinxcontrib-qthelp==1.0.7 ; python_version >= "3.9" and python_version < "3.12" +sphinxcontrib-serializinghtml==1.1.10 ; python_version >= "3.9" and python_version < "3.12" +typing-extensions==4.11.0 ; python_version >= "3.9" and python_version < "3.12" +urllib3==2.2.1 ; python_version >= "3.9" and python_version < "3.12" +zipp==3.18.1 ; python_version >= "3.9" and python_version < "3.10" diff --git a/docs/usage.rst b/docs/usage.rst index 066dc9c5..519a2f5e 100644 --- a/docs/usage.rst +++ b/docs/usage.rst @@ -20,38 +20,38 @@ Listing the tasks is done as follows:: Reference Config **************** -+-----------------------+--------------------------------------------+ -| *Task* | *Command* | -+-----------------------+--------------------------------------------+ -| Build | `invoke build-config-reference` | -+-----------------------+--------------------------------------------+ -| Build (Docker) | `invoke docker-run-build-config-reference` | -+-----------------------+--------------------------------------------+ -| Updating Mapping File | `invoke update-mapping-file-reference` | -+-----------------------+--------------------------------------------+ ++-----------------------+----------------------------------------------+ +| Task | Command | ++-----------------------+----------------------------------------------+ +| Build | ``invoke build-config-reference`` | ++-----------------------+----------------------------------------------+ +| Build (Docker) | ``invoke docker-run-build-config-reference`` | ++-----------------------+----------------------------------------------+ +| Updating Mapping File | ``invoke update-mapping-file-reference`` | ++-----------------------+----------------------------------------------+ CG Config ********* -+-----------------------+-------------------------------------+ -| *Task* | *Command* | -+-----------------------+-------------------------------------+ -| Build | `invoke build-config-cg` | -+-----------------------+-------------------------------------+ -| Build (Docker) | `invoke docker-run-build-config-cg` | -+-----------------------+-------------------------------------+ -| Updating Mapping File | `invoke update-mapping-file-cg` | -+-----------------------+-------------------------------------+ ++-----------------------+---------------------------------------+ +| Task | Command | ++-----------------------+---------------------------------------+ +| Build | ``invoke build-config-cg`` | ++-----------------------+---------------------------------------+ +| Build (Docker) | ``invoke docker-run-build-config-cg`` | ++-----------------------+---------------------------------------+ +| Updating Mapping File | ``invoke update-mapping-file-cg`` | ++-----------------------+---------------------------------------+ Studio Config ************* -+-----------------------+-----------------------------------------+ -| *Task* | *Command* | -+-----------------------+-----------------------------------------+ -| Build | `invoke build-config-studio` | -+-----------------------+-----------------------------------------+ -| Build (Docker) | `invoke docker-run-build-config-studio` | -+-----------------------+-----------------------------------------+ -| Updating Mapping File | `invoke update-mapping-file-studio` | -+-----------------------+-----------------------------------------+ ++-----------------------+-------------------------------------------+ +| Task | Command | ++-----------------------+-------------------------------------------+ +| Build | ``invoke build-config-studio`` | ++-----------------------+-------------------------------------------+ +| Build (Docker) | ``invoke docker-run-build-config-studio`` | ++-----------------------+-------------------------------------------+ +| Updating Mapping File | ``invoke update-mapping-file-studio`` | ++-----------------------+-------------------------------------------+ diff --git a/opencolorio_config_aces/__init__.py b/opencolorio_config_aces/__init__.py index 489845ce..d3801705 100644 --- a/opencolorio_config_aces/__init__.py +++ b/opencolorio_config_aces/__init__.py @@ -128,6 +128,4 @@ __major_version__ = "2" __minor_version__ = "0" __change_version__ = "0" -__version__ = ".".join( - (__major_version__, __minor_version__, __change_version__) -) +__version__ = ".".join((__major_version__, __minor_version__, __change_version__)) diff --git a/opencolorio_config_aces/clf/discover/classify.py b/opencolorio_config_aces/clf/discover/classify.py index 848e40c5..9cfcf944 100644 --- a/opencolorio_config_aces/clf/discover/classify.py +++ b/opencolorio_config_aces/clf/discover/classify.py @@ -113,7 +113,7 @@ TRANSFORM_GENUS_DEFAULT_CLF: str = "undefined" """ -*CLF* transform default genus, i.e. *undefined*. +*CLF* transform default genus, i.e., *undefined*. """ TRANSFORM_FILTERERS_DEFAULT_CLF: list = [] @@ -171,7 +171,7 @@ class CLFTransformID: Parameters ---------- clf_transform_id - *CLFtransformID*, e.g. + *CLFtransformID*, e.g., *urn:aswf:ocio:transformId:v1.0:ACES.OCIO.AP0_to_AP1-Gamma2pnt2.c1.v1*. Attributes @@ -211,7 +211,7 @@ def __init__(self, clf_transform_id: str) -> None: @property def clf_transform_id(self) -> str | None: """ - Getter property for the *CLFtransformID*, e.g. + Getter property for the *CLFtransformID*, e.g., *urn:aswf:ocio:transformId:v1.0:ACES.OCIO.AP0_to_AP1-Gamma2pnt2.c1.v1*. Returns @@ -230,7 +230,7 @@ def clf_transform_id(self) -> str | None: def urn(self) -> str | None: """ Getter property for the *CLFtransformID* Uniform Resource Name (*URN*), - e.g. *urn:aswf:ocio:transformId:v1.0*. + e.g., *urn:aswf:ocio:transformId:v1.0*. Returns ------- @@ -245,9 +245,9 @@ def urn(self) -> str | None: return self._urn @property - def type(self) -> str | None: # noqa: A003 + def type(self) -> str | None: """ - Getter property for the *CLFtransformID* type, e.g. *ACES*. + Getter property for the *CLFtransformID* type, e.g., *ACES*. Returns ------- @@ -264,7 +264,7 @@ def type(self) -> str | None: # noqa: A003 @property def namespace(self) -> str | None: """ - Getter property for the *CLFtransformID* namespace, e.g. *OCIO*. + Getter property for the *CLFtransformID* namespace, e.g., *OCIO*. Returns ------- @@ -281,7 +281,7 @@ def namespace(self) -> str | None: @property def name(self) -> str | None: """ - Getter property for the *CLFtransformID* name, e.g. + Getter property for the *CLFtransformID* name, e.g., *AP0_to_AP1-Gamma2pnt2*. Returns @@ -299,7 +299,7 @@ def name(self) -> str | None: @property def major_version(self) -> str | None: """ - Getter property for the *CLFtransformID* major version number, e.g. *c1*. + Getter property for the *CLFtransformID* major version number, e.g., *c1*. Returns ------- @@ -316,7 +316,7 @@ def major_version(self) -> str | None: @property def minor_version(self) -> str | None: """ - Getter property for the *CLFtransformID* minor version number, e.g. *v1*. + Getter property for the *CLFtransformID* minor version number, e.g., *v1*. Returns ------- @@ -458,11 +458,11 @@ class CLFTransform: path *CLF* transform path. family - *CLF* transform family, e.g. *aces* + *CLF* transform family, e.g., *aces* genus - *CLF* transform genus, e.g. *undefined* + *CLF* transform genus, e.g., *undefined* siblings - *CLF* transform siblings, e.g. inverse transform. + *CLF* transform siblings, e.g., inverse transform. Attributes ---------- @@ -531,7 +531,7 @@ def path(self) -> str | None: @property def code(self) -> str | None: """ - Getter property for the *CLF* transform code, i.e. the *CLF* transform + Getter property for the *CLF* transform code, i.e., the *CLF* transform file content. Returns @@ -542,7 +542,7 @@ def code(self) -> str | None: Notes ----- - This property is read only. - - This property contains the entire file content, i.e. the code along + - This property contains the entire file content, i.e., the code along with the comments. """ @@ -657,7 +657,7 @@ def information(self) -> dict: @property def family(self) -> str | None: """ - Getter property for the *CLF* transform family, e.g. *aces*, a value in + Getter property for the *CLF* transform family, e.g., *aces*, a value in :attr:`opencolorio_config_aces.clf.reference.\ TRANSFORM_FAMILIES_CLF` attribute dictionary. @@ -676,7 +676,7 @@ def family(self) -> str | None: @property def genus(self) -> str | None: """ - Getter property for the *CLF* transform genus, e.g. *undefined*. + Getter property for the *CLF* transform genus, e.g., *undefined*. Returns ------- @@ -693,7 +693,7 @@ def genus(self) -> str | None: @property def siblings(self) -> Sequence | None: """ - Getter property for the *CLF* transform siblings, e.g. inverse + Getter property for the *CLF* transform siblings, e.g., inverse transform. Returns @@ -813,9 +813,7 @@ def _parse(self) -> None: if input_descriptor is not None: self._input_descriptor = input_descriptor.text - output_descriptor = next( - iter(root.findall("./OutputDescriptor")), None - ) + output_descriptor = next(iter(root.findall("./OutputDescriptor")), None) if output_descriptor is not None: self._output_descriptor = output_descriptor.text @@ -1011,9 +1009,7 @@ def stem(path: str) -> str: basename = stem(clf_transforms[0]) clf_transform_pairs[basename]["forward_transform"] = clf_transforms[0] if len(clf_transforms) > 1: - clf_transform_pairs[basename][ - "inverse_transform" - ] = clf_transforms[1] + clf_transform_pairs[basename]["inverse_transform"] = clf_transforms[1] clf_transform_pairs[basename]["forward_transform"].siblings.append( clf_transform_pairs[basename]["inverse_transform"] ) @@ -1081,7 +1077,7 @@ def discover_clf_transforms( def classify_clf_transforms( - unclassified_clf_transforms: defaultdict[str, list[str]] + unclassified_clf_transforms: defaultdict[str, list[str]], ) -> TypeClassifiedCLFTransforms: """ Classify given *CLF* transforms. @@ -1135,9 +1131,7 @@ def classify_clf_transforms( genus = TRANSFORM_GENUS_DEFAULT_CLF if not genus else "/".join(genus) - for basename, pairs in find_clf_transform_pairs( - clf_transforms - ).items(): + for basename, pairs in find_clf_transform_pairs(clf_transforms).items(): if len(pairs) == 1: clf_transform = CLFTransform( cast(str, next(iter(pairs.values()))), @@ -1145,13 +1139,9 @@ def classify_clf_transforms( genus, ) - logger.debug( - 'Classifying "%s" under "%s".', clf_transform, genus - ) + logger.debug('Classifying "%s" under "%s".', clf_transform, genus) - classified_clf_transforms[family][genus][ - basename - ] = clf_transform + classified_clf_transforms[family][genus][basename] = clf_transform elif len(pairs) == 2: forward_clf_transform = CLFTransform( @@ -1165,13 +1155,9 @@ def classify_clf_transforms( forward_clf_transform, inverse_clf_transform ) - logger.debug( - 'Classifying "%s" under "%s".', clf_transform, genus - ) + logger.debug('Classifying "%s" under "%s".', clf_transform, genus) - classified_clf_transforms[family][genus][ - basename - ] = clf_transform + classified_clf_transforms[family][genus][basename] = clf_transform return vivified_to_dict(classified_clf_transforms) @@ -1213,19 +1199,14 @@ def unclassify_clf_transforms( if isinstance(clf_transform, CLFTransform): unclassified_clf_transforms.append(clf_transform) elif isinstance(clf_transform, CLFTransformPair): - unclassified_clf_transforms.append( - clf_transform.forward_transform - ) - unclassified_clf_transforms.append( - clf_transform.inverse_transform - ) + unclassified_clf_transforms.append(clf_transform.forward_transform) + unclassified_clf_transforms.append(clf_transform.inverse_transform) return unclassified_clf_transforms def filter_clf_transforms( - clf_transforms: TypeClassifiedCLFTransforms - | TypeUnclassifiedCLFTransforms, + clf_transforms: TypeClassifiedCLFTransforms | TypeUnclassifiedCLFTransforms, filterers: Sequence[Callable] | None = None, ) -> list[CLFTransform]: """ @@ -1292,15 +1273,13 @@ def print_clf_taxonomy() -> None: by the :attr:`opencolorio_config_aces.clf.\ reference.ROOT_TRANSFORMS_CLF` attribute using the :func:`opencolorio_config_aces.discover_clf_transforms` definition. - - The *CLF* transforms are classified by *family* e.g. *aces*, and - *genus* e.g. *undefined* using the + - The *CLF* transforms are classified by *family* e.g., *aces*, and + *genus* e.g., *undefined* using the :func:`opencolorio_config_aces.classify_clf_transforms` definition. - The resulting data structure is printed. """ - classified_clf_transforms = classify_clf_transforms( - discover_clf_transforms() - ) + classified_clf_transforms = classify_clf_transforms(discover_clf_transforms()) for family, genera in classified_clf_transforms.items(): message_box(family, print_callable=logger.info) @@ -1325,18 +1304,12 @@ def print_clf_taxonomy() -> None: clf_transform.forward_transform.source, clf_transform.forward_transform.target, ) - if ( - clf_transform.forward_transform.clf_transform_id - is not None - ): + if clf_transform.forward_transform.clf_transform_id is not None: logger.info( '\t\tACEStransformID : "%s"', clf_transform.forward_transform.clf_transform_id.clf_transform_id, ) - if ( - clf_transform.inverse_transform.clf_transform_id - is not None - ): + if clf_transform.inverse_transform.clf_transform_id is not None: logger.info( '\t\tACEStransformID : "%s"', clf_transform.inverse_transform.clf_transform_id.clf_transform_id, diff --git a/opencolorio_config_aces/clf/transforms/arri/generate.py b/opencolorio_config_aces/clf/transforms/arri/generate.py index 15cd8e96..d4013772 100644 --- a/opencolorio_config_aces/clf/transforms/arri/generate.py +++ b/opencolorio_config_aces/clf/transforms/arri/generate.py @@ -11,11 +11,12 @@ """ import logging -import PyOpenColorIO as ocio import sys from math import log, log10 from pathlib import Path +import PyOpenColorIO as ocio + from opencolorio_config_aces.clf.transforms import ( clf_basename, format_clf_transform_id, @@ -70,9 +71,7 @@ def _build_awg3_mtx(): *OpenColorIO* `MatrixTransform`. """ - mtx = matrix_RGB_to_RGB_transform( - "ALEXA Wide Gamut", "ACES2065-1", "CAT02" - ) + mtx = matrix_RGB_to_RGB_transform("ALEXA Wide Gamut", "ACES2065-1", "CAT02") return mtx @@ -101,9 +100,7 @@ def _build_logc3_curve(ei=800, info=False): """ if not (160 <= ei <= 1280): - raise ValueError( - f"Unsupported EI{ei:d} requested, must be 160 <= EI <= 1280" - ) + raise ValueError(f"Unsupported EI{ei:d} requested, must be 160 <= EI <= 1280") # v3_IDT_maker.py parameters nominalEI = 400 @@ -118,7 +115,7 @@ def _build_logc3_curve(ei=800, info=False): encGain = (log(gain) / log(2) * (0.89 - 1) / 3 + 1) * encodingGain encOffset = encodingOffset - for _ in range(0, 3): + for _ in range(3): nz = ((95 / 1023 - encOffset) / encGain - offset) / slope encOffset = encodingOffset - log10(1 + nz) * encGain @@ -273,9 +270,7 @@ def _generate_logc3_transforms(output_directory, ei_list=(800,)): aces_id = f"urn:ampas:aces:transformId:v1.5:IDT.ARRI.Alexa-v3-logC-EI{ei}.a1.v2" input_descriptor = f"ARRI LogC3 (EI{ei})" output_descriptor = "ACES2065-1" - clf_transform_id = format_clf_transform_id( - FAMILY, GENUS, name, VERSION - ) + clf_transform_id = format_clf_transform_id(FAMILY, GENUS, name, VERSION) filename = output_directory / clf_basename(clf_transform_id) transforms[filename] = generate_clf_transform( filename, @@ -291,9 +286,7 @@ def _generate_logc3_transforms(output_directory, ei_list=(800,)): name = f"ARRI_LogC3_Curve_EI{ei:d}_to_Linear" input_descriptor = f"ARRI LogC3 Curve (EI{ei:d})" output_descriptor = "Relative Scene Linear" - clf_transform_id = format_clf_transform_id( - FAMILY, GENUS, name, VERSION - ) + clf_transform_id = format_clf_transform_id(FAMILY, GENUS, name, VERSION) filename = output_directory / clf_basename(clf_transform_id) transforms[filename] = generate_clf_transform( filename, @@ -411,9 +404,7 @@ def generate_clf_transforms_arri(output_directory): output_directory.mkdir(parents=True, exist_ok=True) - logc3_transforms = _generate_logc3_transforms( - output_directory, ei_list=[800] - ) + logc3_transforms = _generate_logc3_transforms(output_directory, ei_list=[800]) logc4_transforms = _generate_logc4_transforms(output_directory) clf_transforms = {**logc3_transforms, **logc4_transforms} diff --git a/opencolorio_config_aces/clf/transforms/blackmagic/generate.py b/opencolorio_config_aces/clf/transforms/blackmagic/generate.py index ddf602b0..3ad15dfc 100644 --- a/opencolorio_config_aces/clf/transforms/blackmagic/generate.py +++ b/opencolorio_config_aces/clf/transforms/blackmagic/generate.py @@ -11,15 +11,16 @@ - :func:`opencolorio_config_aces.clf.generate_clf_transforms_davinci` """ -import PyOpenColorIO as ocio -from pathlib import Path import math +from pathlib import Path + +import PyOpenColorIO as ocio from opencolorio_config_aces.clf.transforms import ( clf_basename, - matrix_RGB_to_RGB_transform, format_clf_transform_id, generate_clf_transform, + matrix_RGB_to_RGB_transform, ) from opencolorio_config_aces.config import transform_factory @@ -114,9 +115,7 @@ def generate_clf_transforms_bmdfilm(output_directory): direction=ocio.TRANSFORM_DIR_INVERSE, ) - mtx = matrix_RGB_to_RGB_transform( - "Blackmagic Wide Gamut", "ACES2065-1", "CAT02" - ) + mtx = matrix_RGB_to_RGB_transform("Blackmagic Wide Gamut", "ACES2065-1", "CAT02") # Taking the color space name and IDT transform ID from: # https://github.com/ampas/aces-dev/pull/126/files @@ -234,9 +233,7 @@ def generate_clf_transforms_davinci(output_directory): direction=ocio.TRANSFORM_DIR_INVERSE, ) - mtx = matrix_RGB_to_RGB_transform( - "DaVinci Wide Gamut", "ACES2065-1", "CAT02" - ) + mtx = matrix_RGB_to_RGB_transform("DaVinci Wide Gamut", "ACES2065-1", "CAT02") # This transform is not yet part of aces-dev, but an ID will be needed for AMF. # Proposing the following ID: diff --git a/opencolorio_config_aces/clf/transforms/canon/generate.py b/opencolorio_config_aces/clf/transforms/canon/generate.py index 7424d305..98d7801a 100644 --- a/opencolorio_config_aces/clf/transforms/canon/generate.py +++ b/opencolorio_config_aces/clf/transforms/canon/generate.py @@ -78,8 +78,7 @@ def generate_clf_transforms_canon(output_directory): mtx = matrix_RGB_to_RGB_transform("Cinema Gamut", "ACES2065-1", "CAT02") aces_transform_id = ( - "urn:ampas:aces:transformId:v1.5:" - "ACEScsc.Academy.CLog2_CGamut_to_ACES.a1.1.0" + "urn:ampas:aces:transformId:v1.5:ACEScsc.Academy.CLog2_CGamut_to_ACES.a1.1.0" ) name = "CanonLog2_CinemaGamut-D55_to_ACES2065-1" @@ -100,8 +99,7 @@ def generate_clf_transforms_canon(output_directory): ) aces_transform_id = ( - "urn:ampas:aces:transformId:v1.5:" - "ACEScsc.Academy.CLog3_CGamut_to_ACES.a1.1.0" + "urn:ampas:aces:transformId:v1.5:ACEScsc.Academy.CLog3_CGamut_to_ACES.a1.1.0" ) name = "CanonLog3_CinemaGamut-D55_to_ACES2065-1" diff --git a/opencolorio_config_aces/clf/transforms/itu/generate.py b/opencolorio_config_aces/clf/transforms/itu/generate.py index af9c7783..c514697e 100644 --- a/opencolorio_config_aces/clf/transforms/itu/generate.py +++ b/opencolorio_config_aces/clf/transforms/itu/generate.py @@ -20,7 +20,6 @@ matrix_RGB_to_RGB_transform, ) - __author__ = "OpenColorIO Contributors" __copyright__ = "Copyright Contributors to the OpenColorIO Project." __license__ = "New BSD License - https://opensource.org/licenses/BSD-3-Clause" diff --git a/opencolorio_config_aces/clf/transforms/ocio/generate.py b/opencolorio_config_aces/clf/transforms/ocio/generate.py index d82f6335..a9ea7deb 100644 --- a/opencolorio_config_aces/clf/transforms/ocio/generate.py +++ b/opencolorio_config_aces/clf/transforms/ocio/generate.py @@ -20,7 +20,6 @@ matrix_RGB_to_RGB_transform, ) - __author__ = "OpenColorIO Contributors" __copyright__ = "Copyright Contributors to the OpenColorIO Project." __license__ = "New BSD License - https://opensource.org/licenses/BSD-3-Clause" diff --git a/opencolorio_config_aces/clf/transforms/panasonic/generate.py b/opencolorio_config_aces/clf/transforms/panasonic/generate.py index 8fdd5542..ab2ce50e 100644 --- a/opencolorio_config_aces/clf/transforms/panasonic/generate.py +++ b/opencolorio_config_aces/clf/transforms/panasonic/generate.py @@ -10,9 +10,10 @@ - :func:`opencolorio_config_aces.clf.generate_clf_transforms_panasonic` """ -import PyOpenColorIO as ocio from pathlib import Path +import PyOpenColorIO as ocio + from opencolorio_config_aces.clf.transforms import ( clf_basename, format_clf_transform_id, @@ -105,8 +106,7 @@ def generate_clf_transforms_panasonic(output_directory): # Using the CSC ID here because there is a slight discrepancy between the matrix # coefficients of the CSC and IDT CTL and the CLF matches the CSC transform. aces_transform_id = ( - "urn:ampas:aces:transformId:v1.5:" - "ACEScsc.Academy.VLog_VGamut_to_ACES.a1.1.0" + "urn:ampas:aces:transformId:v1.5:ACEScsc.Academy.VLog_VGamut_to_ACES.a1.1.0" ) # Generate full transform. diff --git a/opencolorio_config_aces/clf/transforms/red/generate.py b/opencolorio_config_aces/clf/transforms/red/generate.py index 089817cc..c4a1133e 100644 --- a/opencolorio_config_aces/clf/transforms/red/generate.py +++ b/opencolorio_config_aces/clf/transforms/red/generate.py @@ -10,9 +10,10 @@ - :func:`opencolorio_config_aces.clf.generate_clf_transforms_red` """ -import PyOpenColorIO as ocio from pathlib import Path +import PyOpenColorIO as ocio + from opencolorio_config_aces.clf.transforms import ( clf_basename, format_clf_transform_id, @@ -95,13 +96,10 @@ def generate_clf_transforms_red(output_directory): direction=ocio.TRANSFORM_DIR_INVERSE, ) - mtx = matrix_RGB_to_RGB_transform( - "REDWideGamutRGB", "ACES2065-1", "Bradford" - ) + mtx = matrix_RGB_to_RGB_transform("REDWideGamutRGB", "ACES2065-1", "Bradford") aces_transform_id = ( - "urn:ampas:aces:transformId:v1.5:" - "IDT.RED.Log3G10_REDWideGamutRGB.a1.v1" + "urn:ampas:aces:transformId:v1.5:IDT.RED.Log3G10_REDWideGamutRGB.a1.v1" ) # Generate full transform. diff --git a/opencolorio_config_aces/clf/transforms/sony/generate.py b/opencolorio_config_aces/clf/transforms/sony/generate.py index 7bab4a88..60a8dd4f 100644 --- a/opencolorio_config_aces/clf/transforms/sony/generate.py +++ b/opencolorio_config_aces/clf/transforms/sony/generate.py @@ -10,9 +10,10 @@ - :func:`opencolorio_config_aces.clf.generate_clf_transforms_sony` """ -import PyOpenColorIO as ocio from pathlib import Path +import PyOpenColorIO as ocio + from opencolorio_config_aces.clf.transforms import ( clf_basename, format_clf_transform_id, @@ -64,8 +65,7 @@ def _build_slog2_curve(): base = 10.0 logSideBreak = ab linSideBreak = ( - pow(base, (logSideBreak - logSideOffset) / logSideSlope) - - linSideOffset + pow(base, (logSideBreak - logSideOffset) / logSideSlope) - linSideOffset ) / linSideSlope lct = transform_factory( @@ -134,9 +134,7 @@ def _build_venice_sgamut3_mtx(): def _build_venice_sgamut3_cine_mtx(): """Build the `MatrixTransform` for the Venice S-Gamut3.Cine primaries.""" - mtx = matrix_RGB_to_RGB_transform( - "Venice S-Gamut3.Cine", "ACES2065-1", "CAT02" - ) + mtx = matrix_RGB_to_RGB_transform("Venice S-Gamut3.Cine", "ACES2065-1", "CAT02") return mtx diff --git a/opencolorio_config_aces/clf/transforms/utilities.py b/opencolorio_config_aces/clf/transforms/utilities.py index f41d4925..2fb8e19e 100644 --- a/opencolorio_config_aces/clf/transforms/utilities.py +++ b/opencolorio_config_aces/clf/transforms/utilities.py @@ -8,16 +8,17 @@ (CLF) transforms. """ -import PyOpenColorIO as ocio import logging import re -from opencolorio_config_aces.config import produce_transform, transform_factory +import PyOpenColorIO as ocio + from opencolorio_config_aces.clf.discover.classify import ( EXTENSION_CLF, SEPARATOR_ID_CLF, URN_CLF, ) +from opencolorio_config_aces.config import produce_transform, transform_factory from opencolorio_config_aces.utilities import required __author__ = "OpenColorIO Contributors" @@ -242,9 +243,7 @@ def generate_clf_transform( if style: info.addChildElement("BuiltinTransform", style) - logger.info( - 'Writing "%s" "CLF" transform to "%s".', clf_transform_id, filename - ) + logger.info('Writing "%s" "CLF" transform to "%s".', clf_transform_id, filename) group_tf.write( formatName="Academy/ASC Common LUT Format", @@ -305,9 +304,9 @@ def clf_basename(clf_transform_id): 'OCIO.Input.AP0_to_sRGB-Rec709.clf' """ - tokens = clf_transform_id.replace( - f"{URN_CLF}{SEPARATOR_ID_CLF}", "" - ).split(SEPARATOR_ID_CLF) + tokens = clf_transform_id.replace(f"{URN_CLF}{SEPARATOR_ID_CLF}", "").split( + SEPARATOR_ID_CLF + ) stem = ".".join(tokens[:-1]) stem = re.sub(r"\.Linear_to_", ".", stem) diff --git a/opencolorio_config_aces/config/cg/generate/config.py b/opencolorio_config_aces/config/cg/generate/config.py index 282ba009..55a2be53 100644 --- a/opencolorio_config_aces/config/cg/generate/config.py +++ b/opencolorio_config_aces/config/cg/generate/config.py @@ -13,23 +13,23 @@ import csv import logging import re - -import PyOpenColorIO as ocio from collections import defaultdict from pathlib import Path +import PyOpenColorIO as ocio + from opencolorio_config_aces.clf import ( - discover_clf_transforms, classify_clf_transforms, + discover_clf_transforms, unclassify_clf_transforms, ) from opencolorio_config_aces.config.generation import ( BUILTIN_TRANSFORMS, DEPENDENCY_VERSIONS, - DependencyVersions, - SEPARATOR_COLORSPACE_NAME, SEPARATOR_BUILTIN_TRANSFORM_NAME, SEPARATOR_COLORSPACE_FAMILY, + SEPARATOR_COLORSPACE_NAME, + DependencyVersions, beautify_alias, beautify_colorspace_name, colorspace_factory, @@ -49,8 +49,8 @@ ) from opencolorio_config_aces.utilities import ( attest, - validate_method, timestamp, + validate_method, ) __author__ = "OpenColorIO Contributors" @@ -235,9 +235,7 @@ def clf_transform_to_description( aces_transform_id = clf_transform.information.get("ACEStransformID") if aces_transform_id: aces_transform_id = aces_transform_id.aces_transform_id - description.append( - TEMPLATE_ACES_TRANSFORM_ID.format(aces_transform_id) - ) + description.append(TEMPLATE_ACES_TRANSFORM_ID.format(aces_transform_id)) if describe in ( DescriptionStyle.AMF, @@ -260,9 +258,7 @@ def clf_transform_to_description( return description -def clf_transform_to_family( - clf_transform, filtered_namespaces=FILTERED_NAMESPACES -): +def clf_transform_to_family(clf_transform, filtered_namespaces=FILTERED_NAMESPACES): """ Generate the *OpenColorIO* `Colorspace` or `NamedTransform` family for given *CLF* transform. @@ -313,7 +309,7 @@ def clf_transform_to_colorspace( *ACES* *AMF* components used to extend the *ACES* *CTL* transform description. signature_only : bool, optional - Whether to return the *OpenColorIO* `Colorspace` signature only, i.e. + Whether to return the *OpenColorIO* `Colorspace` signature only, i.e., the arguments for its instantiation. Other Parameters @@ -349,9 +345,7 @@ def clf_transform_to_colorspace( signature.update(kwargs) signature["aliases"] = list( - dict.fromkeys( - [beautify_alias(signature["name"])] + signature["aliases"] - ) + dict.fromkeys([beautify_alias(signature["name"])] + signature["aliases"]) ) if signature_only: @@ -383,7 +377,7 @@ def clf_transform_to_named_transform( description. signature_only : bool, optional Whether to return the *OpenColorIO* `NamedTransform` signature only, - i.e. the arguments for its instantiation. + i.e., the arguments for its instantiation. Other Parameters ---------------- @@ -421,9 +415,7 @@ def clf_transform_to_named_transform( signature.update(kwargs) signature["aliases"] = list( - dict.fromkeys( - [beautify_alias(signature["name"])] + signature["aliases"] - ) + dict.fromkeys([beautify_alias(signature["name"])] + signature["aliases"]) ) if signature_only: @@ -457,7 +449,7 @@ def style_to_colorspace( description. signature_only : bool, optional Whether to return the *OpenColorIO* view `Colorspace` signature only, - i.e. the arguments for its instantiation. + i.e., the arguments for its instantiation. scheme : str, optional {"Legacy", "Modern 1"}, Naming convention scheme to use. @@ -524,9 +516,7 @@ def style_to_colorspace( signature.update(**kwargs) signature["aliases"] = list( - dict.fromkeys( - [beautify_alias(signature["name"])] + signature["aliases"] - ) + dict.fromkeys([beautify_alias(signature["name"])] + signature["aliases"]) ) if signature_only: @@ -569,7 +559,7 @@ def style_to_named_transform( description. signature_only : bool, optional Whether to return the *OpenColorIO* view `Colorspace` signature only, - i.e. the arguments for its instantiation. + i.e., the arguments for its instantiation. scheme : str, optional {"Legacy", "Modern 1"}, Naming convention scheme to use. @@ -637,9 +627,7 @@ def style_to_named_transform( signature.update(**kwargs) signature["aliases"] = list( - dict.fromkeys( - [beautify_alias(signature["name"])] + signature["aliases"] - ) + dict.fromkeys([beautify_alias(signature["name"])] + signature["aliases"]) ) if signature_only: @@ -662,12 +650,12 @@ def style_to_named_transform( def config_basename_cg(dependency_versions): """ Generate the ACES* Computer Graphics (CG) *OpenColorIO* config - basename, i.e. the filename devoid of directory affix. + basename, i.e., the filename devoid of directory affix. Parameters ---------- dependency_versions: DependencyVersions - Dependency versions, e.g. *aces-dev*, *colorspaces*, and *OpenColorIO*. + Dependency versions, e.g., *aces-dev*, *colorspaces*, and *OpenColorIO*. Returns ------- @@ -692,7 +680,7 @@ def config_name_cg(dependency_versions): Parameters ---------- dependency_versions: DependencyVersions - Dependency versions, e.g. *aces-dev*, *colorspaces*, and *OpenColorIO*. + Dependency versions, e.g., *aces-dev*, *colorspaces*, and *OpenColorIO*. Returns ------- @@ -725,7 +713,7 @@ def config_description_cg( Parameters ---------- dependency_versions: DependencyVersions - Dependency versions, e.g. *aces-dev*, *colorspaces*, and *OpenColorIO*. + Dependency versions, e.g., *aces-dev*, *colorspaces*, and *OpenColorIO*. describe : int, optional Any value from the :class:`opencolorio_config_aces.DescriptionStyle` enum. @@ -779,7 +767,7 @@ def generate_config_cg( - The builtin *CLF* transforms are discovered and classified. - The CG config mapping file is parsed. - - The list of implicit colorspaces is built, e.g. *ACES2065-1*, + - The list of implicit colorspaces is built, e.g., *ACES2065-1*, *Raw*, etc... - The colorspaces, looks and view transforms are filtered according to the parsed CG config mapping file data. @@ -799,7 +787,7 @@ def generate_config_cg( *OpenColorIO* config file name, if given the config will be written to disk. dependency_versions: DependencyVersions, optional - Dependency versions, e.g. *aces-dev*, *colorspaces*, and *OpenColorIO*. + Dependency versions, e.g., *aces-dev*, *colorspaces*, and *OpenColorIO*. validate : bool, optional Whether to validate the config. describe : int, optional @@ -851,8 +839,7 @@ def clf_transform_from_id(clf_transform_id): filtered_clf_transforms = [ clf_transform for clf_transform in clf_transforms - if clf_transform.clf_transform_id.clf_transform_id - == clf_transform_id + if clf_transform.clf_transform_id.clf_transform_id == clf_transform_id ] clf_transform = next(iter(filtered_clf_transforms), None) @@ -884,9 +871,7 @@ def clf_transform_from_style(style): return clf_transform - logger.info( - 'Parsing "%s" config mapping file...', config_mapping_file_path - ) + logger.info('Parsing "%s" config mapping file...', config_mapping_file_path) config_mapping = defaultdict(list) with open(config_mapping_file_path) as csv_file: @@ -997,9 +982,7 @@ def transform_filterer(transform): def multi_filters(array, filterers): """Apply given filterers on given array.""" - filtered = [ - a for a in array if any(filterer(a) for filterer in filterers) - ] + filtered = [a for a in array if any(filterer(a) for filterer in filterers)] return filtered @@ -1012,17 +995,13 @@ def multi_filters(array, filterers): look_filterers = [implicit_transform_filterer, transform_filterer] data.looks = multi_filters(data.looks, look_filterers) - logger.info( - 'Filtered "Look" transforms: %s ', [a["name"] for a in data.looks] - ) + logger.info('Filtered "Look" transforms: %s ', [a["name"] for a in data.looks]) view_transform_filterers = [ implicit_transform_filterer, transform_filterer, ] - data.view_transforms = multi_filters( - data.view_transforms, view_transform_filterers - ) + data.view_transforms = multi_filters(data.view_transforms, view_transform_filterers) logger.info( 'Filtered "View" transforms: %s.', [a["name"] for a in data.view_transforms], @@ -1067,9 +1046,7 @@ def view_filterer(transform): logger.info('Filtered "View(s)": %s.', [a["view"] for a in data.views]) # Active Displays Filtering - data.active_displays = [ - a for a in data.active_displays if a in display_names - ] + data.active_displays = [a for a in data.active_displays if a in display_names] logger.info("Filtered active displays: %s.", data.active_displays) # Active Views Filtering @@ -1193,9 +1170,7 @@ def view_filterer(transform): data.roles.update( { ocio.ROLE_COLOR_PICKING: "sRGB - Texture", - ocio.ROLE_COLOR_TIMING: format_optional_prefix( - "ACEScct", "ACES", scheme - ), + ocio.ROLE_COLOR_TIMING: format_optional_prefix("ACEScct", "ACES", scheme), ocio.ROLE_COMPOSITING_LOG: format_optional_prefix( "ACEScct", "ACES", scheme ), @@ -1204,12 +1179,8 @@ def view_filterer(transform): ocio.ROLE_INTERCHANGE_SCENE: format_optional_prefix( "ACES2065-1", "ACES", scheme ), - ocio.ROLE_MATTE_PAINT: format_optional_prefix( - "ACEScct", "ACES", scheme - ), - ocio.ROLE_SCENE_LINEAR: format_optional_prefix( - "ACEScg", "ACES", scheme - ), + ocio.ROLE_MATTE_PAINT: format_optional_prefix("ACEScct", "ACES", scheme), + ocio.ROLE_SCENE_LINEAR: format_optional_prefix("ACEScg", "ACES", scheme), ocio.ROLE_TEXTURE_PAINT: "sRGB - Texture", } ) diff --git a/opencolorio_config_aces/config/cg/generate/resources/OpenColorIO-Config-ACES CG and Studio Transforms - v2 - CG Config - Mapping.csv b/opencolorio_config_aces/config/cg/generate/resources/OpenColorIO-Config-ACES CG and Studio Transforms - v2 - CG Config - Mapping.csv index 5b9a4bb4..2ab4282f 100644 --- a/opencolorio_config_aces/config/cg/generate/resources/OpenColorIO-Config-ACES CG and Studio Transforms - v2 - CG Config - Mapping.csv +++ b/opencolorio_config_aces/config/cg/generate/resources/OpenColorIO-Config-ACES CG and Studio Transforms - v2 - CG Config - Mapping.csv @@ -20,4 +20,4 @@ Ordering,Colorspace,Legacy,ACEStransformID,CLFtransformID,Interface,BuiltinTrans 420,Utility - sRGB - AP1 - Texture,FALSE,,urn:aswf:ocio:transformId:1.0:OCIO:Utility:AP0_to_sRGB_Encoded_AP1-Texture:1.0,ColorSpace,,srgb_ap1,sdr-video,"file-io,texture" 420,Utility - sRGB - P3-D65 - Texture,FALSE,,urn:aswf:ocio:transformId:1.0:OCIO:Utility:AP0_to_sRGB_Encoded_P3-D65-Texture:1.0,ColorSpace,,"srgb_p3d65,srgb_displayp3",sdr-video,"file-io,texture" 420,Utility - sRGB - Texture,TRUE,,urn:aswf:ocio:transformId:1.0:OCIO:Utility:AP0_to_sRGB-Texture:1.0,ColorSpace,,"srgb_texture,Input - Generic - sRGB - Texture",,"file-io,texture" -500,Utility - Look - Gamut Compress,FALSE,urn:ampas:aces:transformId:v1.5:LMT.Academy.ReferenceGamutCompress.a1.v1.0,,Look,,,, \ No newline at end of file +500,Utility - Look - Gamut Compress,FALSE,urn:ampas:aces:transformId:v1.5:LMT.Academy.ReferenceGamutCompress.a1.v1.0,,Look,,,, diff --git a/opencolorio_config_aces/config/cg/generate/tests/test_resources.py b/opencolorio_config_aces/config/cg/generate/tests/test_resources.py index 131c4efc..eaf2fd7d 100644 --- a/opencolorio_config_aces/config/cg/generate/tests/test_resources.py +++ b/opencolorio_config_aces/config/cg/generate/tests/test_resources.py @@ -7,11 +7,12 @@ import unittest + import requests from opencolorio_config_aces.config.cg.generate.config import ( - URL_EXPORT_TRANSFORMS_MAPPING_FILE_CG, PATH_TRANSFORMS_MAPPING_FILE_CG, + URL_EXPORT_TRANSFORMS_MAPPING_FILE_CG, ) __author__ = "OpenColorIO Contributors" diff --git a/opencolorio_config_aces/config/generation/common.py b/opencolorio_config_aces/config/generation/common.py index 565f22d9..6d4b7c71 100644 --- a/opencolorio_config_aces/config/generation/common.py +++ b/opencolorio_config_aces/config/generation/common.py @@ -14,12 +14,12 @@ """ import logging -import PyOpenColorIO as ocio from collections.abc import Mapping from dataclasses import asdict, dataclass, field + +import PyOpenColorIO as ocio from semver import Version -from opencolorio_config_aces.utilities import required from opencolorio_config_aces.config.generation import ( PROFILE_VERSION_DEFAULT, colorspace_factory, @@ -27,6 +27,7 @@ named_transform_factory, view_transform_factory, ) +from opencolorio_config_aces.utilities import required __author__ = "OpenColorIO Contributors" __copyright__ = "Copyright Contributors to the OpenColorIO Project." @@ -54,7 +55,7 @@ class ConfigData: Parameters ---------- profile_version : :class:`semver.Version`, optional - Config major and minor version, i.e. (1, 0) or (2, 0). + Config major and minor version, i.e., (1, 0) or (2, 0). name : unicode, optional Config name. description : unicode, optional @@ -124,13 +125,9 @@ class ConfigData: """ schema_version: Version = field(default_factory=lambda: Version(1, 0)) - profile_version: Version = field( - default_factory=lambda: PROFILE_VERSION_DEFAULT - ) + profile_version: Version = field(default_factory=lambda: PROFILE_VERSION_DEFAULT) name: str = field(default_factory=str) - description: str = ( - 'An "OpenColorIO" config generated by "OpenColorIO-Config-ACES".' - ) + description: str = 'An "OpenColorIO" config generated by "OpenColorIO-Config-ACES".' search_path: list = field(default_factory=list) roles: dict = field(default_factory=dict) colorspaces: list = field(default_factory=list) @@ -242,9 +239,7 @@ def generate_config(data, config_name=None, validate=True, base_config=None): config = base_config else: config = ocio.Config() - config.setVersion( - data.profile_version.major, data.profile_version.minor - ) + config.setVersion(data.profile_version.major, data.profile_version.minor) if data.name is not None: config.setName(data.name) @@ -293,9 +288,7 @@ def generate_config(data, config_name=None, validate=True, base_config=None): config.setInactiveColorSpaces(",".join(data.inactive_colorspaces)) for shared_view in data.shared_views: - display_colorspace = shared_view.get( - "display_colorspace", "" - ) + display_colorspace = shared_view.get("display_colorspace", "") looks = shared_view.get("looks") view_transform = shared_view.get("view_transform") rule = shared_view.get("rule") @@ -402,9 +395,7 @@ def generate_config(data, config_name=None, validate=True, base_config=None): extension, colorspace, ) - file_rules.insertRule( - rule_index, name, colorspace, pattern, extension - ) + file_rules.insertRule(rule_index, name, colorspace, pattern, extension) rule_index += 1 config.setFileRules(file_rules) @@ -434,9 +425,7 @@ def generate_config(data, config_name=None, validate=True, base_config=None): logging.basicConfig() logging.getLogger().setLevel(logging.INFO) - build_directory = ( - ROOT_BUILD_DEFAULT / "config" / "common" / "tests" - ).resolve() + build_directory = (ROOT_BUILD_DEFAULT / "config" / "common" / "tests").resolve() logger.info('Using "%s" build directory...', build_directory) @@ -448,8 +437,7 @@ def generate_config(data, config_name=None, validate=True, base_config=None): "name": "CCTF - sRGB", "family": "CCTF", "description": ( - 'WARNING: The sRGB "EOTF" is purposely incorrect and ' - "only a placeholder!" + 'WARNING: The sRGB "EOTF" is purposely incorrect and only a placeholder!"' ), "to_reference": { "transform_type": "ExponentTransform", @@ -706,9 +694,7 @@ def generate_config(data, config_name=None, validate=True, base_config=None): for display in displays ], active_displays=[display_1["name"], display_2["name"]], - active_views=[ - view_transform["name"] for view_transform in view_transforms - ] + active_views=[view_transform["name"] for view_transform in view_transforms] + ["Raw"], file_rules=[ { diff --git a/opencolorio_config_aces/config/generation/factories.py b/opencolorio_config_aces/config/generation/factories.py index f0c4c3f5..f770084e 100644 --- a/opencolorio_config_aces/config/generation/factories.py +++ b/opencolorio_config_aces/config/generation/factories.py @@ -15,14 +15,15 @@ - :func:`opencolorio_config_aces.produce_transform` """ -import re import logging -import PyOpenColorIO as ocio +import re +from collections.abc import Mapping, Sequence from pathlib import Path from pprint import pformat -from semver import Version from textwrap import indent -from collections.abc import Mapping, Sequence + +import PyOpenColorIO as ocio +from semver import Version from opencolorio_config_aces.config.generation import PROFILE_VERSION_DEFAULT from opencolorio_config_aces.utilities import DocstringDict, attest @@ -115,7 +116,7 @@ def colorspace_factory( is_data=None, reference_space=None, base_colorspace=None, - **kwargs, # noqa: ARG001 + **kwargs, ): """ *OpenColorIO* `Colorspace` factory. @@ -256,7 +257,7 @@ def named_transform_factory( forward_transform=None, inverse_transform=None, base_named_transform=None, - **kwargs, # noqa: ARG001 + **kwargs, ): """ *OpenColorIO* `NamedTransform` factory. @@ -302,9 +303,7 @@ def named_transform_factory( if base_named_transform is not None: if isinstance(base_named_transform, Mapping): - base_named_transform = named_transform_factory( - **base_named_transform - ) + base_named_transform = named_transform_factory(**base_named_transform) named_transform = base_named_transform else: @@ -359,7 +358,7 @@ def view_transform_factory( from_reference=None, reference_space=None, base_view_transform=None, - **kwargs, # noqa: ARG001 + **kwargs, ): """ *OpenColorIO* `ViewTransform` factory. @@ -450,7 +449,7 @@ def look_factory( forward_transform=None, inverse_transform=None, base_look=None, - **kwargs, # noqa: ARG001 + **kwargs, ): """ *OpenColorIO* `Look` factory. @@ -460,7 +459,7 @@ def look_factory( name : unicode *OpenColorIO* `Look` name. process_space : unicode, optional - *OpenColorIO* `Look` process space, e.g. *OpenColorIO* `Colorspace` or + *OpenColorIO* `Look` process space, e.g., *OpenColorIO* `Colorspace` or role name. description : unicode, optional *OpenColorIO* `Look` description. @@ -524,10 +523,10 @@ def transform_factory_setter(**kwargs): Other Parameters ---------------- name : unicode - *OpenColorIO* transform class/type name, e.g. ``CDLTransform``. + *OpenColorIO* transform class/type name, e.g., ``CDLTransform``. \\**kwargs : dict, optional Setter keywords arguments. They are converted to *camelCase* with *set* - prepended, e.g. `base_colorspace` is transformed into + prepended, e.g., `base_colorspace` is transformed into `setBaseColorspace`. Returns @@ -547,9 +546,7 @@ def transform_factory_setter(**kwargs): ) for kwarg, value in kwargs.items(): - method = re.sub( - r"(?!^)_([a-zA-Z])", lambda m: m.group(1).upper(), kwarg - ) + method = re.sub(r"(?!^)_([a-zA-Z])", lambda m: m.group(1).upper(), kwarg) method = f"set{method[0].upper()}{method[1:]}" if hasattr(transform, method): getattr(transform, method)(value) @@ -566,7 +563,7 @@ def transform_factory_constructor(**kwargs): Other Parameters ---------------- name : unicode - *OpenColorIO* transform class/type name, e.g. ``CDLTransform``. + *OpenColorIO* transform class/type name, e.g., ``CDLTransform``. \\**kwargs : dict, optional Keywords arguments that are evaluated directly in the constructor. diff --git a/opencolorio_config_aces/config/generation/version.py b/opencolorio_config_aces/config/generation/version.py index aa03b265..1f0ec0d5 100644 --- a/opencolorio_config_aces/config/generation/version.py +++ b/opencolorio_config_aces/config/generation/version.py @@ -12,9 +12,10 @@ - :attr:`opencolorio_config_aces.DEPENDENCY_VERSIONS` """ -from semver import Version from dataclasses import dataclass, field +from semver import Version + __author__ = "OpenColorIO Contributors" __copyright__ = "Copyright Contributors to the OpenColorIO Project." __license__ = "New BSD License - https://opensource.org/licenses/BSD-3-Clause" diff --git a/opencolorio_config_aces/config/reference/discover/classify.py b/opencolorio_config_aces/config/reference/discover/classify.py index 25ecbcde..5325b7a5 100644 --- a/opencolorio_config_aces/config/reference/discover/classify.py +++ b/opencolorio_config_aces/config/reference/discover/classify.py @@ -21,9 +21,10 @@ import os # TODO: Use "pathlib". import re import subprocess -from collections.abc import Mapping from collections import defaultdict +from collections.abc import Mapping from pathlib import Path + from semver import Version from opencolorio_config_aces.utilities import ( @@ -149,7 +150,7 @@ TRANSFORM_GENUS_DEFAULT_CTL = "undefined" """ -*ACES* *CTL* transform default genus, i.e. *undefined*. +*ACES* *CTL* transform default genus, i.e., *undefined*. TRANSFORM_GENUS_DEFAULT_CTL : unicode """ @@ -247,9 +248,7 @@ def patch_invalid_aces_transform_id(aces_transform_id): aces_transform_id = f"{URN_CTL}:{aces_transform_id}" if "Academy.P3D65_108nits_7.2nits_ST2084" in aces_transform_id: - logger.warning( - '"%s" has an invalid separator in "7.2nits"!', invalid_id - ) + logger.warning('"%s" has an invalid separator in "7.2nits"!', invalid_id) aces_transform_id = aces_transform_id.replace("7.2", "7") elif "P3D65_709limit_48nits" in aces_transform_id: @@ -266,9 +265,7 @@ def patch_invalid_aces_transform_id(aces_transform_id): ) elif "ACEScsc" in aces_transform_id: if "ACEScsc.Academy" not in aces_transform_id: - logger.warning( - '"%s" is missing "Academy" namespace!', invalid_id - ) + logger.warning('"%s" is missing "Academy" namespace!', invalid_id) aces_transform_id = aces_transform_id.replace( "ACEScsc", "ACEScsc.Academy" @@ -277,9 +274,7 @@ def patch_invalid_aces_transform_id(aces_transform_id): if aces_transform_id.endswith("a1.v1"): logger.warning('"%s" version scheme is invalid!', invalid_id) - aces_transform_id = aces_transform_id.replace( - "a1.v1", "a1.1.0" - ) + aces_transform_id = aces_transform_id.replace("a1.v1", "a1.1.0") return aces_transform_id @@ -287,9 +282,7 @@ def patch_invalid_aces_transform_id(aces_transform_id): ROOT_TRANSFORMS_CTL = os.path.normpath( os.environ.get( "OPENCOLORIO_CONFIG_CTL__CTL_TRANSFORMS_ROOT", - os.path.join( - os.path.dirname(__file__), "../", "aces-dev", "transforms", "ctl" - ), + os.path.join(os.path.dirname(__file__), "../", "aces-dev", "transforms", "ctl"), ) ) """ @@ -327,9 +320,7 @@ def version_aces_dev(): optional_minor_and_patch=True, ) except Exception: # pragma: no cover - changelog_path = os.path.join( - ROOT_TRANSFORMS_CTL, "..", "..", "CHANGELOG.md" - ) + changelog_path = os.path.join(ROOT_TRANSFORMS_CTL, "..", "..", "CHANGELOG.md") if os.path.exists(changelog_path): with open(changelog_path) as changelog_file: for line in changelog_file.readlines(): @@ -369,7 +360,7 @@ class ACESTransformID: Parameters ---------- aces_transform_id : unicode - *ACEStransformID*, e.g. + *ACEStransformID*, e.g., *urn:ampas:aces:transformId:v1.5:ODT.Academy.DCDM.a1.0.3*. Attributes @@ -409,7 +400,7 @@ def __init__(self, aces_transform_id): @property def aces_transform_id(self): """ - Getter property for the *ACEStransformID*, e.g. + Getter property for the *ACEStransformID*, e.g., *urn:ampas:aces:transformId:v1.5:ODT.Academy.DCDM.a1.0.3*. Returns @@ -428,7 +419,7 @@ def aces_transform_id(self): def urn(self): """ Getter property for the *ACEStransformID* Uniform Resource Name (*URN*), - e.g. *urn:ampas:aces:transformId:v1.5*. + e.g., *urn:ampas:aces:transformId:v1.5*. Returns ------- @@ -443,9 +434,9 @@ def urn(self): return self._urn @property - def type(self): # noqa: A003 + def type(self): """ - Getter property for the *ACEStransformID* type, e.g. *ODT*. + Getter property for the *ACEStransformID* type, e.g., *ODT*. Returns ------- @@ -462,7 +453,7 @@ def type(self): # noqa: A003 @property def namespace(self): """ - Getter property for the *ACEStransformID* namespace, e.g. *Academy*. + Getter property for the *ACEStransformID* namespace, e.g., *Academy*. Returns ------- @@ -479,7 +470,7 @@ def namespace(self): @property def name(self): """ - Getter property for the *ACEStransformID* name, e.g. *DCDM*. + Getter property for the *ACEStransformID* name, e.g., *DCDM*. Returns ------- @@ -496,7 +487,7 @@ def name(self): @property def major_version(self): """ - Getter property for the *ACEStransformID* major version number, e.g. + Getter property for the *ACEStransformID* major version number, e.g., *a1*. Returns @@ -514,7 +505,7 @@ def major_version(self): @property def minor_version(self): """ - Getter property for the *ACEStransformID* minor version number, e.g. + Getter property for the *ACEStransformID* minor version number, e.g., *0*. Returns @@ -532,7 +523,7 @@ def minor_version(self): @property def patch_version(self): """ - Getterproperty for the *ACEStransformID* patch version number, e.g. *3*. + Getterproperty for the *ACEStransformID* patch version number, e.g., *3*. Returns ------- @@ -610,9 +601,7 @@ def _parse(self): if self._aces_transform_id is None: return - aces_transform_id = patch_invalid_aces_transform_id( - self._aces_transform_id - ) + aces_transform_id = patch_invalid_aces_transform_id(self._aces_transform_id) self._urn, components = aces_transform_id.rsplit(SEPARATOR_URN_CTL, 1) components = components.split(SEPARATOR_ID_CTL) @@ -686,8 +675,8 @@ def _parse(self): self._source, self._target = "ACES2065-1", self._name elif self._type == "InvRRTODT": self._source, self._target = self._name, "ACES2065-1" - else: - if self._type == "RRT": # noqa: PLR5501 + else: # noqa: PLR5501 + if self._type == "RRT": self._source, self._target = "ACES2065-1", "OCES" elif self._type == "InvRRT": self._source, self._target = "OCES", "ACES2065-1" @@ -703,11 +692,11 @@ class CTLTransform: path : unicode *ACES* *CTL* transform path. family : unicode, optional - *ACES* *CTL* transform family, e.g. *output_transform*. + *ACES* *CTL* transform family, e.g., *output_transform*. genus : unicode, optional - *ACES* *CTL* transform genus, e.g. *dcdm*. + *ACES* *CTL* transform genus, e.g., *dcdm*. siblings : array_like, optional - *ACES* *CTL* transform siblings, e.g. inverse transform. + *ACES* *CTL* transform siblings, e.g., inverse transform. Attributes ---------- @@ -766,7 +755,7 @@ def path(self): @property def code(self): """ - Getter property for the *ACES* *CTL* transform code, i.e. the *ACES* + Getter property for the *ACES* *CTL* transform code, i.e., the *ACES* *CTL* transform file content. Returns @@ -777,7 +766,7 @@ def code(self): Notes ----- - This property is read only. - - This property contains the entire file content, i.e. the code along + - This property contains the entire file content, i.e., the code along with the comments. """ @@ -838,7 +827,7 @@ def description(self): @property def family(self): """ - Getter property for the *ACES* *CTL* transform family, e.g. + Getter property for the *ACES* *CTL* transform family, e.g., *output_transform*, a value in :attr:`opencolorio_config_aces.config.reference.\ TRANSFORM_FAMILIES_CTL` attribute dictionary. @@ -858,7 +847,7 @@ def family(self): @property def genus(self): """ - Getter property for the *ACES* *CTL* transform genus, e.g. *dcdm*. + Getter property for the *ACES* *CTL* transform genus, e.g., *dcdm*. Returns ------- @@ -875,7 +864,7 @@ def genus(self): @property def siblings(self): """ - Getter property for the *ACES* *CTL* transform siblings, e.g. inverse + Getter property for the *ACES* *CTL* transform siblings, e.g., inverse transform. Returns @@ -1316,21 +1305,13 @@ def classify_aces_ctl_transforms(unclassified_ctl_transforms): genus = TRANSFORM_GENUS_DEFAULT_CTL if not genus else "/".join(genus) - for basename, pairs in find_ctl_transform_pairs( - ctl_transforms - ).items(): + for basename, pairs in find_ctl_transform_pairs(ctl_transforms).items(): if len(pairs) == 1: - ctl_transform = CTLTransform( - list(pairs.values())[0], family, genus - ) + ctl_transform = CTLTransform(next(iter(pairs.values())), family, genus) - logger.debug( - 'Classifying "%s" under "%s".', ctl_transform, genus - ) + logger.debug('Classifying "%s" under "%s".', ctl_transform, genus) - classified_ctl_transforms[family][genus][ - basename - ] = ctl_transform + classified_ctl_transforms[family][genus][basename] = ctl_transform elif len(pairs) == 2: forward_ctl_transform = CTLTransform( @@ -1347,13 +1328,9 @@ def classify_aces_ctl_transforms(unclassified_ctl_transforms): forward_ctl_transform, inverse_ctl_transform ) - logger.debug( - 'Classifying "%s" under "%s".', ctl_transform, genus - ) + logger.debug('Classifying "%s" under "%s".', ctl_transform, genus) - classified_ctl_transforms[family][genus][ - basename - ] = ctl_transform + classified_ctl_transforms[family][genus][basename] = ctl_transform return vivified_to_dict(classified_ctl_transforms) @@ -1392,12 +1369,8 @@ def unclassify_ctl_transforms(classified_ctl_transforms): if isinstance(ctl_transform, CTLTransform): unclassified_ctl_transforms.append(ctl_transform) elif isinstance(ctl_transform, CTLTransformPair): - unclassified_ctl_transforms.append( - ctl_transform.forward_transform - ) - unclassified_ctl_transforms.append( - ctl_transform.inverse_transform - ) + unclassified_ctl_transforms.append(ctl_transform.forward_transform) + unclassified_ctl_transforms.append(ctl_transform.inverse_transform) return unclassified_ctl_transforms @@ -1467,8 +1440,8 @@ def print_aces_taxonomy(): reference.ROOT_TRANSFORMS_CTL` attribute using the :func:`opencolorio_config_aces.discover_aces_ctl_transforms` definition. - - The *CTL* transforms are classified by *family* e.g. - *output_transform*, and *genus* e.g. *dcdm* using the + - The *CTL* transforms are classified by *family* e.g., + *output_transform*, and *genus* e.g., *dcdm* using the :func:`opencolorio_config_aces.classify_aces_ctl_transforms` definition. - The resulting data structure is printed. @@ -1536,9 +1509,7 @@ def generate_amf_components(ctl_transforms, raise_exception=False): with open(PATH_AMF_COMPONENTS_FILE) as json_file: content = json_file.readlines() content = json.loads( - "\n".join( - [line for line in content if not line.strip().startswith("//")] - ) + "\n".join([line for line in content if not line.strip().startswith("//")]) ) attest(content["header"]["schema_version"].split(".")[0] == "1") @@ -1603,8 +1574,7 @@ def generate_amf_components(ctl_transforms, raise_exception=False): for aces_transform_id, relations in amf_components.copy().items(): for relation in relations: amf_components[relation] = sorted( - {*relations, *amf_components[relation], aces_transform_id} - - {relation} + {*relations, *amf_components[relation], aces_transform_id} - {relation} ) return dict(amf_components) diff --git a/opencolorio_config_aces/config/reference/discover/graph.py b/opencolorio_config_aces/config/reference/discover/graph.py index 7ac8afb1..ff787029 100644 --- a/opencolorio_config_aces/config/reference/discover/graph.py +++ b/opencolorio_config_aces/config/reference/discover/graph.py @@ -105,13 +105,10 @@ def build_aces_conversion_graph(ctl_transforms): # Without enforcing a preferred source and target colourspaces, the # nodes do not necessarily have predictable source and target - # colourspaces which might be confusing, e.g. a node for an + # colourspaces which might be confusing, e.g., a node for an # "Output Transform" might have an "RGBmonitor_100nits_dim" source and # a "OCES" target. - if ( - family in ("csc", "input_transform", "lmt") - and source == "ACES2065-1" - ): + if family in ("csc", "input_transform", "lmt") and source == "ACES2065-1": logger.debug( '"%s" ctl transform from the "%s" family uses "%s" ' "as source, skipping!", @@ -143,9 +140,7 @@ def build_aces_conversion_graph(ctl_transforms): ) # Serializing the data for "Graphviz AGraph". - serialized = codecs.encode( - pickle.dumps(ctl_transform, 4), "base64" - ).decode() + serialized = codecs.encode(pickle.dumps(ctl_transform, 4), "base64").decode() for node in (source, target): if node not in graph.nodes(): @@ -248,7 +243,7 @@ def filter_nodes(graph, filterers=None): ... discover_aces_ctl_transforms()) >>> graph = build_aces_conversion_graph(ctl_transforms) >>> sorted(filter_nodes(graph, [lambda x: x.genus == 'p3']))[0] - 'InvRRTODT/P3D65_1000nits_15nits_ST2084' + 'ODT/P3D60_48nits' """ if filterers is None: @@ -300,7 +295,7 @@ def conversion_path(graph, source, target): path = nx.shortest_path(graph, source, target) - return [(a, b) for a, b in zip(path[:-1], path[1:])] + return list(zip(path[:-1], path[1:])) @required("NetworkX") @@ -371,23 +366,15 @@ def plot_aces_conversion_graph(graph, filename, prog="dot", args=""): node.attr.update(color="#4BA3C7", fillcolor="#81D4FA") ctl_transforms_lmt.append(node) - agraph.add_subgraph( - ctl_transforms_csc, name="cluster_ACEScsc", color="#00BCD4FF" - ) - agraph.add_subgraph( - ctl_transforms_idt, name="cluster_IDT", color="#B3BC6D" - ) - agraph.add_subgraph( - ctl_transforms_odt, name="cluster_ODT", color="#CA9B52" - ) + agraph.add_subgraph(ctl_transforms_csc, name="cluster_ACEScsc", color="#00BCD4FF") + agraph.add_subgraph(ctl_transforms_idt, name="cluster_IDT", color="#B3BC6D") + agraph.add_subgraph(ctl_transforms_odt, name="cluster_ODT", color="#CA9B52") agraph.add_subgraph( ctl_transforms_output_transform, name="cluster_OutputTransform", color="#C88719", ) - agraph.add_subgraph( - ctl_transforms_lmt, name="cluster_LMT", color="#4BA3C7" - ) + agraph.add_subgraph(ctl_transforms_lmt, name="cluster_LMT", color="#4BA3C7") agraph.edge_attr.update(color="#26323870") agraph.draw(filename, prog=prog, args=args) @@ -396,10 +383,10 @@ def plot_aces_conversion_graph(graph, filename, prog="dot", args=""): if __name__ == "__main__": - from opencolorio_config_aces.utilities import message_box - from opencolorio_config_aces.utilities import ROOT_BUILD_DEFAULT from pprint import pformat + from opencolorio_config_aces.utilities import ROOT_BUILD_DEFAULT, message_box + logging.basicConfig() logging.getLogger().setLevel(logging.INFO) @@ -423,9 +410,7 @@ def plot_aces_conversion_graph(graph, filename, prog="dot", args=""): message_box('Retrieving a Node from a "CTL" Transform') logger.info( - ctl_transform_to_node( - graph, node_to_ctl_transform(graph, "ODT/P3D60_48nits") - ) + ctl_transform_to_node(graph, node_to_ctl_transform(graph, "ODT/P3D60_48nits")) ) message_box('Filtering "output_transform" Family') diff --git a/opencolorio_config_aces/config/reference/discover/resources/ACES_AMF_Components.json b/opencolorio_config_aces/config/reference/discover/resources/ACES_AMF_Components.json index 47ce70aa..0f945a81 100644 --- a/opencolorio_config_aces/config/reference/discover/resources/ACES_AMF_Components.json +++ b/opencolorio_config_aces/config/reference/discover/resources/ACES_AMF_Components.json @@ -40,4 +40,4 @@ "urn:ampas:aces:transformId:v1.5:ACEScsc.Academy.ACES_to_LogC4.a1.1.0" ] } -} \ No newline at end of file +} diff --git a/opencolorio_config_aces/config/reference/generate/analytical.py b/opencolorio_config_aces/config/reference/generate/analytical.py index 8841cbfc..50e6c7e8 100644 --- a/opencolorio_config_aces/config/reference/generate/analytical.py +++ b/opencolorio_config_aces/config/reference/generate/analytical.py @@ -10,34 +10,35 @@ import itertools import logging + import PyOpenColorIO as ocio from opencolorio_config_aces.config.generation import ( BUILTIN_TRANSFORMS, DEPENDENCY_VERSIONS, - ConfigData, PROFILE_VERSION_DEFAULT, SEPARATOR_BUILTIN_TRANSFORM_NAME, SEPARATOR_COLORSPACE_NAME, - beautify_display_name, + ConfigData, DependencyVersions, + beautify_display_name, beautify_name, colorspace_factory, generate_config, ) -from opencolorio_config_aces.config.reference.discover.graph import ( - SEPARATOR_NODE_NAME_CTL, -) from opencolorio_config_aces.config.reference import ( DescriptionStyle, build_aces_conversion_graph, classify_aces_ctl_transforms, conversion_path, discover_aces_ctl_transforms, - filter_nodes, filter_ctl_transforms, + filter_nodes, node_to_ctl_transform, ) +from opencolorio_config_aces.config.reference.discover.graph import ( + SEPARATOR_NODE_NAME_CTL, +) from opencolorio_config_aces.config.reference.generate.config import ( COLORSPACE_OUTPUT_ENCODING_REFERENCE, COLORSPACE_SCENE_ENCODING_REFERENCE, @@ -124,10 +125,7 @@ def create_builtin_transform(style, profile_version=PROFILE_VERSION_DEFAULT): """ try: - if ( - BUILTIN_TRANSFORMS.get(style, PROFILE_VERSION_DEFAULT) - > profile_version - ): + if BUILTIN_TRANSFORMS.get(style, PROFILE_VERSION_DEFAULT) > profile_version: raise ValueError() # noqa: TRY301 builtin_transform = ocio.BuiltinTransform() @@ -191,12 +189,8 @@ def node_to_builtin_transform( if not path: return None - verbose_path = " --> ".join( - dict.fromkeys(itertools.chain.from_iterable(path)) - ) - logger.debug( - 'Creating "BuiltinTransform" with "%s" path.', verbose_path - ) + verbose_path = " --> ".join(dict.fromkeys(itertools.chain.from_iterable(path))) + logger.debug('Creating "BuiltinTransform" with "%s" path.', verbose_path) for edge in path: source, target = edge @@ -263,9 +257,7 @@ def node_to_colorspace( ctl_transform, describe=describe, scheme="Legacy", - to_reference=node_to_builtin_transform( - graph, node, profile_version, "Forward" - ), + to_reference=node_to_builtin_transform(graph, node, profile_version, "Forward"), from_reference=node_to_builtin_transform( graph, node, profile_version, "Reverse" ), @@ -283,7 +275,7 @@ def config_basename_aces(dependency_versions): Parameters ---------- dependency_versions: DependencyVersions - Dependency versions, e.g. *aces-dev*, *colorspaces*, and *OpenColorIO*. + Dependency versions, e.g., *aces-dev*, *colorspaces*, and *OpenColorIO*. Returns ------- @@ -305,7 +297,7 @@ def config_name_aces(dependency_versions): Parameters ---------- dependency_versions: DependencyVersions - Dependency versions, e.g. *aces-dev*, *colorspaces*, and *OpenColorIO*. + Dependency versions, e.g., *aces-dev*, *colorspaces*, and *OpenColorIO*. Returns ------- @@ -321,9 +313,7 @@ def config_name_aces(dependency_versions): ).format(**dependency_versions.to_regularised_versions()) -def config_description_aces( - dependency_versions, describe=DescriptionStyle.SHORT_UNION -): +def config_description_aces(dependency_versions, describe=DescriptionStyle.SHORT_UNION): """ Generate *aces-dev* reference implementation *OpenColorIO* config using the analytical *Graph* method description. @@ -331,7 +321,7 @@ def config_description_aces( Parameters ---------- dependency_versions: DependencyVersions - Dependency versions, e.g. *aces-dev*, *colorspaces*, and *OpenColorIO*. + Dependency versions, e.g., *aces-dev*, *colorspaces*, and *OpenColorIO*. describe : int, optional Any value from the :class:`opencolorio_config_aces.DescriptionStyle` enum. @@ -386,7 +376,7 @@ def generate_config_aces( *OpenColorIO* config file name, if given the config will be written to disk. dependency_versions: DependencyVersions, optional - Dependency versions, e.g. *aces-dev*, *colorspaces*, and *OpenColorIO*. + Dependency versions, e.g., *aces-dev*, *colorspaces*, and *OpenColorIO*. validate : bool, optional Whether to validate the config. describe : int, optional @@ -409,9 +399,7 @@ def generate_config_aces( instances. """ - logger.info( - 'Generating "%s" config...', config_name_aces(dependency_versions) - ) + logger.info('Generating "%s" config...', config_name_aces(dependency_versions)) ctl_transforms = discover_aces_ctl_transforms() classified_ctl_transforms = classify_aces_ctl_transforms(ctl_transforms) @@ -454,15 +442,11 @@ def generate_config_aces( raw_colorspace, ] - logger.info( - 'Implicit colorspaces: "%s"', [a.getName() for a in colorspaces] - ) + logger.info('Implicit colorspaces: "%s"', [a.getName() for a in colorspaces]) for family in ("csc", "input_transform", "lmt", "output_transform"): family_colourspaces = [] - for node in filter_nodes( - graph, [lambda x, family=family: x.family == family] - ): + for node in filter_nodes(graph, [lambda x, family=family: x.family == family]): if node in ( COLORSPACE_SCENE_ENCODING_REFERENCE, COLORSPACE_OUTPUT_ENCODING_REFERENCE, @@ -493,9 +477,9 @@ def generate_config_aces( ) if additional_data: - colorspaces_to_ctl_transforms[ - colorspace - ] = node_to_ctl_transform(graph, node) + colorspaces_to_ctl_transforms[colorspace] = node_to_ctl_transform( + graph, node + ) colorspaces += family_colourspaces @@ -549,9 +533,7 @@ def generate_config_aces( logging.basicConfig() logging.getLogger().setLevel(logging.INFO) - build_directory = ( - ROOT_BUILD_DEFAULT / "config" / "aces" / "analytical" - ).resolve() + build_directory = (ROOT_BUILD_DEFAULT / "config" / "aces" / "analytical").resolve() logger.info('Using "%s" build directory...', build_directory) diff --git a/opencolorio_config_aces/config/reference/generate/config.py b/opencolorio_config_aces/config/reference/generate/config.py index 39d80c6a..2af4f58f 100644 --- a/opencolorio_config_aces/config/reference/generate/config.py +++ b/opencolorio_config_aces/config/reference/generate/config.py @@ -12,19 +12,20 @@ import csv import logging -import PyOpenColorIO as ocio import re from collections import defaultdict from enum import Flag, auto from pathlib import Path +import PyOpenColorIO as ocio + from opencolorio_config_aces.config.generation import ( BUILTIN_TRANSFORMS, - ConfigData, DEPENDENCY_VERSIONS, - DependencyVersions, SEPARATOR_COLORSPACE_FAMILY, SEPARATOR_COLORSPACE_NAME, + ConfigData, + DependencyVersions, beautify_alias, beautify_colorspace_name, beautify_display_name, @@ -46,8 +47,8 @@ ) from opencolorio_config_aces.utilities import ( attest, - validate_method, timestamp, + validate_method, ) __author__ = "OpenColorIO Contributors" @@ -184,11 +185,7 @@ def format_optional_prefix(name, prefix, scheme="Modern 1"): scheme = validate_method(scheme, ["Legacy", "Modern 1"]) - return ( - f"{prefix}{SEPARATOR_COLORSPACE_NAME}{name}" - if scheme == "legacy" - else name - ) + return f"{prefix}{SEPARATOR_COLORSPACE_NAME}{name}" if scheme == "legacy" else name def format_swapped_affix(name, affix, scheme="Modern 1"): @@ -294,7 +291,7 @@ def ctl_transform_to_transform_family(ctl_transform, analytical=True): for. analytical : bool, optional Whether to generate the *OpenColorIO* transform family that - analytically matches the given *ACES* *CTL* transform, i.e. true to + analytically matches the given *ACES* *CTL* transform, i.e., true to the *aces-dev* reference but not necessarily user-friendly. Returns @@ -304,10 +301,7 @@ def ctl_transform_to_transform_family(ctl_transform, analytical=True): """ if analytical: - if ( - ctl_transform.family == "csc" - and ctl_transform.namespace == "Academy" - ): + if ctl_transform.family == "csc" and ctl_transform.namespace == "Academy": family = "CSC" elif ctl_transform.family == "input_transform": family = f"Input{SEPARATOR_COLORSPACE_FAMILY}{ctl_transform.genus}" @@ -315,18 +309,12 @@ def ctl_transform_to_transform_family(ctl_transform, analytical=True): family = "Output" elif ctl_transform.family == "lmt": family = "LMT" - else: - if ( # noqa: PLR5501 - ctl_transform.family == "csc" - and ctl_transform.namespace == "Academy" - ): + else: # noqa: PLR5501 + if ctl_transform.family == "csc" and ctl_transform.namespace == "Academy": if re.match("ACES|ADX", ctl_transform.name): family = "ACES" else: - family = ( - f"Input{SEPARATOR_COLORSPACE_FAMILY}" - f"{ctl_transform.genus}" - ) + family = f"Input{SEPARATOR_COLORSPACE_FAMILY}{ctl_transform.genus}" elif ctl_transform.family == "input_transform": family = f"Input{SEPARATOR_COLORSPACE_FAMILY}{ctl_transform.genus}" elif ctl_transform.family == "output_transform": @@ -415,25 +403,19 @@ def ctl_transform_to_description( if len(description) > 0: description.append("") - aces_transform_id = ( - ctl_transform.aces_transform_id.aces_transform_id - ) + aces_transform_id = ctl_transform.aces_transform_id.aces_transform_id if describe in ( DescriptionStyle.ACES, DescriptionStyle.ACES | DescriptionStyle.SHORT, DescriptionStyle.SHORT_UNION, ): - description.append( - TEMPLATE_ACES_TRANSFORM_ID.format(aces_transform_id) - ) + description.append(TEMPLATE_ACES_TRANSFORM_ID.format(aces_transform_id)) else: description.append("CTL Transform") description.append(f'{"=" * len(description[-1])}\n') description.append(f"{ctl_transform.description}\n") - description.append( - TEMPLATE_ACES_TRANSFORM_ID.format(aces_transform_id) - ) + description.append(TEMPLATE_ACES_TRANSFORM_ID.format(aces_transform_id)) if describe in ( DescriptionStyle.AMF, @@ -481,10 +463,10 @@ def ctl_transform_to_colorspace( description. analytical : bool, optional Whether to generate the *OpenColorIO* transform family that - analytically matches the given *ACES* *CTL* transform, i.e. true to + analytically matches the given *ACES* *CTL* transform, i.e., true to the *aces-dev* reference but not necessarily user-friendly. signature_only : bool, optional - Whether to return the *OpenColorIO* `Colorspace` signature only, i.e. + Whether to return the *OpenColorIO* `Colorspace` signature only, i.e., the arguments for its instantiation. scheme : str, optional {"Legacy", "Modern 1"}, @@ -509,18 +491,14 @@ def ctl_transform_to_colorspace( ) signature = { - "name": format_optional_prefix( - name, beautify_colorspace_name(family), scheme - ), + "name": format_optional_prefix(name, beautify_colorspace_name(family), scheme), "family": family, "description": description, } signature.update(kwargs) signature["aliases"] = list( - dict.fromkeys( - [beautify_alias(signature["name"])] + signature["aliases"] - ) + dict.fromkeys([beautify_alias(signature["name"])] + signature["aliases"]) ) if signature_only: @@ -556,10 +534,10 @@ def ctl_transform_to_look( description. analytical : bool, optional Whether to generate the *OpenColorIO* transform family that - analytically matches the given *ACES* *CTL* transform, i.e. true to + analytically matches the given *ACES* *CTL* transform, i.e., true to the *aces-dev* reference but not necessarily user-friendly. signature_only : bool, optional - Whether to return the *OpenColorIO* `Look` signature only, i.e. the + Whether to return the *OpenColorIO* `Look` signature only, i.e., the arguments for its instantiation. scheme : str, optional {"Legacy", "Modern 1"}, @@ -584,9 +562,7 @@ def ctl_transform_to_look( ) signature = { - "name": format_optional_prefix( - name, beautify_colorspace_name(family), scheme - ), + "name": format_optional_prefix(name, beautify_colorspace_name(family), scheme), "description": description, } signature.update(kwargs) @@ -626,7 +602,7 @@ class instances corresponding to the given style. description. signature_only : bool, optional Whether to return the *OpenColorIO* `ViewTransform` signature only, - i.e. the arguments for its instantiation. + i.e., the arguments for its instantiation. scheme : str, optional {"Legacy", "Modern 1"}, Naming convention scheme to use. @@ -688,8 +664,7 @@ class instances corresponding to the given style. ) else: description.append( - f"CTL Transform" - f'{"s" if len(aces_transform_ids) >= 2 else ""}' + f'CTL Transform{"s" if len(aces_transform_ids) >= 2 else ""}' ) description.append(f'{"=" * len(description[-1])}\n') @@ -700,9 +675,7 @@ class instances corresponding to the given style. f"{aces_descriptions[i]}\n\n" f"ACEStransformID: {aces_transform_id}\n" ) - for i, aces_transform_id in enumerate( - aces_transform_ids - ) + for i, aces_transform_id in enumerate(aces_transform_ids) ] ) ) @@ -716,9 +689,7 @@ class instances corresponding to the given style. for aces_transform_id in aces_transform_ids: amf_components_description.extend( [ - TEMPLATE_ACES_TRANSFORM_ID.format( - amf_aces_transform_id - ) + TEMPLATE_ACES_TRANSFORM_ID.format(amf_aces_transform_id) for amf_aces_transform_id in amf_components.get( aces_transform_id, [] ) @@ -779,7 +750,7 @@ def style_to_display_colorspace( `Colorspace` description. signature_only : bool, optional Whether to return the *OpenColorIO* display `Colorspace` signature only, - i.e. the arguments for its instantiation. + i.e., the arguments for its instantiation. scheme : str, optional {"Legacy", "Modern 1"}, Naming convention scheme to use. @@ -840,9 +811,7 @@ def style_to_display_colorspace( signature.update(kwargs) signature["aliases"] = list( - dict.fromkeys( - [beautify_alias(signature["name"])] + signature["aliases"] - ) + dict.fromkeys([beautify_alias(signature["name"])] + signature["aliases"]) ) if signature_only: @@ -887,12 +856,12 @@ def transform_data_aliases(transform_data): def config_basename_aces(dependency_versions): """ Generate the *aces-dev* reference implementation *OpenColorIO* config - basename, i.e. the filename devoid of directory affixe. + basename, i.e., the filename devoid of directory affixe. Parameters ---------- dependency_versions: DependencyVersions - Dependency versions, e.g. *aces-dev*, *colorspaces*, and *OpenColorIO*. + Dependency versions, e.g., *aces-dev*, *colorspaces*, and *OpenColorIO*. Returns ------- @@ -905,9 +874,9 @@ def config_basename_aces(dependency_versions): 'reference-config-v2.0.0_aces-v1.3_ocio-v2.0.ocio' """ - return ( - "reference-config-{colorspaces}_aces-{aces}_ocio-{ocio}.ocio" - ).format(**dependency_versions.to_regularised_versions()) + return ("reference-config-{colorspaces}_aces-{aces}_ocio-{ocio}.ocio").format( + **dependency_versions.to_regularised_versions() + ) def config_name_aces(dependency_versions): @@ -917,7 +886,7 @@ def config_name_aces(dependency_versions): Parameters ---------- dependency_versions: DependencyVersions - Dependency versions, e.g. *aces-dev*, *colorspaces*, and *OpenColorIO*. + Dependency versions, e.g., *aces-dev*, *colorspaces*, and *OpenColorIO*. Returns ------- @@ -939,9 +908,7 @@ def config_name_aces(dependency_versions): ).format(**dependency_versions.to_regularised_versions()) -def config_description_aces( - dependency_versions, describe=DescriptionStyle.SHORT_UNION -): +def config_description_aces(dependency_versions, describe=DescriptionStyle.SHORT_UNION): """ Generate the *aces-dev* reference implementation *OpenColorIO* config description. @@ -949,7 +916,7 @@ def config_description_aces( Parameters ---------- dependency_versions: DependencyVersions - Dependency versions, e.g. *aces-dev*, *colorspaces*, and *OpenColorIO*. + Dependency versions, e.g., *aces-dev*, *colorspaces*, and *OpenColorIO*. describe : int, optional Any value from the :class:`opencolorio_config_aces.DescriptionStyle` enum. @@ -1010,7 +977,7 @@ def generate_config_aces( *OpenColorIO* config file name, if given the config will be written to disk. dependency_versions: DependencyVersions, optional - Dependency versions, e.g. *aces-dev*, *colorspaces*, and *OpenColorIO*. + Dependency versions, e.g., *aces-dev*, *colorspaces*, and *OpenColorIO*. validate : bool, optional Whether to validate the config. describe : int, optional @@ -1020,7 +987,7 @@ def generate_config_aces( Path to the *CSV* mapping file used by the *Mapping* method. analytical : bool, optional Whether to generate *OpenColorIO* transform families that analytically - match the given *ACES* *CTL* transform, i.e. true to the *aces-dev* + match the given *ACES* *CTL* transform, i.e., true to the *aces-dev* reference but not necessarily user-friendly. scheme : str, optional {"Legacy", "Modern 1"}, @@ -1041,9 +1008,7 @@ def generate_config_aces( config_name_aces(dependency_versions), ) - logger.debug( - 'Using %s "Builtin" transforms...', list(BUILTIN_TRANSFORMS.keys()) - ) + logger.debug('Using %s "Builtin" transforms...', list(BUILTIN_TRANSFORMS.keys())) ctl_transforms = unclassify_ctl_transforms( classify_aces_ctl_transforms(discover_aces_ctl_transforms()) @@ -1052,9 +1017,7 @@ def generate_config_aces( logger.debug('Using %s "CTL" transforms...', ctl_transforms) - logger.info( - 'Parsing "%s" config mapping file...', config_mapping_file_path - ) + logger.info('Parsing "%s" config mapping file...', config_mapping_file_path) config_mapping = defaultdict(list) with open(config_mapping_file_path) as csv_file: @@ -1214,10 +1177,7 @@ def generate_config_aces( logger.info('Creating a "View" transform for "%s" style...', style) view_transform = style_to_view_transform( style, - [ - transform_data["ctl_transform"] - for transform_data in transforms_data - ], + [transform_data["ctl_transform"] for transform_data in transforms_data], describe, amf_components, signature_only=True, @@ -1229,9 +1189,7 @@ def generate_config_aces( view_transform_names.append(view_transform_name) for transform_data in transforms_data: - display_style = transform_data[ - "linked_display_colorspace_style" - ] + display_style = transform_data["linked_display_colorspace_style"] display = style_to_display_colorspace( display_style, @@ -1268,9 +1226,7 @@ def generate_config_aces( ctl_transform = transform_data["ctl_transform"] if transform_data["interface"] == "Look": - logger.info( - 'Creating a "Look" transform for "%s" style...', style - ) + logger.info('Creating a "Look" transform for "%s" style...', style) look = ctl_transform_to_look( ctl_transform, describe, @@ -1336,9 +1292,7 @@ def generate_config_aces( "view": "Raw", "colorspace": raw_colorspace["name"], } - logger.info( - 'Adding "%s" view to "%s" display.', raw_view["view"], display_name - ) + logger.info('Adding "%s" view to "%s" display.', raw_view["view"], display_name) views.append(raw_view) data = ConfigData( @@ -1356,9 +1310,7 @@ def generate_config_aces( "ACEScct", aces_family_prefix, scheme ), ocio.ROLE_DATA: raw_colorspace["name"], - ocio.ROLE_INTERCHANGE_DISPLAY: display_reference_colorspace[ - "name" - ], + ocio.ROLE_INTERCHANGE_DISPLAY: display_reference_colorspace["name"], ocio.ROLE_INTERCHANGE_SCENE: scene_reference_colorspace["name"], ocio.ROLE_RENDERING: format_optional_prefix( "ACEScg", aces_family_prefix, scheme @@ -1405,9 +1357,7 @@ def generate_config_aces( logging.basicConfig() logging.getLogger().setLevel(logging.INFO) - build_directory = ( - ROOT_BUILD_DEFAULT / "config" / "aces" / "reference" - ).resolve() + build_directory = (ROOT_BUILD_DEFAULT / "config" / "aces" / "reference").resolve() logger.info('Using "%s" build directory...', build_directory) @@ -1415,7 +1365,12 @@ def generate_config_aces( for dependency_versions in DEPENDENCY_VERSIONS: config_basename = config_basename_aces(dependency_versions) - (config, data, ctl_transforms, amf_components,) = generate_config_aces( + ( + config, + data, + ctl_transforms, + amf_components, + ) = generate_config_aces( config_name=build_directory / config_basename, dependency_versions=dependency_versions, analytical=False, diff --git a/opencolorio_config_aces/config/reference/generate/resources/OpenColorIO-Config-ACES Reference Transforms - v2 - Reference Config - Mapping.csv b/opencolorio_config_aces/config/reference/generate/resources/OpenColorIO-Config-ACES Reference Transforms - v2 - Reference Config - Mapping.csv index d1d69079..9fadcd13 100644 --- a/opencolorio_config_aces/config/reference/generate/resources/OpenColorIO-Config-ACES Reference Transforms - v2 - Reference Config - Mapping.csv +++ b/opencolorio_config_aces/config/reference/generate/resources/OpenColorIO-Config-ACES Reference Transforms - v2 - Reference Config - Mapping.csv @@ -37,4 +37,4 @@ Ordering,ACEStransformID,Colorspace,Legacy,BuiltinTransform Style,Linked Display 470,urn:ampas:aces:transformId:v1.5:ODT.Academy.P3DCI_48nits.a1.0.3,Output - P3-DCI (D60 simulation),FALSE,ACES-OUTPUT - ACES2065-1_to_CIE-XYZ-D65 - SDR-CINEMA-D60sim-DCI_1.0,DISPLAY - CIE-XYZ-D65_to_G2.6-P3-DCI-BFD,ViewTransform,sdr-video,file-io, 471,urn:ampas:aces:transformId:v1.5:ODT.Academy.P3D65_D60sim_48nits.a1.1.0,Output - P3D65 (D60 simulation),FALSE,ACES-OUTPUT - ACES2065-1_to_CIE-XYZ-D65 - SDR-CINEMA-D60sim-D65_1.1,DISPLAY - CIE-XYZ-D65_to_G2.6-P3-D65,ViewTransform,sdr-video,file-io, 471,urn:ampas:aces:transformId:v1.5:ODT.Academy.P3DCI_D65sim_48nits.a1.1.0,Output - P3-DCI (D65 simulation),FALSE,ACES-OUTPUT - ACES2065-1_to_CIE-XYZ-D65 - SDR-CINEMA-D65sim-DCI_1.1,DISPLAY - CIE-XYZ-D65_to_G2.6-P3-DCI-BFD,ViewTransform,sdr-video,file-io, -480,urn:ampas:aces:transformId:v1.5:RRTODT.Academy.P3D65_108nits_7point2nits_ST2084.a1.1.0,Output - P3D65 ST2084 (108 nits),FALSE,ACES-OUTPUT - ACES2065-1_to_CIE-XYZ-D65 - HDR-CINEMA-108nit-7.2nit-P3lim_1.1,DISPLAY - CIE-XYZ-D65_to_ST2084-P3-D65,ViewTransform,hdr-video,file-io, \ No newline at end of file +480,urn:ampas:aces:transformId:v1.5:RRTODT.Academy.P3D65_108nits_7point2nits_ST2084.a1.1.0,Output - P3D65 ST2084 (108 nits),FALSE,ACES-OUTPUT - ACES2065-1_to_CIE-XYZ-D65 - HDR-CINEMA-108nit-7.2nit-P3lim_1.1,DISPLAY - CIE-XYZ-D65_to_ST2084-P3-D65,ViewTransform,hdr-video,file-io, diff --git a/opencolorio_config_aces/config/reference/generate/tests/test_resources.py b/opencolorio_config_aces/config/reference/generate/tests/test_resources.py index 4d7061cd..c5fc9eb9 100644 --- a/opencolorio_config_aces/config/reference/generate/tests/test_resources.py +++ b/opencolorio_config_aces/config/reference/generate/tests/test_resources.py @@ -7,11 +7,12 @@ import unittest + import requests from opencolorio_config_aces.config.reference.generate.config import ( - URL_EXPORT_TRANSFORMS_MAPPING_FILE_REFERENCE, PATH_TRANSFORMS_MAPPING_FILE_REFERENCE, + URL_EXPORT_TRANSFORMS_MAPPING_FILE_REFERENCE, ) __author__ = "OpenColorIO Contributors" diff --git a/opencolorio_config_aces/config/studio/generate/config.py b/opencolorio_config_aces/config/studio/generate/config.py index 9eba3daf..b575339d 100644 --- a/opencolorio_config_aces/config/studio/generate/config.py +++ b/opencolorio_config_aces/config/studio/generate/config.py @@ -14,6 +14,9 @@ import re from pathlib import Path +from opencolorio_config_aces.config.cg import ( + generate_config_cg, +) from opencolorio_config_aces.config.generation import ( DEPENDENCY_VERSIONS, DependencyVersions, @@ -22,9 +25,6 @@ from opencolorio_config_aces.config.reference import ( DescriptionStyle, ) -from opencolorio_config_aces.config.cg import ( - generate_config_cg, -) from opencolorio_config_aces.utilities import ( timestamp, validate_method, @@ -71,13 +71,13 @@ def config_basename_studio(dependency_versions): """ - Generate the ACES* Studio *OpenColorIO* config basename, i.e. the filename + Generate the ACES* Studio *OpenColorIO* config basename, i.e., the filename devoid of directory affixe. Parameters ---------- dependency_versions: DependencyVersions - Dependency versions, e.g. *aces-dev*, *colorspaces*, and *OpenColorIO*. + Dependency versions, e.g., *aces-dev*, *colorspaces*, and *OpenColorIO*. Returns ------- @@ -102,7 +102,7 @@ def config_name_studio(dependency_versions): Parameters ---------- dependency_versions: DependencyVersions - Dependency versions, e.g. *aces-dev*, *colorspaces*, and *OpenColorIO*. + Dependency versions, e.g., *aces-dev*, *colorspaces*, and *OpenColorIO*. Returns ------- @@ -134,7 +134,7 @@ def config_description_studio( Parameters ---------- dependency_versions: DependencyVersions - Dependency versions, e.g. *aces-dev*, *colorspaces*, and *OpenColorIO*. + Dependency versions, e.g., *aces-dev*, *colorspaces*, and *OpenColorIO*. describe : int, optional Any value from the :class:`opencolorio_config_aces.DescriptionStyle` enum. @@ -200,7 +200,7 @@ def generate_config_studio( *OpenColorIO* config file name, if given the config will be written to disk. dependency_versions: DependencyVersions, optional - Dependency versions, e.g. *aces-dev*, *colorspaces*, and *OpenColorIO*. + Dependency versions, e.g., *aces-dev*, *colorspaces*, and *OpenColorIO*. validate : bool, optional Whether to validate the config. describe : int, optional @@ -270,9 +270,7 @@ def generate_config_studio( logging.basicConfig() logging.getLogger().setLevel(logging.INFO) - build_directory = ( - ROOT_BUILD_DEFAULT / "config" / "aces" / "studio" - ).resolve() + build_directory = (ROOT_BUILD_DEFAULT / "config" / "aces" / "studio").resolve() logging.info('Using "%s" build directory...', build_directory) diff --git a/opencolorio_config_aces/config/studio/generate/resources/OpenColorIO-Config-ACES CG and Studio Transforms - v2 - Studio Config - Mapping.csv b/opencolorio_config_aces/config/studio/generate/resources/OpenColorIO-Config-ACES CG and Studio Transforms - v2 - Studio Config - Mapping.csv index 97856d6a..e0a4ae61 100644 --- a/opencolorio_config_aces/config/studio/generate/resources/OpenColorIO-Config-ACES CG and Studio Transforms - v2 - Studio Config - Mapping.csv +++ b/opencolorio_config_aces/config/studio/generate/resources/OpenColorIO-Config-ACES CG and Studio Transforms - v2 - Studio Config - Mapping.csv @@ -75,4 +75,4 @@ Ordering,Colorspace,Legacy,ACEStransformID,CLFtransformID,Interface,BuiltinTrans 420,Utility - sRGB - AP1 - Texture,FALSE,,urn:aswf:ocio:transformId:1.0:OCIO:Utility:AP0_to_sRGB_Encoded_AP1-Texture:1.0,ColorSpace,,srgb_ap1,sdr-video,"file-io,texture" 420,Utility - sRGB - P3-D65 - Texture,FALSE,,urn:aswf:ocio:transformId:1.0:OCIO:Utility:AP0_to_sRGB_Encoded_P3-D65-Texture:1.0,ColorSpace,,"srgb_p3d65,srgb_displayp3",sdr-video,"file-io,texture" 420,Utility - sRGB - Texture,TRUE,,urn:aswf:ocio:transformId:1.0:OCIO:Utility:AP0_to_sRGB-Texture:1.0,ColorSpace,,"srgb_texture,Input - Generic - sRGB - Texture",,"file-io,texture" -500,Utility - Look - Gamut Compress,FALSE,urn:ampas:aces:transformId:v1.5:LMT.Academy.ReferenceGamutCompress.a1.v1.0,,Look,,,, \ No newline at end of file +500,Utility - Look - Gamut Compress,FALSE,urn:ampas:aces:transformId:v1.5:LMT.Academy.ReferenceGamutCompress.a1.v1.0,,Look,,,, diff --git a/opencolorio_config_aces/config/studio/generate/tests/test_resources.py b/opencolorio_config_aces/config/studio/generate/tests/test_resources.py index e19b69c7..75dd4143 100644 --- a/opencolorio_config_aces/config/studio/generate/tests/test_resources.py +++ b/opencolorio_config_aces/config/studio/generate/tests/test_resources.py @@ -7,11 +7,12 @@ import unittest + import requests from opencolorio_config_aces.config.studio.generate.config import ( - URL_EXPORT_TRANSFORMS_MAPPING_FILE_STUDIO, PATH_TRANSFORMS_MAPPING_FILE_STUDIO, + URL_EXPORT_TRANSFORMS_MAPPING_FILE_STUDIO, ) __author__ = "OpenColorIO Contributors" diff --git a/opencolorio_config_aces/utilities/common.py b/opencolorio_config_aces/utilities/common.py index 26340bc2..4ba3e563 100644 --- a/opencolorio_config_aces/utilities/common.py +++ b/opencolorio_config_aces/utilities/common.py @@ -12,7 +12,6 @@ import logging import os import re -import requests import subprocess import unicodedata from collections import defaultdict @@ -22,6 +21,8 @@ from pprint import PrettyPrinter from textwrap import TextWrapper +import requests + __author__ = "OpenColorIO Contributors" __copyright__ = "Copyright Contributors to the OpenColorIO Project." __license__ = "New BSD License - https://opensource.org/licenses/BSD-3-Clause" @@ -70,7 +71,6 @@ def get(self, key, default=None): PrettyPrinter._dispatch = _dispatch() # pyright: ignore - ROOT_BUILD_DEFAULT = (Path(__file__) / ".." / ".." / ".." / "build").resolve() """ Default build root directory. @@ -166,9 +166,7 @@ def paths_common_ancestor(*args): '/Users/JohnDoe/Documents' """ - path_ancestor = os.sep.join( - common_ancestor(*[path.split(os.sep) for path in args]) - ) + path_ancestor = os.sep.join(common_ancestor(*[path.split(os.sep) for path in args])) return path_ancestor @@ -217,9 +215,7 @@ def vivified_to_dict(vivified): """ if isinstance(vivified, defaultdict): - vivified = { - key: vivified_to_dict(value) for key, value in vivified.items() - } + vivified = {key: vivified_to_dict(value) for key, value in vivified.items()} return vivified @@ -331,9 +327,7 @@ def is_colour_installed(raise_exception=False): except ImportError as error: # pragma: no cover if raise_exception: raise ImportError( - ( - '"Colour" related API features are not available: "{}".' - ).format(error) + f'"Colour" related API features are not available: "{error}".' ) from error return False @@ -365,10 +359,8 @@ def is_jsonpickle_installed(raise_exception=False): except ImportError as error: # pragma: no cover if raise_exception: raise ImportError( - ( - '"jsonpickle" related API features, e.g. serialization, ' - 'are not available: "{}".' - ).format(error) + f'"jsonpickle" related API features, ' + f'e.g., serialization, are not available: "{error}".' ) from error return False @@ -394,15 +386,13 @@ def is_networkx_installed(raise_exception=False): """ try: # pragma: no cover - import networkx # noqa: F401 + import networkx as nx # noqa: F401 return True except ImportError as error: # pragma: no cover if raise_exception: raise ImportError( - ( - '"NetworkX" related API features are not available: "{}".' - ).format(error) + f'"NetworkX" related API features are not available: "{error}".' ) from error return False @@ -624,9 +614,7 @@ def validate_method( valid_methods = [str(valid_method) for valid_method in valid_methods] method_lower = method.lower() - if method_lower not in [ - valid_method.lower() for valid_method in valid_methods - ]: + if method_lower not in [valid_method.lower() for valid_method in valid_methods]: raise ValueError(message.format(method, valid_methods)) return method_lower @@ -760,12 +748,9 @@ def timestamp(): :class:`str` """ - now = datetime.datetime.now(datetime.timezone.utc).strftime( - "%Y/%m/%d at %H:%M" - ) + now = datetime.datetime.now(datetime.timezone.utc).strftime("%Y/%m/%d at %H:%M") timestamp = ( - f'Generated with "OpenColorIO-Config-ACES" {git_describe()} ' - f"on the {now}." + f'Generated with "OpenColorIO-Config-ACES" {git_describe()} on the {now}.' ) return timestamp diff --git a/pyproject.toml b/pyproject.toml index 3342417f..e4937126 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -5,8 +5,8 @@ name = "opencolorio-config-aces" version = "2.0.0" description = "OpenColorIO Configuration for ACES" -authors = [ "OpenColorIO Contributors" ] -maintainers = [ "OpenColorIO Contributors " ] +authors = ["OpenColorIO Contributors"] +maintainers = ["OpenColorIO Contributors "] license = "BSD-3-Clause" readme = 'README.rst' repository = "https://github.com/AcademySoftwareFoundation/OpenColorIO-Config-ACES" @@ -32,10 +32,8 @@ networkx = "*" pygraphviz = "*" [tool.poetry.group.dev.dependencies] -black = "*" coverage = "*" coveralls = "*" -flynt = "*" invoke = "*" pre-commit = "*" pydata-sphinx-theme = "*" @@ -43,7 +41,6 @@ pyright = "*" pytest = "*" pytest-cov = "*" restructuredtext-lint = "*" -ruff = "*" sphinx = ">= 4, < 5" twine = "*" @@ -51,20 +48,18 @@ twine = "*" pydata-sphinx-theme = "*" sphinx = ">= 4, < 5" -[tool.black] -line-length = 79 -exclude = ''' -/( - \.git - | \.mypy_cache - | build - | dist - | opencolorio_config_aces/config/reference/aces-dev -)/ -''' - [tool.flynt] -line_length=999 +line_length = 999 + +[tool.isort] +ensure_newline_before_comments = true +force_grid_wrap = 0 +include_trailing_comma = true +line_length = 88 +multi_line_output = 3 +skip = ["__init__.py"] +split_on_trailing_comma = true +use_parentheses = true [tool.pyright] reportMissingImports = false @@ -76,54 +71,50 @@ reportUnsupportedDunderAll = false reportUnusedExpression = false exclude = ["**/aces-dev"] -[tool.mypy] -plugins = "numpy.typing.mypy_plugin" -ignore_missing_imports = true - [tool.ruff] target-version = "py39" line-length = 88 select = [ - "A", # flake8-builtins - "ARG", # flake8-unused-arguments + "A", # flake8-builtins + "ARG", # flake8-unused-arguments # "ANN", # flake8-annotations - "B", # flake8-bugbear + "B", # flake8-bugbear # "BLE", # flake8-blind-except - "C4", # flake8-comprehensions + "C4", # flake8-comprehensions # "C90", # mccabe # "COM", # flake8-commas - "DTZ", # flake8-datetimez - "D", # pydocstyle - "E", # pydocstyle + "DTZ", # flake8-datetimez + "D", # pydocstyle + "E", # pydocstyle # "ERA", # eradicate # "EM", # flake8-errmsg - "EXE", # flake8-executable - "F", # flake8 + "EXE", # flake8-executable + "F", # flake8 # "FBT", # flake8-boolean-trap - "G", # flake8-logging-format - "I", # isort - "ICN", # flake8-import-conventions - "INP", # flake8-no-pep420 - "ISC", # flake8-implicit-str-concat - "N", # pep8-naming + "G", # flake8-logging-format + "I", # isort + "ICN", # flake8-import-conventions + "INP", # flake8-no-pep420 + "ISC", # flake8-implicit-str-concat + "N", # pep8-naming # "PD", # pandas-vet - "PIE", # flake8-pie - "PGH", # pygrep-hooks - "PL", # pylint + "PIE", # flake8-pie + "PGH", # pygrep-hooks + "PL", # pylint # "PT", # flake8-pytest-style # "PTH", # flake8-use-pathlib [Enable] - "Q", # flake8-quotes - "RET", # flake8-return - "RUF", # Ruff - "S", # flake8-bandit - "SIM", # flake8-simplify - "T10", # flake8-debugger - "T20", # flake8-print + "Q", # flake8-quotes + "RET", # flake8-return + "RUF", # Ruff + "S", # flake8-bandit + "SIM", # flake8-simplify + "T10", # flake8-debugger + "T20", # flake8-print # "TCH", # flake8-type-checking - "TID", # flake8-tidy-imports - "TRY", # tryceratops - "UP", # pyupgrade - "W", # pydocstyle + "TID", # flake8-tidy-imports + "TRY", # tryceratops + "UP", # pyupgrade + "W", # pydocstyle "YTT" # flake8-2020 ] ignore = [ @@ -170,5 +161,5 @@ convention = "numpy" "utilities/*" = ["EXE001", "INP"] [build-system] -requires = [ "poetry>=0.12" ] +requires = ["poetry>=0.12"] build-backend = "poetry.masonry.api" diff --git a/requirements.txt b/requirements.txt index d95090d8..230672d1 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,81 +1,82 @@ accessible-pygments==0.0.4 ; python_version >= "3.9" and python_version < "3.12" -alabaster==0.7.13 ; python_version >= "3.9" and python_version < "3.12" -astor==0.8.1 ; python_version >= "3.9" and python_version < "3.12" -babel==2.12.1 ; python_version >= "3.9" and python_version < "3.12" -beautifulsoup4==4.12.2 ; python_version >= "3.9" and python_version < "3.12" -black==23.3.0 ; python_version >= "3.9" and python_version < "3.12" -bleach==6.0.0 ; python_version >= "3.9" and python_version < "3.12" -certifi==2023.5.7 ; python_version >= "3.9" and python_version < "3.12" -cffi==1.15.1 ; python_version >= "3.9" and python_version < "3.12" and sys_platform == "linux" -cfgv==3.3.1 ; python_version >= "3.9" and python_version < "3.12" -charset-normalizer==3.1.0 ; python_version >= "3.9" and python_version < "3.12" -click==8.1.3 ; python_version >= "3.9" and python_version < "3.12" -colorama==0.4.6 ; python_version >= "3.9" and python_version < "3.12" and (sys_platform == "win32" or platform_system == "Windows") -coverage==6.5.0 ; python_version >= "3.9" and python_version < "3.12" -coverage[toml]==6.5.0 ; python_version >= "3.9" and python_version < "3.12" -coveralls==3.3.1 ; python_version >= "3.9" and python_version < "3.12" -cryptography==41.0.1 ; python_version >= "3.9" and python_version < "3.12" and sys_platform == "linux" -distlib==0.3.6 ; python_version >= "3.9" and python_version < "3.12" +alabaster==0.7.16 ; python_version >= "3.9" and python_version < "3.12" +babel==2.14.0 ; python_version >= "3.9" and python_version < "3.12" +backports-tarfile==1.1.1 ; python_version >= "3.9" and python_version < "3.12" +beautifulsoup4==4.12.3 ; python_version >= "3.9" and python_version < "3.12" +certifi==2024.2.2 ; python_version >= "3.9" and python_version < "3.12" +cffi==1.16.0 ; python_version >= "3.9" and python_version < "3.12" and sys_platform == "linux" and platform_python_implementation != "PyPy" +cfgv==3.4.0 ; python_version >= "3.9" and python_version < "3.12" +charset-normalizer==3.3.2 ; python_version >= "3.9" and python_version < "3.12" +colorama==0.4.6 ; python_version >= "3.9" and python_version < "3.12" and sys_platform == "win32" +colour-science==0.4.4 ; python_version >= "3.9" and python_version < "3.12" +coverage==7.5.0 ; python_version >= "3.9" and python_version < "3.12" +coverage[toml]==7.5.0 ; python_version >= "3.9" and python_version < "3.12" +coveralls==1.8.0 ; python_version >= "3.9" and python_version < "3.12" +cryptography==42.0.5 ; python_version >= "3.9" and python_version < "3.12" and sys_platform == "linux" +distlib==0.3.8 ; python_version >= "3.9" and python_version < "3.12" docopt==0.6.2 ; python_version >= "3.9" and python_version < "3.12" docutils==0.17.1 ; python_version >= "3.9" and python_version < "3.12" -exceptiongroup==1.1.1 ; python_version >= "3.9" and python_version < "3.11" -filelock==3.12.0 ; python_version >= "3.9" and python_version < "3.12" -flynt==0.78 ; python_version >= "3.9" and python_version < "3.12" -identify==2.5.24 ; python_version >= "3.9" and python_version < "3.12" -idna==3.4 ; python_version >= "3.9" and python_version < "3.12" +exceptiongroup==1.2.1 ; python_version >= "3.9" and python_version < "3.11" +filelock==3.14.0 ; python_version >= "3.9" and python_version < "3.12" +identify==2.5.36 ; python_version >= "3.9" and python_version < "3.12" +idna==3.7 ; python_version >= "3.9" and python_version < "3.12" +imageio==2.34.1 ; python_version >= "3.9" and python_version < "3.12" imagesize==1.4.1 ; python_version >= "3.9" and python_version < "3.12" -importlib-metadata==6.6.0 ; python_version >= "3.9" and python_version < "3.12" +importlib-metadata==7.1.0 ; python_version >= "3.9" and python_version < "3.12" iniconfig==2.0.0 ; python_version >= "3.9" and python_version < "3.12" -invoke==2.1.2 ; python_version >= "3.9" and python_version < "3.12" -jaraco-classes==3.2.3 ; python_version >= "3.9" and python_version < "3.12" +invoke==2.2.0 ; python_version >= "3.9" and python_version < "3.12" +jaraco-classes==3.4.0 ; python_version >= "3.9" and python_version < "3.12" +jaraco-context==5.3.0 ; python_version >= "3.9" and python_version < "3.12" +jaraco-functools==4.0.1 ; python_version >= "3.9" and python_version < "3.12" jeepney==0.8.0 ; python_version >= "3.9" and python_version < "3.12" and sys_platform == "linux" -jinja2==3.1.2 ; python_version >= "3.9" and python_version < "3.12" -keyring==23.13.1 ; python_version >= "3.9" and python_version < "3.12" -markdown-it-py==2.2.0 ; python_version >= "3.9" and python_version < "3.12" -markupsafe==2.1.3 ; python_version >= "3.9" and python_version < "3.12" +jinja2==3.1.3 ; python_version >= "3.9" and python_version < "3.12" +jsonpickle==2.2.0 ; python_version >= "3.9" and python_version < "3.12" +keyring==25.2.0 ; python_version >= "3.9" and python_version < "3.12" +markdown-it-py==3.0.0 ; python_version >= "3.9" and python_version < "3.12" +markupsafe==2.1.5 ; python_version >= "3.9" and python_version < "3.12" mdurl==0.1.2 ; python_version >= "3.9" and python_version < "3.12" -more-itertools==9.1.0 ; python_version >= "3.9" and python_version < "3.12" -mypy-extensions==1.0.0 ; python_version >= "3.9" and python_version < "3.12" +more-itertools==10.2.0 ; python_version >= "3.9" and python_version < "3.12" +networkx==3.2.1 ; python_version >= "3.9" and python_version < "3.12" +nh3==0.2.17 ; python_version >= "3.9" and python_version < "3.12" nodeenv==1.8.0 ; python_version >= "3.9" and python_version < "3.12" -opencolorio==2.3.0 ; python_version >= "3.9" and python_version < "3.12" -packaging==23.1 ; python_version >= "3.9" and python_version < "3.12" -pathspec==0.11.1 ; python_version >= "3.9" and python_version < "3.12" -pkginfo==1.9.6 ; python_version >= "3.9" and python_version < "3.12" -platformdirs==3.5.1 ; python_version >= "3.9" and python_version < "3.12" -pluggy==1.0.0 ; python_version >= "3.9" and python_version < "3.12" -pre-commit==3.3.2 ; python_version >= "3.9" and python_version < "3.12" -pycparser==2.21 ; python_version >= "3.9" and python_version < "3.12" and sys_platform == "linux" +numpy==1.26.4 ; python_version >= "3.9" and python_version < "3.12" +opencolorio==2.3.2 ; python_version >= "3.9" and python_version < "3.12" +packaging==24.0 ; python_version >= "3.9" and python_version < "3.12" +pillow==10.3.0 ; python_version >= "3.9" and python_version < "3.12" +pkginfo==1.10.0 ; python_version >= "3.9" and python_version < "3.12" +platformdirs==4.2.1 ; python_version >= "3.9" and python_version < "3.12" +pluggy==1.5.0 ; python_version >= "3.9" and python_version < "3.12" +pre-commit==3.7.0 ; python_version >= "3.9" and python_version < "3.12" +pycparser==2.22 ; python_version >= "3.9" and python_version < "3.12" and sys_platform == "linux" and platform_python_implementation != "PyPy" pydata-sphinx-theme==0.13.3 ; python_version >= "3.9" and python_version < "3.12" -pygments==2.15.1 ; python_version >= "3.9" and python_version < "3.12" -pyright==1.1.331 ; python_version >= "3.9" and python_version < "3.12" -pytest-cov==4.1.0 ; python_version >= "3.9" and python_version < "3.12" -pytest==7.3.1 ; python_version >= "3.9" and python_version < "3.12" -pywin32-ctypes==0.2.0 ; python_version >= "3.9" and python_version < "3.12" and sys_platform == "win32" -pyyaml==6.0 ; python_version >= "3.9" and python_version < "3.12" -readme-renderer==37.3 ; python_version >= "3.9" and python_version < "3.12" -requests-toolbelt==1.0.0 ; python_version >= "3.9" and python_version < "3.12" +pygments==2.17.2 ; python_version >= "3.9" and python_version < "3.12" +pyright==1.1.361 ; python_version >= "3.9" and python_version < "3.12" +pytest==8.2.0 ; python_version >= "3.9" and python_version < "3.12" +pytest-cov==5.0.0 ; python_version >= "3.9" and python_version < "3.12" +pywin32-ctypes==0.2.2 ; python_version >= "3.9" and python_version < "3.12" and sys_platform == "win32" +pyyaml==6.0.1 ; python_version >= "3.9" and python_version < "3.12" +readme-renderer==43.0 ; python_version >= "3.9" and python_version < "3.12" requests==2.31.0 ; python_version >= "3.9" and python_version < "3.12" +requests-toolbelt==1.0.0 ; python_version >= "3.9" and python_version < "3.12" restructuredtext-lint==1.4.0 ; python_version >= "3.9" and python_version < "3.12" rfc3986==2.0.0 ; python_version >= "3.9" and python_version < "3.12" -rich==13.4.1 ; python_version >= "3.9" and python_version < "3.12" -ruff==0.0.272 ; python_version >= "3.9" and python_version < "3.12" +rich==13.7.1 ; python_version >= "3.9" and python_version < "3.12" +scipy==1.13.0 ; python_version >= "3.9" and python_version < "3.12" secretstorage==3.3.3 ; python_version >= "3.9" and python_version < "3.12" and sys_platform == "linux" -semver==3.0.1 ; python_version >= "3.9" and python_version < "3.12" -setuptools==67.8.0 ; python_version >= "3.9" and python_version < "3.12" -six==1.16.0 ; python_version >= "3.9" and python_version < "3.12" +semver==3.0.2 ; python_version >= "3.9" and python_version < "3.12" +setuptools==69.5.1 ; python_version >= "3.9" and python_version < "3.12" snowballstemmer==2.2.0 ; python_version >= "3.9" and python_version < "3.12" -soupsieve==2.4.1 ; python_version >= "3.9" and python_version < "3.12" +soupsieve==2.5 ; python_version >= "3.9" and python_version < "3.12" sphinx==4.5.0 ; python_version >= "3.9" and python_version < "3.12" -sphinxcontrib-applehelp==1.0.4 ; python_version >= "3.9" and python_version < "3.12" -sphinxcontrib-devhelp==1.0.2 ; python_version >= "3.9" and python_version < "3.12" -sphinxcontrib-htmlhelp==2.0.1 ; python_version >= "3.9" and python_version < "3.12" +sphinxcontrib-applehelp==1.0.8 ; python_version >= "3.9" and python_version < "3.12" +sphinxcontrib-devhelp==1.0.6 ; python_version >= "3.9" and python_version < "3.12" +sphinxcontrib-htmlhelp==2.0.5 ; python_version >= "3.9" and python_version < "3.12" sphinxcontrib-jsmath==1.0.1 ; python_version >= "3.9" and python_version < "3.12" -sphinxcontrib-qthelp==1.0.3 ; python_version >= "3.9" and python_version < "3.12" -sphinxcontrib-serializinghtml==1.1.5 ; python_version >= "3.9" and python_version < "3.12" -tomli==2.0.1 ; python_version >= "3.9" and python_version < "3.11" -twine==4.0.2 ; python_version >= "3.9" and python_version < "3.12" -typing-extensions==4.6.3 ; python_version >= "3.9" and python_version < "3.12" -urllib3==2.0.3 ; python_version >= "3.9" and python_version < "3.12" -virtualenv==20.23.0 ; python_version >= "3.9" and python_version < "3.12" -webencodings==0.5.1 ; python_version >= "3.9" and python_version < "3.12" -zipp==3.15.0 ; python_version >= "3.9" and python_version < "3.12" +sphinxcontrib-qthelp==1.0.7 ; python_version >= "3.9" and python_version < "3.12" +sphinxcontrib-serializinghtml==1.1.10 ; python_version >= "3.9" and python_version < "3.12" +tomli==2.0.1 ; python_version >= "3.9" and python_full_version <= "3.11.0a6" +twine==5.0.0 ; python_version >= "3.9" and python_version < "3.12" +typing-extensions==4.11.0 ; python_version >= "3.9" and python_version < "3.12" +urllib3==2.2.1 ; python_version >= "3.9" and python_version < "3.12" +virtualenv==20.26.1 ; python_version >= "3.9" and python_version < "3.12" +zipp==3.18.1 ; python_version >= "3.9" and python_version < "3.12" diff --git a/tasks.py b/tasks.py index e61dd8e1..f39ddde9 100644 --- a/tasks.py +++ b/tasks.py @@ -7,31 +7,31 @@ from __future__ import annotations +import contextlib +import inspect import os +from pathlib import Path -import contextlib import requests from invoke.exceptions import Failure -from pathlib import Path + import opencolorio_config_aces -from opencolorio_config_aces.config.reference.generate.config import ( - URL_EXPORT_TRANSFORMS_MAPPING_FILE_REFERENCE, -) from opencolorio_config_aces.config.cg.generate.config import ( URL_EXPORT_TRANSFORMS_MAPPING_FILE_CG, ) +from opencolorio_config_aces.config.reference.generate.config import ( + URL_EXPORT_TRANSFORMS_MAPPING_FILE_REFERENCE, +) from opencolorio_config_aces.config.studio.generate.config import ( URL_EXPORT_TRANSFORMS_MAPPING_FILE_STUDIO, ) from opencolorio_config_aces.utilities import google_sheet_title, message_box -import inspect - if not hasattr(inspect, "getargspec"): inspect.getargspec = inspect.getfullargspec # pyright: ignore -from invoke.tasks import task from invoke.context import Context +from invoke.tasks import task __author__ = "OpenColorIO Contributors" __copyright__ = "Copyright Contributors to the OpenColorIO Project." @@ -113,7 +113,7 @@ def clean( docs Whether to clean the *docs* directory. bytecode - Whether to clean the bytecode files, e.g. *.pyc* files. + Whether to clean the bytecode files, e.g., *.pyc* files. mypy Whether to clean the *Mypy* cache directory. pytest @@ -203,7 +203,7 @@ def tests(ctx: Context): @task(quality, precommit, tests) def preflight(ctx: Context): # noqa: ARG001 """ - Perform the preflight tasks, i.e. *formatting* and *quality*. + Perform the preflight tasks, i.e., *formatting* and *quality*. Parameters ---------- @@ -308,9 +308,7 @@ def build_config_reference_analytical(ctx: Context): Context. """ - message_box( - 'Building the "aces-dev" reference analytical "OpenColorIO" config...' - ) + message_box('Building the "aces-dev" reference analytical "OpenColorIO" config...') with ctx.cd("opencolorio_config_aces/config/reference/generate"): ctx.run("python analytical.py") @@ -339,15 +337,13 @@ def update_mapping_file_reference(ctx: Context): # noqa: ARG001 for csv_file in directory.glob("*Mapping.csv"): os.remove(csv_file) - filename = str( - directory / f"{title} - Reference Config - Mapping.csv" - ).replace('"', "") + filename = str(directory / f"{title} - Reference Config - Mapping.csv").replace( + '"', "" + ) with open(filename, "w") as csv_file: csv_file.write( - requests.get( - URL_EXPORT_TRANSFORMS_MAPPING_FILE_REFERENCE, timeout=60 - ).text + requests.get(URL_EXPORT_TRANSFORMS_MAPPING_FILE_REFERENCE, timeout=60).text ) @@ -385,22 +381,16 @@ def update_mapping_file_cg(ctx: Context): # noqa: ARG001 title = google_sheet_title(URL_EXPORT_TRANSFORMS_MAPPING_FILE_CG) - directory = Path( - "opencolorio_config_aces/config/cg/generate/resources/" - ).absolute() + directory = Path("opencolorio_config_aces/config/cg/generate/resources/").absolute() for csv_file in directory.glob("*Mapping.csv"): os.remove(csv_file) - filename = str(directory / f"{title} - CG Config - Mapping.csv").replace( - '"', "" - ) + filename = str(directory / f"{title} - CG Config - Mapping.csv").replace('"', "") with open(filename, "w") as csv_file: csv_file.write( - requests.get( - URL_EXPORT_TRANSFORMS_MAPPING_FILE_CG, timeout=60 - ).text + requests.get(URL_EXPORT_TRANSFORMS_MAPPING_FILE_CG, timeout=60).text ) @@ -415,9 +405,7 @@ def build_config_cg(ctx: Context): Context. """ - message_box( - 'Building the "ACES" Computer Graphics (CG) "OpenColorIO" config...' - ) + message_box('Building the "ACES" Computer Graphics (CG) "OpenColorIO" config...') with ctx.cd("opencolorio_config_aces/config/cg/generate"): ctx.run("python config.py") @@ -433,9 +421,7 @@ def update_mapping_file_studio(ctx: Context): # noqa: ARG001 Context. """ - message_box( - 'Updating the "ACES" Studio "OpenColorIO" config mapping file...' - ) + message_box('Updating the "ACES" Studio "OpenColorIO" config mapping file...') title = google_sheet_title(URL_EXPORT_TRANSFORMS_MAPPING_FILE_STUDIO) @@ -446,15 +432,13 @@ def update_mapping_file_studio(ctx: Context): # noqa: ARG001 for csv_file in directory.glob("*Mapping.csv"): os.remove(csv_file) - filename = str( - directory / f"{title} - Studio Config - Mapping.csv" - ).replace('"', "") + filename = str(directory / f"{title} - Studio Config - Mapping.csv").replace( + '"', "" + ) with open(filename, "w") as csv_file: csv_file.write( - requests.get( - URL_EXPORT_TRANSFORMS_MAPPING_FILE_STUDIO, timeout=60 - ).text + requests.get(URL_EXPORT_TRANSFORMS_MAPPING_FILE_STUDIO, timeout=60).text ) @@ -489,7 +473,8 @@ def requirements(ctx: Context): ctx.run( "poetry export -f requirements.txt " "--without-hashes " - "--with dev,docs,graphviz,optional " + # TODO: Reinstate "graphviz". + "--with dev,docs,optional " "--output requirements.txt" ) @@ -497,7 +482,8 @@ def requirements(ctx: Context): ctx.run( "poetry export -f requirements.txt " "--without-hashes " - "--with docs,graphviz,optional " + # TODO: Reinstate "graphviz". + "--with docs,optional " "--output docs/requirements.txt" ) diff --git a/utilities/resources/texlive.profile b/utilities/resources/texlive.profile index 8603d079..afaae0d5 100644 --- a/utilities/resources/texlive.profile +++ b/utilities/resources/texlive.profile @@ -27,4 +27,4 @@ tlpdbopt_post_code 1 tlpdbopt_sys_bin /usr/local/bin tlpdbopt_sys_info /usr/local/info tlpdbopt_sys_man /usr/local/man -tlpdbopt_w32_multi_user 1 \ No newline at end of file +tlpdbopt_w32_multi_user 1 diff --git a/utilities/tools/testclf/README.rst b/utilities/tools/testclf/README.rst index 810c7fa0..3380760f 100644 --- a/utilities/tools/testclf/README.rst +++ b/utilities/tools/testclf/README.rst @@ -9,15 +9,15 @@ Usage For full documentation, run: -`python testclf.py --help` +``python testclf.py --help`` To apply a CLF to an image, run: -`python testclf.py transform.clf input.exr -o output.exr` +``python testclf.py transform.clf input.exr -o output.exr`` To apply a CLF to one or more RGB float triplets, run: -`python testclf.py transform.clf R,G,B R,G,B ...` +``python testclf.py transform.clf R,G,B R,G,B ...`` which will print to the shell: @@ -26,16 +26,16 @@ R,G,B -> R,G,B R,G,B -> R,G,B ``` -To apply a CLF inverse, add the `-i` or `--inverse` option to either +To apply a CLF inverse, add the ``-i`` or ``--inverse`` option to either command. Dependencies ------------ * Python (>=3.7) -* `pip install requirements.txt` +* ``pip install requirements.txt`` * Installs [numpy](https://pypi.org/project/numpy/) * Installs [opencolorio](https://pypi.org/project/opencolorio/) * Installs [imageio](https://pypi.org/project/imageio/) -* `imageio_download_bin freeimage` +* ``imageio_download_bin freeimage`` * Installs [imageio FreeImage plugin](https://imageio.readthedocs.io/en/stable/_autosummary/imageio.plugins.freeimage.html) to enable OpenEXR support diff --git a/utilities/tools/testclf/requirements.txt b/utilities/tools/testclf/requirements.txt index bc71e937..7735154b 100644 --- a/utilities/tools/testclf/requirements.txt +++ b/utilities/tools/testclf/requirements.txt @@ -1,3 +1,3 @@ +imageio numpy opencolorio -imageio diff --git a/utilities/tools/testclf/testclf.py b/utilities/tools/testclf/testclf.py index 2941d3b1..7af50100 100644 --- a/utilities/tools/testclf/testclf.py +++ b/utilities/tools/testclf/testclf.py @@ -19,8 +19,8 @@ import sys import traceback -import numpy as np import imageio +import numpy as np import PyOpenColorIO as ocio __author__ = "OpenColorIO Contributors" @@ -48,7 +48,7 @@ def test_clf(clf_path, input_data, output_path, inverse=False): input_data : list[str] Single input image file path or one or more "," delimited RGB float triplet strings - (e.g. ["1.0,0.0,0.0", "0.0,0.1,0.0", "0,0,1"]). + (e.g., ["1.0,0.0,0.0", "0.0,0.1,0.0", "0,0,1"]). output_path : str, optional Output image file path, required when an input image file is specified. @@ -92,9 +92,7 @@ def test_clf(clf_path, input_data, output_path, inverse=False): file_tf = ocio.FileTransform( src=clf_path, interpolation=ocio.INTERP_BEST, - direction=ocio.TRANSFORM_DIR_INVERSE - if inverse - else ocio.TRANSFORM_DIR_FORWARD, + direction=ocio.TRANSFORM_DIR_INVERSE if inverse else ocio.TRANSFORM_DIR_FORWARD, ) proc = config.getProcessor(file_tf) cpu_proc = proc.getDefaultCPUProcessor() @@ -145,7 +143,7 @@ def test_clf(clf_path, input_data, output_path, inverse=False): type=str, nargs="+", help="Input image file or one or more ',' delimited RGB float triplets " - "(e.g. 1.0,0.0,0.0 0.0,0.1,0.0 0,0,1).", + "(e.g., 1.0,0.0,0.0 0.0,0.1,0.0 0,0,1).", ) parser.add_argument( "-o",