Coverage for algebra/__init__.py: 4%

1 from __future__ import annotations

2

3 import sys

4 import typing

5

6 from colour.utilities.deprecation import ModuleAPI, build_API_changes

7 from colour.utilities.documentation import is_documentation_building

8

9 if typing.TYPE_CHECKING:

10 from colour.hints import Any

11

12 from .common import (

13 eigen_decomposition,

14 euclidean_distance,

15 get_sdiv_mode,

16 is_identity,

17 is_spow_enabled,

18 lerp,

19 linear_conversion,

20 linstep_function,

21 manhattan_distance,

22 normalise_maximum,

23 normalise_vector,

24 sdiv,

25 sdiv_mode,

26 set_sdiv_mode,

27 set_spow_enable,

28 smooth,

29 smoothstep_function,

30 spow,

31 spow_enable,

32 vecmul,

33)

34

35# isort: split

36

37 from . import coordinates

38 from .coordinates import * # noqa: F403

39 from .interpolation import (

40 TABLE_INTERPOLATION_METHODS,

41 CubicSplineInterpolator,

42 KernelInterpolator,

43 LinearInterpolator,

44 NearestNeighbourInterpolator,

45 NullInterpolator,

46 PchipInterpolator,

47 SpragueInterpolator,

48 kernel_cardinal_spline,

49 kernel_lanczos,

50 kernel_linear,

51 kernel_nearest_neighbour,

52 kernel_sinc,

53 lagrange_coefficients,

54 table_interpolation,

55 table_interpolation_tetrahedral,

56 table_interpolation_trilinear,

57)

58

59# isort: split

60

61 from .extrapolation import Extrapolator

62 from .prng import random_triplet_generator

63 from .regression import least_square_mapping_MoorePenrose

64

65 __all__ = [

66 "eigen_decomposition",

67 "euclidean_distance",

68 "get_sdiv_mode",

69 "is_identity",

70 "is_spow_enabled",

71 "lerp",

72 "linear_conversion",

73 "linstep_function",

74 "manhattan_distance",

75 "normalise_maximum",

76 "normalise_vector",

77 "sdiv",

78 "sdiv_mode",

79 "set_sdiv_mode",

80 "set_spow_enable",

81 "smooth",

82 "smoothstep_function",

83 "spow",

84 "spow_enable",

85 "vecmul",

86]

87 __all__ += coordinates.__all__

88 __all__ += [

89 "TABLE_INTERPOLATION_METHODS",

90 "CubicSplineInterpolator",

91 "KernelInterpolator",

92 "LinearInterpolator",

93 "NearestNeighbourInterpolator",

94 "NullInterpolator",

95 "PchipInterpolator",

96 "SpragueInterpolator",

97 "kernel_cardinal_spline",

98 "kernel_lanczos",

99 "kernel_linear",

100 "kernel_nearest_neighbour",

101 "kernel_sinc",

102 "lagrange_coefficients",

103 "table_interpolation",

104 "table_interpolation_tetrahedral",

105 "table_interpolation_trilinear",

106]

107 __all__ += [

108 "Extrapolator",

109]

110 __all__ += [

111 "random_triplet_generator",

112]

113 __all__ += [

114 "least_square_mapping_MoorePenrose",

115]

116

117

118# ----------------------------------------------------------------------------#

119# --- API Changes and Deprecation Management ---#

120# ----------------------------------------------------------------------------#

121 class algebra(ModuleAPI):

122 """Define a class acting like the *algebra* module."""

123

124 def __getattr__(self, attribute: str) -> Any:

125 """Return the value from the attribute with given name."""

126

127 return super().__getattr__(attribute)

128

129

130# v0.4.5

131 API_CHANGES: dict = {

132 "ObjectRenamed": [

133 [

134 "colour.algebra.vector_dot",

135 "colour.algebra.vecmul",

136 ],

137 ]

138}

139"""*colour.algebra* sub-package API changes."""

140

141

142 API_CHANGES["ObjectRemoved"] = [

143 "colour.algebra.matrix_dot",

144]

145

146 if not is_documentation_building():

147 sys.modules["colour.algebra"] = algebra( # pyright: ignore

148 sys.modules["colour.algebra"], build_API_changes(API_CHANGES)

149 )

150

151 del ModuleAPI, is_documentation_building, build_API_changes, sys