Skip to content

Commit 1cd0bc8

Browse files
committed
moving and renaming modules
1 parent c5faf8f commit 1cd0bc8

File tree

4 files changed

+18
-14
lines changed

4 files changed

+18
-14
lines changed

mathics/builtin/forms/output.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,6 @@
3535
StringFromPython,
3636
)
3737
from mathics.core.builtin import Builtin
38-
from mathics.core.convert.prettyprint import expression_to_2d_text
3938
from mathics.core.evaluation import Evaluation
4039
from mathics.core.expression import BoxError, Expression
4140
from mathics.core.list import ListExpression
@@ -67,6 +66,7 @@
6766
)
6867
from mathics.eval.makeboxes import StringLParen, StringRParen, format_element
6968
from mathics.eval.testing_expressions import expr_min
69+
from mathics.format.prettyprint import expression_to_2d_text
7070

7171
MULTI_NEWLINE_RE = re.compile(r"\n{2,}")
7272

mathics/eval/makeboxes.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -211,13 +211,14 @@ def make_output_form(expr, evaluation, form):
211211
Build a 2D text representation of the expression.
212212
"""
213213
from mathics.builtin.box.layout import InterpretationBox, PaneBox
214-
from mathics.core.convert.prettyprint import expression_to_2d_text
214+
from mathics.format.prettyprint import expression_to_2d_text
215215

216216
use_2d = (
217217
evaluation.definitions.get_ownvalues("System`$Use2DOutputForm")[0].replace
218218
is SymbolTrue
219219
)
220220
text2d = expression_to_2d_text(expr, evaluation, form, **{"2d": use_2d}).text
221+
221222
if "\n" in text2d:
222223
text2d = "\n" + text2d
223224
elem1 = PaneBox(String(text2d))

mathics/core/prettyprint.py renamed to mathics/format/pane_text.py

+3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
"""
22
This module produces a "pretty-print" inspired 2d text representation.
3+
4+
This code is completely independent from Mathics objects, so it could live
5+
alone in a different package.
36
"""
47

58
from typing import List, Optional, Union

mathics/core/convert/prettyprint.py renamed to mathics/format/prettyprint.py

+12-12
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,18 @@
1717
from mathics.core.evaluation import Evaluation
1818
from mathics.core.expression import Expression
1919
from mathics.core.list import ListExpression
20-
from mathics.core.prettyprint import (
20+
from mathics.core.symbols import Atom, Symbol, SymbolTimes
21+
from mathics.core.systemsymbols import (
22+
SymbolDerivative,
23+
SymbolInfix,
24+
SymbolNone,
25+
SymbolOutputForm,
26+
SymbolPower,
27+
SymbolStandardForm,
28+
SymbolTraditionalForm,
29+
)
30+
from mathics.eval.makeboxes import compare_precedence, do_format # , format_element
31+
from mathics.format.pane_text import (
2132
TextBlock,
2233
bracket,
2334
fraction,
@@ -30,17 +41,6 @@
3041
subsuperscript,
3142
superscript,
3243
)
33-
from mathics.core.symbols import Atom, Symbol, SymbolTimes
34-
from mathics.core.systemsymbols import (
35-
SymbolDerivative,
36-
SymbolInfix,
37-
SymbolNone,
38-
SymbolOutputForm,
39-
SymbolPower,
40-
SymbolStandardForm,
41-
SymbolTraditionalForm,
42-
)
43-
from mathics.eval.makeboxes import compare_precedence, do_format # , format_element
4444

4545
SymbolNonAssociative = Symbol("System`NonAssociative")
4646
SymbolPostfix = Symbol("System`Postfix")

0 commit comments

Comments
 (0)