Skip to content

Commit

Permalink
Merge branch 'feature/v0.4.5' into develop
Browse files Browse the repository at this point in the history
  • Loading branch information
KelSolaar committed Oct 10, 2024
2 parents 1fafc5a + 046ad1a commit 7a72647
Show file tree
Hide file tree
Showing 12 changed files with 32 additions and 679 deletions.
55 changes: 1 addition & 54 deletions colour/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -462,8 +462,7 @@
get_domain_range_scale,
set_domain_range_scale,
)
from .utilities.deprecation import ModuleAPI, build_API_changes
from .utilities.documentation import is_documentation_building
from .utilities.deprecation import ModuleAPI
from .volume import (
OPTIMAL_COLOUR_STIMULI_ILLUMINANTS,
RGB_colourspace_limits,
Expand Down Expand Up @@ -935,58 +934,6 @@ def __getattr__(self, attribute) -> Any:
colour.__change_version__ = __change_version__ # pyright: ignore
colour.__version__ = __version__ # pyright: ignore

# v0.4.0
API_CHANGES = {
"ObjectRenamed": [
[
"colour.RGB_to_ICTCP",
"colour.RGB_to_ICtCp",
],
[
"colour.ICTCP_to_RGB",
"colour.ICtCp_to_RGB",
],
[
"colour.RGB_to_IGPGTG",
"colour.RGB_to_IgPgTg",
],
[
"colour.IGPGTG_to_RGB",
"colour.IgPgTg_to_RGB",
],
[
"colour.XYZ_to_JzAzBz",
"colour.XYZ_to_Jzazbz",
],
[
"colour.JzAzBz_to_XYZ",
"colour.Jzazbz_to_XYZ",
],
]
}

# v0.4.3
API_CHANGES["ObjectRenamed"].extend(
[
[
"colour.XYZ_to_IPT_Munish2021",
"colour.XYZ_to_IPT_Ragoo2021",
],
[
"colour.IPT_Munish2021_to_XYZ",
"colour.IPT_Ragoo2021_to_XYZ",
],
]
)
"""Defines the *colour.models* sub-package API changes."""

if not is_documentation_building():
sys.modules["colour"] = colour( # pyright: ignore
sys.modules["colour"], build_API_changes(API_CHANGES)
)

del ModuleAPI, is_documentation_building, build_API_changes

colour.__disable_lazy_load__ = True # pyright: ignore
__disable_lazy_load__ = colour.__disable_lazy_load__ # pyright: ignore
"""
Expand Down
49 changes: 5 additions & 44 deletions colour/algebra/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -118,56 +118,17 @@ def __getattr__(self, attribute) -> Any:
return super().__getattr__(attribute)


# v0.4.2
API_CHANGES = {
"ObjectFutureAccessChange": [
[
"colour.algebra.ellipse_coefficients_general_form",
"colour.geometry.ellipse_coefficients_general_form",
],
[
"colour.algebra.ellipse_coefficients_canonical_form",
"colour.geometry.ellipse_coefficients_canonical_form",
],
[
"colour.algebra.point_at_angle_on_ellipse",
"colour.geometry.point_at_angle_on_ellipse",
],
[
"colour.algebra.ellipse_fitting_Halir1998",
"colour.geometry.ellipse_fitting_Halir1998",
],
[
"colour.algebra.ELLIPSE_FITTING_METHODS",
"colour.geometry.ELLIPSE_FITTING_METHODS",
],
[
"colour.algebra.ellipse_fitting",
"colour.geometry.ellipse_fitting",
],
[
"colour.algebra.extend_line_segment",
"colour.geometry.extend_line_segment",
],
[
"colour.algebra.extend_line_segment",
"colour.geometry.intersect_line_segments",
],
# v0.4.5
API_CHANGES: dict = {
"ObjectRenamed": [
[
"colour.algebra.extend_line_segment",
"colour.geometry.LineSegmentsIntersections_Specification",
"colour.algebra.vector_dot",
"colour.algebra.vecmul",
],
]
}
"""Defines the *colour.algebra* sub-package API changes."""

# v0.4.5
API_CHANGES["ObjectRenamed"] = [
[
"colour.algebra.vector_dot",
"colour.algebra.vecmul",
],
]

API_CHANGES["ObjectRemoved"] = [ # pyright: ignore
"colour.algebra.matrix_dot",
Expand Down
42 changes: 0 additions & 42 deletions colour/biochemistry/__init__.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,3 @@
import sys

from colour.utilities.deprecation import ModuleAPI, build_API_changes
from colour.utilities.documentation import is_documentation_building

from colour.hints import Any

from .michaelis_menten import (
REACTION_RATE_MICHAELISMENTEN_METHODS,
reaction_rate_MichaelisMenten,
Expand All @@ -30,38 +23,3 @@
"reaction_rate_MichaelisMenten_Abebe2017",
"substrate_concentration_MichaelisMenten_Abebe2017",
]


# ----------------------------------------------------------------------------#
# --- API Changes and Deprecation Management ---#
# ----------------------------------------------------------------------------#
class biochemistry(ModuleAPI):
"""Define a class acting like the *biochemistry* module."""

def __getattr__(self, attribute) -> Any:
"""Return the value from the attribute with given name."""

return super().__getattr__(attribute)


# v0.4.0
API_CHANGES = {
"ObjectRenamed": [
[
"colour.biochemistry.reaction_rate_MichealisMenten",
"colour.biochemistry.reaction_rate_MichaelisMenten",
],
[
"colour.biochemistry.substrate_concentration_MichealisMenten",
"colour.biochemistry.substrate_concentration_MichaelisMenten",
],
]
}
"""Defines the *colour.biochemistry* sub-package API changes."""

if not is_documentation_building():
sys.modules["colour.biochemistry"] = biochemistry( # pyright: ignore
sys.modules["colour.biochemistry"], build_API_changes(API_CHANGES)
)

del ModuleAPI, is_documentation_building, build_API_changes, sys
39 changes: 0 additions & 39 deletions colour/characterisation/__init__.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,3 @@
import sys

from colour.utilities.deprecation import ModuleAPI, build_API_changes
from colour.utilities.documentation import is_documentation_building

from colour.hints import Any

from .cameras import RGB_CameraSensitivities
from .displays import RGB_DisplayPrimaries
from .datasets import * # noqa: F403
Expand Down Expand Up @@ -96,35 +89,3 @@
"matrix_idt",
"camera_RGB_to_ACES2065_1",
]


# ----------------------------------------------------------------------------#
# --- API Changes and Deprecation Management ---#
# ----------------------------------------------------------------------------#
class characterisation(ModuleAPI):
"""Define a class acting like the *characterisation* module."""

def __getattr__(self, attribute) -> Any:
"""Return the value from the attribute with given name."""

return super().__getattr__(attribute)


# v0.4.0
API_CHANGES = {
"ObjectRenamed": [
[
"colour.characterisation.optimisation_factory_JzAzBz",
"colour.characterisation.optimisation_factory_Jzazbz",
],
]
}
"""Defines the *colour.characterisation* sub-package API changes."""

if not is_documentation_building():
sys.modules["colour.characterisation"] = characterisation( # pyright: ignore
sys.modules["colour.characterisation"],
build_API_changes(API_CHANGES),
)

del ModuleAPI, is_documentation_building, build_API_changes, sys
43 changes: 1 addition & 42 deletions colour/colorimetry/datasets/cmfs.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@
RGB_ColourMatchingFunctions,
XYZ_ColourMatchingFunctions,
)
from colour.utilities import LazyCanonicalMapping, usage_warning
from colour.utilities import LazyCanonicalMapping

__author__ = "Colour Developers"
__copyright__ = "Copyright 2013 Colour Developers"
Expand Down Expand Up @@ -3254,47 +3254,6 @@
"CIE 1964 10 Degree Standard Observer"
]


# ----------------------------------------------------------------------------#
# --- API Changes and Deprecation Management ---#
# ----------------------------------------------------------------------------#
# v0.4.2
def _CIE_2012_2_Degree_Standard_Observer():
usage_warning(
'The "CIE 2012 2 Degree Standard Observer" has been renamed to '
'"CIE 2015 2 Degree Standard Observer" for consistency with the '
"official CIE name which was adopted in 2015."
)

return XYZ_ColourMatchingFunctions(
DATA_CMFS_STANDARD_OBSERVER["CIE 2015 2 Degree Standard Observer"],
name="CIE 2015 2 Degree Standard Observer",
display_name="CIE 2015 2$^\\circ$ Standard Observer",
)


def _CIE_2012_10_Degree_Standard_Observer():
usage_warning(
'The "CIE 2012 10 Degree Standard Observer" has been renamed to '
'"CIE 2015 10 Degree Standard Observer" for consistency with the '
"official CIE name which was adopted in 2015."
)

return XYZ_ColourMatchingFunctions(
DATA_CMFS_STANDARD_OBSERVER["CIE 2015 2 Degree Standard Observer"],
name="CIE 2015 2 Degree Standard Observer",
display_name="CIE 2015 2$^\\circ$ Standard Observer",
)


MSDS_CMFS_STANDARD_OBSERVER[
"CIE 2012 2 Degree Standard Observer"
] = _CIE_2012_2_Degree_Standard_Observer
MSDS_CMFS_STANDARD_OBSERVER[
"CIE 2012 10 Degree Standard Observer"
] = _CIE_2012_10_Degree_Standard_Observer
# ----------------------------------------------------------------------------#

MSDS_CMFS = LazyCanonicalMapping(MSDS_CMFS_LMS)
MSDS_CMFS.__doc__ = """
Multi-spectral distributions of the colour matching functions.
Expand Down
92 changes: 0 additions & 92 deletions colour/colorimetry/spectrum.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,10 +74,8 @@
optional,
runtime_warning,
tstack,
usage_warning,
validate_method,
)
from colour.utilities.deprecation import ObjectRenamed

if TYPE_CHECKING or is_pandas_installed():
from pandas import DataFrame, Series # pragma: no cover
Expand Down Expand Up @@ -1609,37 +1607,6 @@ def normalise(self, factor: Real = 1) -> Self:

return self

# ------------------------------------------------------------------------#
# --- API Changes and Deprecation Management ---#
# ------------------------------------------------------------------------#
@property
def strict_name(self): # pragma: no cover # noqa: D102
# Docstrings are omitted for documentation purposes.
usage_warning(
str(
ObjectRenamed(
"SpectralDistribution.strict_name",
"SpectralDistribution.display_name",
)
)
)

return self.display_name

@strict_name.setter
def strict_name(self, value): # pragma: no cover
# Docstrings are omitted for documentation purposes.
usage_warning(
str(
ObjectRenamed(
"SpectralDistribution.strict_name",
"SpectralDistribution.display_name",
)
)
)

self.display_name = value


class MultiSpectralDistributions(MultiSignals):
"""
Expand Down Expand Up @@ -2670,65 +2637,6 @@ def to_sds(self) -> List[SpectralDistribution]:
for signal in self.signals.values()
]

# ------------------------------------------------------------------------#
# --- API Changes and Deprecation Management ---#
# ------------------------------------------------------------------------#
@property
def strict_name(self): # pragma: no cover # noqa: D102
# Docstrings are omitted for documentation purposes.
usage_warning(
str(
ObjectRenamed(
"MultiSpectralDistributions.strict_name",
"MultiSpectralDistributions.display_name",
)
)
)

return self.display_name

@strict_name.setter
def strict_name(self, value): # pragma: no cover
# Docstrings are omitted for documentation purposes.
usage_warning(
str(
ObjectRenamed(
"MultiSpectralDistributions.strict_name",
"MultiSpectralDistributions.display_name",
)
)
)

self.display_name = value

@property
def strict_labels(self): # pragma: no cover # noqa: D102
# Docstrings are omitted for documentation purposes.
usage_warning(
str(
ObjectRenamed(
"MultiSpectralDistributions.strict_labels",
"MultiSpectralDistributions.display_labels",
)
)
)

return self.display_labels

@strict_labels.setter
def strict_labels(self, value): # pragma: no cover
# Docstrings are omitted for documentation purposes.
usage_warning(
str(
ObjectRenamed(
"MultiSpectralDistributions.strict_labels",
"MultiSpectralDistributions.display_labels",
)
)
)

self.display_labels = value


_CACHE_RESHAPED_SDS_AND_MSDS: dict = CACHE_REGISTRY.register_cache(
f"{__name__}._CACHE_RESHAPED_SDS_AND_MSDS"
Expand Down
Loading

0 comments on commit 7a72647

Please sign in to comment.