diff --git a/colour/constants/__init__.py b/colour/constants/__init__.py index e9898fd33..6e3a966eb 100644 --- a/colour/constants/__init__.py +++ b/colour/constants/__init__.py @@ -6,7 +6,7 @@ CONSTANT_PLANCK, ) from .common import ( - FLOATING_POINT_NUMBER_PATTERN, + PATTERN_FLOATING_POINT_NUMBER, INTEGER_THRESHOLD, EPSILON, DTYPE_INT_DEFAULT, @@ -28,7 +28,7 @@ "CONSTANT_PLANCK", ] __all__ += [ - "FLOATING_POINT_NUMBER_PATTERN", + "PATTERN_FLOATING_POINT_NUMBER", "INTEGER_THRESHOLD", "EPSILON", "DTYPE_INT_DEFAULT", diff --git a/colour/constants/common.py b/colour/constants/common.py index 924b10c06..6d5857233 100644 --- a/colour/constants/common.py +++ b/colour/constants/common.py @@ -26,7 +26,7 @@ __status__ = "Production" __all__ = [ - "FLOATING_POINT_NUMBER_PATTERN", + "PATTERN_FLOATING_POINT_NUMBER", "INTEGER_THRESHOLD", "EPSILON", "DTYPE_INT_DEFAULT", @@ -37,8 +37,8 @@ "TOLERANCE_RELATIVE_TESTS", ] -FLOATING_POINT_NUMBER_PATTERN: str = "[0-9]*\\.?[0-9]+([eE][-+]?[0-9]+)?" -"""float point number regex matching pattern.""" +PATTERN_FLOATING_POINT_NUMBER: str = "[0-9]*\\.?[0-9]+([eE][-+]?[0-9]+)?" +"""Floating point number regex matching pattern.""" INTEGER_THRESHOLD: float = 1e-3 if is_documentation_building(): # pragma: no cover diff --git a/colour/io/image.py b/colour/io/image.py index d1179d18a..e1a9c7982 100644 --- a/colour/io/image.py +++ b/colour/io/image.py @@ -268,12 +268,12 @@ def read_image_OpenImageIO( bit_depth_specification = MAPPING_BIT_DEPTH[bit_depth] image_input = ImageInput.open(path) - specification = image_input.spec() + image_specification = image_input.spec() shape = ( - specification.height, - specification.width, - specification.nchannels, + image_specification.height, + image_specification.width, + image_specification.nchannels, ) image = image_input.read_image(bit_depth_specification.openimageio) @@ -284,7 +284,7 @@ def read_image_OpenImageIO( if attributes: extra_attributes = [] - for attribute in specification.extra_attribs: + for attribute in image_specification.extra_attribs: extra_attributes.append( ImageAttribute_Specification( attribute.name, attribute.value, attribute.type @@ -557,7 +557,7 @@ def write_image_OpenImageIO( else: height, width, channels = image.shape - specification = ImageSpec( + image_specification = ImageSpec( width, height, channels, bit_depth_specification.openimageio ) for attribute in attributes: @@ -569,13 +569,13 @@ def write_image_OpenImageIO( ) type_ = attribute.type_ if attribute.type_ is None: - specification.attribute(name, value) + image_specification.attribute(name, value) else: - specification.attribute(name, type_, value) + image_specification.attribute(name, type_, value) image_output = ImageOutput.create(path) - image_output.open(path, specification) + image_output.open(path, image_specification) image_output.write_image(image) image_output.close() diff --git a/colour/notation/munsell.py b/colour/notation/munsell.py index 0d30adc89..a6e53cfcc 100644 --- a/colour/notation/munsell.py +++ b/colour/notation/munsell.py @@ -130,8 +130,8 @@ ) from colour.colorimetry import CCS_ILLUMINANTS, luminance_ASTMD1535 from colour.constants import ( - FLOATING_POINT_NUMBER_PATTERN, INTEGER_THRESHOLD, + PATTERN_FLOATING_POINT_NUMBER, TOLERANCE_ABSOLUTE_DEFAULT, TOLERANCE_RELATIVE_DEFAULT, ) @@ -225,12 +225,12 @@ "munsell_specification_to_xy", ] -MUNSELL_GRAY_PATTERN: str = f"N(?P{FLOATING_POINT_NUMBER_PATTERN})" +MUNSELL_GRAY_PATTERN: str = f"N(?P{PATTERN_FLOATING_POINT_NUMBER})" MUNSELL_COLOUR_PATTERN: str = ( - f"(?P{FLOATING_POINT_NUMBER_PATTERN})\\s*" + f"(?P{PATTERN_FLOATING_POINT_NUMBER})\\s*" f"(?PBG|GY|YR|RP|PB|B|G|Y|R|P)\\s*" - f"(?P{FLOATING_POINT_NUMBER_PATTERN})\\s*\\/\\s*" - f"(?P[-+]?{FLOATING_POINT_NUMBER_PATTERN})" + f"(?P{PATTERN_FLOATING_POINT_NUMBER})\\s*\\/\\s*" + f"(?P[-+]?{PATTERN_FLOATING_POINT_NUMBER})" ) MUNSELL_GRAY_FORMAT: str = "N{0}" diff --git a/docs/colour.constants.rst b/docs/colour.constants.rst index 83cc16df0..55e71f71e 100644 --- a/docs/colour.constants.rst +++ b/docs/colour.constants.rst @@ -39,7 +39,7 @@ Common .. autosummary:: :toctree: generated/ - FLOATING_POINT_NUMBER_PATTERN + PATTERN_FLOATING_POINT_NUMBER INTEGER_THRESHOLD EPSILON DTYPE_INT_DEFAULT diff --git a/pyproject.toml b/pyproject.toml index 9550c5b22..7f491b488 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -161,7 +161,8 @@ select = [ "PGH", # pygrep-hooks "PL", # pylint # "PT", # flake8-pytest-style - # "PTH", # flake8-use-pathlib [Enable] "Q", # flake8-quotes + # "PTH", # flake8-use-pathlib [Enable] + "Q", # flake8-quotes "RET", # flake8-return "RUF", # Ruff "S", # flake8-bandit