diff --git a/pymathics/asy/__init__.py b/pymathics/asy/__init__.py index a043be0..b852d1a 100644 --- a/pymathics/asy/__init__.py +++ b/pymathics/asy/__init__.py @@ -10,8 +10,11 @@ import pkg_resources from mathics.builtin.files_io.importexport import Export as MathicsExport +from mathics.core.atoms import String from mathics.core.evaluation import Evaluation -from mathics.core.expression import Expression, String, SymbolTrue +from mathics.core.expression import Expression +from mathics.core.symbols import Symbol, SymbolTrue +from mathics.core.systemsymbols import SymbolGet from pymathics.asy.exportasy import ExportToJPG, ExportToPDF, ExportToPNG, ExportToSVG from pymathics.asy.graphics import AsyGraphicsBox @@ -49,7 +52,7 @@ def onload(definitions): definitions.set_ownvalue("Settings`UseAsyForGraphics2D", SymbolTrue) for root, dirs, files in os.walk(os.path.join(ROOT_DIR, "autoload")): for path in [os.path.join(root, f) for f in files if f.endswith(".m")]: - Expression("Get", String(path)).evaluate(Evaluation(definitions)) + Expression(SymbolGet, String(path)).evaluate(Evaluation(definitions)) # To be recognized as an external mathics module, the following variable diff --git a/pymathics/asy/exportasy.py b/pymathics/asy/exportasy.py index 21ed004..ffe3a03 100644 --- a/pymathics/asy/exportasy.py +++ b/pymathics/asy/exportasy.py @@ -18,10 +18,10 @@ from mathics.core.symbols import SymbolNull from mathics.core.systemsymbols import SymbolFailed from mathics_scanner import replace_wl_with_plain_text - +from mathics.core.attributes import A_HOLD_REST class _AsyExporter(Builtin): - attributes = ("HoldRest",) + attributes = A_HOLD_REST messages = { "boxerr": "Not able to interpret box `1`", diff --git a/pymathics/asy/graphics.py b/pymathics/asy/graphics.py index fc631d1..008ebe0 100644 --- a/pymathics/asy/graphics.py +++ b/pymathics/asy/graphics.py @@ -13,33 +13,23 @@ from itertools import chain from math import atan2, ceil, cos, degrees, exp, floor, log10, pi, radians, sin, sqrt +from mathics.builtin.box.graphics import GraphicsBox from mathics.builtin.drawing.graphics3d import Graphics3D, Graphics3DElements -from mathics.builtin.box.graphics import( GraphicsBox,) -from mathics.builtin.graphics import ( - GRAPHICS_OPTIONS, - Graphics, - RGBColor, -) +from mathics.builtin.graphics import GRAPHICS_OPTIONS, Graphics, RGBColor from mathics.builtin.options import options_to_rules -from mathics.core.atoms import ( - Integer, - Rational, - Real, - String, - Symbol, -) -from mathics.core.convert.python import from_python +from mathics.core.atoms import Integer, Rational, Real, String from mathics.core.builtin import Builtin, BuiltinElement +from mathics.core.convert.python import from_python from mathics.core.expression import Expression -from mathics.core.symbols import Symbol, SymbolFalse, SymbolTrue, strip_context +from mathics.core.symbols import Symbol, SymbolFalse, SymbolTrue, strip_context from mathics.format.asy import asy_create_pens - +from mathics.core.attributes import A_HOLD_ALL, A_READ_PROTECTED class AsyGraphicsBox(GraphicsBox): context = "System`" options = Graphics.options _graphics = Graphics(expression=False) - attributes = ("HoldAll", "ReadProtected") + attributes = A_HOLD_ALL| A_READ_PROTECTED messages = { "asynotav": "Asymptote is not available in this system. Using the buggy backend.",