Skip to content

Commit ef16eb6

Browse files
committed
Proper way to indicate ColorDistance needs numpy
1 parent 95f5575 commit ef16eb6

File tree

3 files changed

+4
-11
lines changed

3 files changed

+4
-11
lines changed

mathics/builtin/compilation.py

-3
Original file line numberDiff line numberDiff line change
@@ -170,9 +170,6 @@ def __str__(self):
170170
return "-CompiledCode-"
171171

172172
def boxes_to_text(self, leaves=None, **options):
173-
from trepan.api import debug
174-
175-
debug()
176173
if not leaves:
177174
leaves = self._leaves
178175
return "-CompiledCode-"

mathics/builtin/graphics.py

+4-7
Original file line numberDiff line numberDiff line change
@@ -851,6 +851,10 @@ class ColorDistance(Builtin):
851851
+ "two lists of colors of the same length.",
852852
}
853853

854+
# If numpy is not installed, 100 * c1.to_color_space returns
855+
# a list of 100 x 3 elements, instead of doing elementwise multiplication
856+
requires = ("numpy",)
857+
854858
# the docs say LABColor's colorspace corresponds to the CIE 1976 L^* a^* b^* color space
855859
# with {l,a,b}={L^*,a^*,b^*}/100. Corrections factors are put accordingly.
856860

@@ -887,13 +891,6 @@ class ColorDistance(Builtin):
887891
def apply(self, c1, c2, evaluation, options):
888892
"ColorDistance[c1_, c2_, OptionsPattern[ColorDistance]]"
889893

890-
# If numpy is not installed, 100 * c1.to_color_space returns
891-
# a list of 100 x 3 elements, instead of doing elementwise multiplication
892-
try:
893-
import numpy as np
894-
except:
895-
raise RuntimeError("NumPy needs to be installed for ColorDistance")
896-
897894
distance_function = options.get("System`DistanceFunction")
898895
compute = None
899896
if isinstance(distance_function, String):

mathics/formatter/svg.py

-1
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@
2727

2828
class _SVGTransform:
2929
def __init__(self):
30-
from trepan.api import debug; debug()
3130
self.transforms = []
3231

3332
def matrix(self, a, b, c, d, e, f):

0 commit comments

Comments
 (0)