Skip to content

Commit d70ac47

Browse files
committed
Small lint-like things
1 parent 9ecf464 commit d70ac47

File tree

2 files changed

+12
-72
lines changed

2 files changed

+12
-72
lines changed

mathics/builtin/graphics.py

Lines changed: 0 additions & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -416,7 +416,6 @@ def apply(self, graphics, evaluation, options):
416416
new_leaves = []
417417
options_set = set(options.keys())
418418
for leaf in graphics.leaves:
419-
new_leaf = leaf
420419
leaf_name = leaf.get_head_name()
421420
if leaf_name == "System`Rule" and str(leaf.leaves[0]) in options_set:
422421
continue
@@ -1366,64 +1365,6 @@ def _arc_params(self):
13661365

13671366
return x, y, abs(rx), abs(ry), sx, sy, ex, ey, large_arc
13681367

1369-
# FIXME: Why do we need this? If so,
1370-
# figure out how to put in svg.py
1371-
# --------------------------------
1372-
# def to_svg(self, offset=None):
1373-
# if self.arc is None:
1374-
# return super(_ArcBox, self).to_svg(offset)
1375-
1376-
# x, y, rx, ry, sx, sy, ex, ey, large_arc = self._arc_params()
1377-
1378-
# format_fn = lookup_method(self, "svg")
1379-
# if format_fn is not None:
1380-
# return format_fn(self, offset)
1381-
# def path(closed):
1382-
# if closed:
1383-
# yield "M %f,%f" % (x, y)
1384-
# yield "L %f,%f" % (sx, sy)
1385-
# else:
1386-
# yield "M %f,%f" % (sx, sy)
1387-
1388-
# yield "A %f,%f,0,%d,0,%f,%f" % (rx, ry, large_arc, ex, ey)
1389-
1390-
# if closed:
1391-
# yield "Z"
1392-
1393-
# l = self.style.get_line_width(face_element=self.face_element)
1394-
# style = create_css(self.edge_color, self.face_color, stroke_width=l)
1395-
# return '<path d="%s" style="%s" />' % (" ".join(path(self.face_element)), style)
1396-
1397-
def to_asy(self):
1398-
if self.arc is None:
1399-
return super(_ArcBox, self).to_asy()
1400-
1401-
x, y, rx, ry, sx, sy, ex, ey, large_arc = self._arc_params()
1402-
1403-
def path(closed):
1404-
if closed:
1405-
yield "(%s,%s)--(%s,%s)--" % tuple(
1406-
asy_number(t) for t in (x, y, sx, sy)
1407-
)
1408-
1409-
yield "arc((%s,%s), (%s, %s), (%s, %s))" % tuple(
1410-
asy_number(t) for t in (x, y, sx, sy, ex, ey)
1411-
)
1412-
1413-
if closed:
1414-
yield "--cycle"
1415-
1416-
l = self.style.get_line_width(face_element=self.face_element)
1417-
pen = create_pens(
1418-
edge_color=self.edge_color,
1419-
face_color=self.face_color,
1420-
stroke_width=l,
1421-
is_face_element=self.face_element,
1422-
)
1423-
command = "filldraw" if self.face_element else "draw"
1424-
return "%s(%s, %s);" % (command, "".join(path(self.face_element)), pen)
1425-
1426-
14271368
class DiskBox(_ArcBox):
14281369
face_element = True
14291370

mathics/formatter/svg.py

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -76,8 +76,8 @@ def polygon(points):
7676

7777

7878
def beziercurvebox(self, offset=None):
79-
l = self.style.get_line_width(face_element=False)
80-
style = create_css(edge_color=self.edge_color, stroke_width=l)
79+
line_width = self.style.get_line_width(face_element=False)
80+
style = create_css(edge_color=self.edge_color, stroke_width=line_width)
8181

8282
svg = ""
8383
for line in self.lines:
@@ -91,9 +91,9 @@ def beziercurvebox(self, offset=None):
9191

9292

9393
def filledcurvebox(self, offset=None):
94-
l = self.style.get_line_width(face_element=False)
94+
line_width = self.style.get_line_width(face_element=False)
9595
style = create_css(
96-
edge_color=self.edge_color, face_color=self.face_color, stroke_width=l
96+
edge_color=self.edge_color, face_color=self.face_color, stroke_width=line_width
9797
)
9898

9999
def components():
@@ -110,7 +110,6 @@ def components():
110110

111111
add_conversion_fn(FilledCurveBox)
112112

113-
# FIXME figure out how we can add this.
114113
def graphicsbox(self, leaves=None, **options) -> str:
115114
if not leaves:
116115
leaves = self._leaves
@@ -220,8 +219,8 @@ def insetbox(self, offset=None):
220219

221220

222221
def linebox(self, offset=None):
223-
l = self.style.get_line_width(face_element=False)
224-
style = create_css(edge_color=self.edge_color, stroke_width=l)
222+
line_width = self.style.get_line_width(face_element=False)
223+
style = create_css(edge_color=self.edge_color, stroke_width=line_width)
225224
svg = ""
226225
for line in self.lines:
227226
svg += '<polyline points="%s" style="%s" />' % (
@@ -261,13 +260,13 @@ def pointbox(self, offset=None):
261260

262261

263262
def polygonbox(self, offset=None):
264-
l = self.style.get_line_width(face_element=True)
263+
line_width = self.style.get_line_width(face_element=True)
265264
if self.vertex_colors is None:
266265
face_color = self.face_color
267266
else:
268267
face_color = None
269268
style = create_css(
270-
edge_color=self.edge_color, face_color=face_color, stroke_width=l
269+
edge_color=self.edge_color, face_color=face_color, stroke_width=line_width
271270
)
272271
svg = ""
273272
if self.vertex_colors is not None:
@@ -292,7 +291,7 @@ def polygonbox(self, offset=None):
292291

293292

294293
def rectanglebox(self, offset=None):
295-
l = self.style.get_line_width(face_element=True)
294+
line_width = self.style.get_line_width(face_element=True)
296295
x1, y1 = self.p1.pos()
297296
x2, y2 = self.p2.pos()
298297
xmin = min(x1, x2)
@@ -302,7 +301,7 @@ def rectanglebox(self, offset=None):
302301
if offset:
303302
x1, x2 = x1 + offset[0], x2 + offset[0]
304303
y1, y2 = y1 + offset[1], y2 + offset[1]
305-
style = create_css(self.edge_color, self.face_color, l)
304+
style = create_css(self.edge_color, self.face_color, line_width)
306305
return '<rect x="%f" y="%f" width="%f" height="%f" style="%s" />' % (
307306
xmin,
308307
ymin,
@@ -321,8 +320,8 @@ def _roundbox(self, offset=None):
321320
rx, ry = self.r.pos()
322321
rx -= x
323322
ry = y - ry
324-
l = self.style.get_line_width(face_element=self.face_element)
325-
style = create_css(self.edge_color, self.face_color, stroke_width=l)
323+
line_width = self.style.get_line_width(face_element=self.face_element)
324+
style = create_css(self.edge_color, self.face_color, stroke_width=line_width)
326325
return '<ellipse cx="%f" cy="%f" rx="%f" ry="%f" style="%s" />' % (
327326
x,
328327
y,

0 commit comments

Comments
 (0)