Skip to content

Commit

Permalink
Use colour checks configuration.
Browse files Browse the repository at this point in the history
  • Loading branch information
KelSolaar committed Jan 12, 2025
1 parent 4d4133b commit bdc3ac6
Show file tree
Hide file tree
Showing 23 changed files with 1,375 additions and 780 deletions.
34 changes: 17 additions & 17 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,24 +1,24 @@
# Common Files
*.egg-info
*.pyc
*.pyo
.DS_Store
.coverage*
.fleet
.idea
.ipynb_checkpoints
.vs
.vscode
.sandbox
uv.lock

__pycache__
# Common Directories
.fleet/
.idea/
.ipynb_checkpoints/
.python-version
.vs/
.vscode/
.sandbox/
build/
dist/
docs/_build/
docs/generated/
node_modules/
references/

build
dist
docs/_build
docs/_static/Basics_*.png
docs/_static/Examples_*.png
docs/_static/Plotting_*.png
docs/_static/Tutorial_*.png
docs/generated
poetry.lock
references
__pycache__
22 changes: 8 additions & 14 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: "v4.5.0"
rev: "v5.0.0"
hooks:
- id: check-added-large-files
- id: check-case-conflict
- id: check-merge-conflict
- id: check-symlinks
- id: check-yaml
exclude: config-aces-reference.ocio.yaml
- id: debug-statements
- id: end-of-file-fixer
- id: mixed-line-ending
Expand All @@ -16,35 +15,30 @@ repos:
- id: requirements-txt-fixer
- id: trailing-whitespace
- repo: https://github.com/codespell-project/codespell
rev: v2.2.6
rev: v2.3.0
hooks:
- id: codespell
args: ["--ignore-words-list=co-ordinates,exitance,fro,hart,ist"]
exclude: "BIBLIOGRAPHY.bib|CONTRIBUTORS.rst"
- repo: https://github.com/ikamensh/flynt
rev: "1.0.1"
hooks:
- id: flynt
args: [--verbose]
args: ["--ignore-words-list=socio-economic"]
exclude: "BIBLIOGRAPHY.bib|CONTRIBUTORS.rst|.*.ipynb"
- 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"
rev: "v0.8.2"
hooks:
- id: ruff-format
- id: ruff
args: [--fix]
- repo: https://github.com/adamchainz/blacken-docs
rev: 1.16.0
rev: 1.19.1
hooks:
- id: blacken-docs
language_version: python3.10
- repo: https://github.com/pre-commit/mirrors-prettier
rev: "v3.1.0"
rev: "v4.0.0-alpha.8"
hooks:
- id: prettier
exclude: config-aces-reference.ocio.yaml
- repo: https://github.com/pre-commit/pygrep-hooks
rev: "v1.10.0"
hooks:
Expand Down
4 changes: 2 additions & 2 deletions CONTRIBUTING.rst
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ If you would like to contribute to **Colour**, please refer to the following gui
About
-----

| **Colour** by Colour Developers
| Copyright 2013 Colour Developers – `[email protected] <[email protected]>`__
| **Colour - CLF IO** by Colour Developers
| Copyright 2024 Colour Developers – `[email protected] <[email protected]>`__
| This software is released under terms of BSD-3-Clause: https://opensource.org/licenses/BSD-3-Clause
| `https://github.com/colour-science/colour <https://github.com/colour-science/colour>`__
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Copyright 2013 Colour Developers
Copyright 2024 Colour Developers

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

Expand Down
2 changes: 1 addition & 1 deletion README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,6 @@ About
-----

| **Colour - CLF IO** by Colour Developers
| Copyright 2015 Colour Developers – `[email protected] <[email protected]>`__
| Copyright 2024 Colour Developers – `[email protected] <[email protected]>`__
| This software is released under terms of BSD-3-Clause: https://opensource.org/licenses/BSD-3-Clause
| `https://github.com/colour-science/colour-clf-io <https://github.com/colour-science/colour-clf-io>`__
119 changes: 66 additions & 53 deletions colour_clf_io/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,55 +18,17 @@

from __future__ import annotations

__application_name__ = "Colour - CLF IO"

__major_version__ = "0"
__minor_version__ = "0"
__change_version__ = "0"
__version__ = ".".join((__major_version__, __minor_version__, __change_version__))
import typing

if typing.TYPE_CHECKING:
from pathlib import Path

# Security issues in lxml should be addressed and no longer be a concern:
# NOTE: Security issues in lxml should be addressed and no longer be a concern:
# https://discuss.python.org/t/status-of-defusedxml-and-recommendation-in-docs/34762/6

__author__ = "Colour Developers"
__copyright__ = "Copyright 2013 Colour Developers"
__license__ = "BSD-3-Clause - https://opensource.org/licenses/BSD-3-Clause"
__maintainer__ = "Colour Developers"
__email__ = "[email protected]"
__status__ = "Production"

__all__ = [
"read_clf",
"parse_clf",
"LUT1D",
"LUT3D",
"ProcessNode",
"ProcessList",
"Matrix",
"Range",
"Exponent",
"ExponentStyle",
"ExponentParams",
"ASC_CDL",
"ASC_CDL_Style",
"SatNode",
"SOPNode",
"Interpolation1D",
"Interpolation3D",
"BitDepth",
"Channel",
"CalibrationInfo",
"Info",
"LogParams",
"LogStyle",
"RangeStyle",
"Log",
]

import lxml.etree

from .elements import (
Array,
CalibrationInfo,
ExponentParams,
ExponentStyle,
Expand All @@ -88,10 +50,61 @@
ProcessNode,
Range,
)
from .values import ASC_CDL_Style, BitDepth, Channel, Interpolation1D, Interpolation3D
from .values import (
ASC_CDL_Style,
BitDepth,
Channel,
Interpolation1D,
Interpolation3D,
)

__author__ = "Colour Developers"
__copyright__ = "Copyright 2024 Colour Developers"
__license__ = "BSD-3-Clause - https://opensource.org/licenses/BSD-3-Clause"
__maintainer__ = "Colour Developers"
__email__ = "[email protected]"
__status__ = "Production"

__all__ = [
"Array",
"CalibrationInfo",
"ExponentParams",
"ExponentStyle",
"Info",
"LogParams",
"LogStyle",
"RangeStyle",
"SatNode",
"SOPNode",
]
__all__ += ["ProcessList"]
__all__ += [
"ASC_CDL",
"LUT1D",
"LUT3D",
"Exponent",
"Log",
"Matrix",
"ProcessNode",
"Range",
]
__all__ += [
"ASC_CDL_Style",
"BitDepth",
"Channel",
"Interpolation1D",
"Interpolation3D",
]

__application_name__ = "Colour - CLF IO"

def read_clf(path) -> ProcessList:
__major_version__ = "0"
__minor_version__ = "1"
__change_version__ = "0"
__version__ = f"{__major_version__}.{__minor_version__}.{__change_version__}"


def read_clf(path: str | Path) -> ProcessList | None:
"""
Read given *CLF* file and return the resulting `ProcessList`.
Expand All @@ -108,15 +121,15 @@ def read_clf(path) -> ProcessList:
------
:class: ParsingError
If the given file does not contain a valid CLF document.
"""
xml = lxml.etree.parse(path) # noqa: S320

xml = lxml.etree.parse(str(path)) # noqa: S320
xml_process_list = xml.getroot()
root = ProcessList.from_xml(xml_process_list)
return root

return ProcessList.from_xml(xml_process_list)


def parse_clf(text):
def parse_clf(text: str | bytes) -> ProcessList | None:
"""
Read given string as a *CLF* document and return the resulting `ProcessList`.
Expand All @@ -133,8 +146,8 @@ def parse_clf(text):
------
:class: ParsingError
If the given string does not contain a valid CLF document.
"""

xml = lxml.etree.fromstring(text) # noqa: S320
root = ProcessList.from_xml(xml)
return root

return ProcessList.from_xml(xml)
Loading

0 comments on commit bdc3ac6

Please sign in to comment.