Skip to content

Commit fee5d70

Browse files
authored
Merge branch 'master' into sphericalplot3d
2 parents 7abe2ce + 941dd46 commit fee5d70

82 files changed

Lines changed: 3363 additions & 1393 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

Makefile

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ MATHICS3_MODULE_OPTION ?= --load-module pymathics.graph,pymathics.natlang
3636
djangotest \
3737
gstest \
3838
latexdoc \
39+
mypy \
3940
plot-detailed-tests\
4041
pytest \
4142
pytest-x \
@@ -128,6 +129,9 @@ clean: clean-cython clean-cache
128129
rm -f mathics/data/op-tables || true; \
129130
rm -rf build || true
130131

132+
mypy:
133+
mypy --install-types --ignore-missing-imports --non-interactive mathics
134+
131135
plot-detailed-tests:
132136
MATHICS_CHARACTER_ENCODING="ASCII" MATHICS_PLOT_DETAILED_TESTS="1" $(PYTHON) -m pytest -x $(PYTEST_OPTIONS) test/builtin/drawing/test_plot_detail.py
133137

SYMBOLS_MANIFEST.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -563,7 +563,6 @@ System`Image
563563
System`ImageAdd
564564
System`ImageAdjust
565565
System`ImageAspectRatio
566-
System`ImageBox
567566
System`ImageChannels
568567
System`ImageColorSpace
569568
System`ImageConvolve
@@ -992,6 +991,7 @@ System`RandomSample
992991
System`Range
993992
System`RankedMax
994993
System`RankedMin
994+
System`RasterBox
995995
System`Rational
996996
System`Rationalize
997997
System`Re

mathics/algorithm/clusters.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1074,10 +1074,10 @@ def _kmeans(self, k):
10741074

10751075
a = [0] * len(x)
10761076
u = [0] * len(x)
1077-
l = [0] * len(x)
1077+
li = [0] * len(x)
10781078

10791079
for i, xi in enumerate(x):
1080-
ai, u[i], _, l[i] = _smallest2(d(xi, cj) for cj in c)
1080+
ai, u[i], _, li[i] = _smallest2(d(xi, cj) for cj in c)
10811081
q[ai] += 1
10821082
cc[ai] = _pairwise_sum(cc[ai], xi)
10831083
a[i] = ai
@@ -1093,14 +1093,14 @@ def _kmeans(self, k):
10931093

10941094
# find new assignments
10951095
for i, ai in enumerate(a):
1096-
m = max(s[ai] / 2.0, l[i])
1096+
m = max(s[ai] / 2.0, li[i])
10971097

10981098
if u[i] > m:
10991099
xi = x[i]
11001100
u[i] = d(xi, c[ai])
11011101

11021102
if u[i] > m:
1103-
new_ai, u[i], _, l[i] = _smallest2(d(xi, cj) for cj in c)
1103+
new_ai, u[i], _, li[i] = _smallest2(d(xi, cj) for cj in c)
11041104

11051105
if new_ai != ai:
11061106
q[ai] -= 1
@@ -1132,9 +1132,9 @@ def _kmeans(self, k):
11321132
for i, ai in enumerate(a):
11331133
u[i] += p[ai]
11341134
if r1 == ai:
1135-
l[i] -= p2
1135+
li[i] -= p2
11361136
else:
1137-
l[i] -= p1
1137+
li[i] -= p1
11381138

11391139
change = sum(p)
11401140

mathics/algorithm/introselect.py

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -167,25 +167,25 @@ def introselect(a, k): # changes a
167167
import itertools
168168
import random
169169

170-
def test_algorithm(l, r_max, name, f):
171-
a = [random.randint(-r_max, r_max) for _ in range(l)]
170+
def test_algorithm(m, r_max, name, f):
171+
a = [random.randint(-r_max, r_max) for _ in range(m)]
172172
b = sorted(a)
173173
c = [f(a[:], i) for i in range(len(a))]
174174
if b == c:
175-
print("OK %s r: %d l: %d" % (name, r_max, l))
175+
print("OK %s r: %d l: %d" % (name, r_max, m))
176176
return True
177177
else:
178-
print("FAIL %s r: %d l: %d" % (name, r_max, l))
178+
print("FAIL %s r: %d l: %d" % (name, r_max, m))
179179
print(a, b, c)
180180
return False
181181

182-
def test_configuration(l_max, r_max):
183-
for l in range(l_max):
184-
if not test_algorithm(l, r_max, "bfprt", bfprt):
182+
def test_configuration(m_max, r_max):
183+
for m in range(m_max):
184+
if not test_algorithm(m, r_max, "bfprt", bfprt):
185185
return False
186186

187-
for l in range(l_max):
188-
if not test_algorithm(l, r_max, "introselect", introselect):
187+
for m in range(m_max):
188+
if not test_algorithm(m, r_max, "introselect", introselect):
189189
return False
190190

191191
return True

mathics/builtin/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
88
Note that there are other modules to collect specific aspects a
99
Builtin, such as ``mathics.eval`` for evaluation specifics, or
10-
``mathics.format`` for rendering details, or ``mathics.compile`` for
10+
``mathics.format.render`` for rendering details, or ``mathics.compile`` for
1111
compilation details.
1212
1313
A Mathics Builtin is implemented one of a particular kind of Python

mathics/builtin/atomic/strings.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -876,7 +876,7 @@ class ToString(Builtin):
876876
>> "U" <> ToString[2]
877877
= U2
878878
>> ToString[Integrate[f[x],x], TeXForm]
879-
= \\int f\\left[x\\right] \\, dx
879+
= \\int f\\left(x\\right) \\, dx
880880
881881
"""
882882

mathics/builtin/box/__init__.py

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,15 @@
1-
r"""
2-
Boxing modules.
1+
r"""Expression Boxing
32
4-
Boxes are added in formatting \Mathics Expressions.
3+
Boxes are central to <url>:Form:/doc/reference-of-built-in-symbols/forms-of-input-and-output/</url> \
4+
processing of \Mathics expressions.
5+
6+
Boxing information, like the class of expression to be worked on and \
7+
its size, allow formatters, like <url>:StandardForm:
8+
/doc/reference-of-built-in-symbols/forms-of-input-and-output/printforms/standardform/</url> \
9+
to do their work without \
10+
having to know more specific details and intricacies of expression to be formatted.
511
6-
Boxing information like bounding-box width and size makes it easier for formatters to do
7-
layout without having to know the intricacies of what is inside the box.
812
"""
13+
14+
# This tells documentation how to sort this module
15+
sort_order = "mathics.builtin.expression-boxing"

mathics/builtin/box/compilation.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
from mathics.builtin.box.expression import BoxExpression
77

8-
# Docs are not yet ready for prime time. Maybe after release 6.0.0.
8+
# No user docs here: Box primitives aren't documented.
99
no_doc = True
1010

1111

mathics/builtin/box/graphics.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,9 +37,9 @@
3737
from mathics.core.list import ListExpression
3838
from mathics.core.symbols import Symbol, SymbolFalse, SymbolTrue
3939
from mathics.core.systemsymbols import SymbolAutomatic, SymbolTraditionalForm
40-
from mathics.eval.makeboxes import format_element
40+
from mathics.format.box import format_element
4141

42-
# Docs are not yet ready for prime time. Maybe after release 6.0.0.
42+
# No user docs here: Box primitives aren't documented.
4343
no_doc = True
4444

4545
SymbolRegularPolygonBox = Symbol("RegularPolygonBox")

mathics/builtin/box/graphics3d.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636
from mathics.core.symbols import Symbol, SymbolTrue
3737
from mathics.eval.nevaluator import eval_N
3838

39-
# Docs are not yet ready for prime time. Maybe after release 7.0.0.
39+
# No user docs here - Box primitives aren't documented.
4040
no_doc = True
4141

4242

0 commit comments

Comments
 (0)