Skip to content

Commit

Permalink
moving and renaming modules
Browse files Browse the repository at this point in the history
  • Loading branch information
mmatera committed Nov 9, 2024
1 parent c5faf8f commit 1cd0bc8
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 14 deletions.
2 changes: 1 addition & 1 deletion mathics/builtin/forms/output.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@
StringFromPython,
)
from mathics.core.builtin import Builtin
from mathics.core.convert.prettyprint import expression_to_2d_text
from mathics.core.evaluation import Evaluation
from mathics.core.expression import BoxError, Expression
from mathics.core.list import ListExpression
Expand Down Expand Up @@ -67,6 +66,7 @@
)
from mathics.eval.makeboxes import StringLParen, StringRParen, format_element
from mathics.eval.testing_expressions import expr_min
from mathics.format.prettyprint import expression_to_2d_text

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

Expand Down
3 changes: 2 additions & 1 deletion mathics/eval/makeboxes.py
Original file line number Diff line number Diff line change
Expand Up @@ -211,13 +211,14 @@ def make_output_form(expr, evaluation, form):
Build a 2D text representation of the expression.
"""
from mathics.builtin.box.layout import InterpretationBox, PaneBox
from mathics.core.convert.prettyprint import expression_to_2d_text
from mathics.format.prettyprint import expression_to_2d_text

use_2d = (
evaluation.definitions.get_ownvalues("System`$Use2DOutputForm")[0].replace
is SymbolTrue
)
text2d = expression_to_2d_text(expr, evaluation, form, **{"2d": use_2d}).text

if "\n" in text2d:
text2d = "\n" + text2d
elem1 = PaneBox(String(text2d))
Expand Down
3 changes: 3 additions & 0 deletions mathics/core/prettyprint.py → mathics/format/pane_text.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
"""
This module produces a "pretty-print" inspired 2d text representation.
This code is completely independent from Mathics objects, so it could live
alone in a different package.
"""

from typing import List, Optional, Union
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,18 @@
from mathics.core.evaluation import Evaluation
from mathics.core.expression import Expression
from mathics.core.list import ListExpression
from mathics.core.prettyprint import (
from mathics.core.symbols import Atom, Symbol, SymbolTimes
from mathics.core.systemsymbols import (
SymbolDerivative,
SymbolInfix,
SymbolNone,
SymbolOutputForm,
SymbolPower,
SymbolStandardForm,
SymbolTraditionalForm,
)
from mathics.eval.makeboxes import compare_precedence, do_format # , format_element
from mathics.format.pane_text import (
TextBlock,
bracket,
fraction,
Expand All @@ -30,17 +41,6 @@
subsuperscript,
superscript,
)
from mathics.core.symbols import Atom, Symbol, SymbolTimes
from mathics.core.systemsymbols import (
SymbolDerivative,
SymbolInfix,
SymbolNone,
SymbolOutputForm,
SymbolPower,
SymbolStandardForm,
SymbolTraditionalForm,
)
from mathics.eval.makeboxes import compare_precedence, do_format # , format_element

SymbolNonAssociative = Symbol("System`NonAssociative")
SymbolPostfix = Symbol("System`Postfix")
Expand Down

0 comments on commit 1cd0bc8

Please sign in to comment.