From 6b5050c480fc9694515182cdcd2ce2a65f951cff Mon Sep 17 00:00:00 2001 From: rocky Date: Sun, 6 Aug 2023 20:18:09 -0400 Subject: [PATCH 1/2] mathics.builtin.base -> mathics.core.builtin --- admin-tools/build_and_check_manifest.py | 2 +- mathics/builtin/arithfns/basic.py | 14 +++++++------- mathics/builtin/arithfns/sums.py | 2 +- mathics/builtin/arithmetic.py | 18 +++++++++--------- mathics/builtin/assignments/assign_binaryop.py | 2 +- mathics/builtin/assignments/assignment.py | 2 +- mathics/builtin/assignments/clear.py | 2 +- mathics/builtin/assignments/types.py | 2 +- mathics/builtin/assignments/upvalues.py | 2 +- mathics/builtin/atomic/atomic.py | 2 +- mathics/builtin/atomic/numbers.py | 2 +- mathics/builtin/atomic/strings.py | 2 +- mathics/builtin/atomic/symbols.py | 2 +- mathics/builtin/attributes.py | 2 +- mathics/builtin/binary/bytearray.py | 2 +- mathics/builtin/binary/io.py | 2 +- mathics/builtin/binary/system.py | 2 +- mathics/builtin/binary/types.py | 2 +- mathics/builtin/box/expression.py | 2 +- mathics/builtin/box/layout.py | 2 +- mathics/builtin/colors/color_directives.py | 2 +- mathics/builtin/colors/color_operations.py | 2 +- mathics/builtin/colors/named_colors.py | 2 +- mathics/builtin/compilation.py | 2 +- mathics/builtin/compress.py | 2 +- mathics/builtin/datentime.py | 2 +- mathics/builtin/directories/directory_names.py | 2 +- .../directories/directory_operations.py | 2 +- .../builtin/directories/system_directories.py | 2 +- .../builtin/directories/user_directories.py | 2 +- mathics/builtin/distance/clusters.py | 2 +- mathics/builtin/distance/numeric.py | 2 +- mathics/builtin/distance/stringdata.py | 2 +- mathics/builtin/drawing/drawing_options.py | 2 +- mathics/builtin/drawing/graphics3d.py | 2 +- mathics/builtin/drawing/graphics_internals.py | 2 +- mathics/builtin/drawing/plot.py | 2 +- mathics/builtin/drawing/splines.py | 2 +- mathics/builtin/drawing/uniform_polyhedra.py | 2 +- mathics/builtin/evaluation.py | 2 +- mathics/builtin/exp_structure/general.py | 2 +- mathics/builtin/exp_structure/size_and_sig.py | 2 +- .../builtin/file_operations/file_properties.py | 2 +- .../builtin/file_operations/file_utilities.py | 2 +- mathics/builtin/fileformats/htmlformat.py | 2 +- mathics/builtin/fileformats/xmlformat.py | 2 +- mathics/builtin/files_io/files.py | 8 ++++---- mathics/builtin/files_io/filesystem.py | 2 +- mathics/builtin/files_io/importexport.py | 2 +- mathics/builtin/forms/base.py | 2 +- mathics/builtin/forms/output.py | 2 +- mathics/builtin/forms/variables.py | 2 +- mathics/builtin/functional/application.py | 2 +- .../builtin/functional/apply_fns_to_lists.py | 2 +- mathics/builtin/functional/composition.py | 2 +- .../builtin/functional/functional_iteration.py | 2 +- mathics/builtin/graphics.py | 2 +- mathics/builtin/image/base.py | 2 +- mathics/builtin/image/basic.py | 2 +- mathics/builtin/image/colors.py | 2 +- mathics/builtin/image/composition.py | 2 +- mathics/builtin/image/filters.py | 2 +- mathics/builtin/image/geometric.py | 2 +- mathics/builtin/image/misc.py | 2 +- mathics/builtin/image/morph.py | 2 +- mathics/builtin/image/pixel.py | 2 +- mathics/builtin/image/properties.py | 2 +- mathics/builtin/image/structure.py | 2 +- mathics/builtin/image/test.py | 2 +- mathics/builtin/inout.py | 2 +- mathics/builtin/intfns/combinatorial.py | 2 +- mathics/builtin/intfns/divlike.py | 2 +- mathics/builtin/intfns/misc.py | 2 +- mathics/builtin/intfns/recurrence.py | 2 +- mathics/builtin/layout.py | 2 +- mathics/builtin/list/associations.py | 2 +- mathics/builtin/list/constructing.py | 2 +- mathics/builtin/list/eol.py | 2 +- mathics/builtin/list/math.py | 2 +- mathics/builtin/list/predicates.py | 2 +- mathics/builtin/list/rearrange.py | 2 +- mathics/builtin/mainloop.py | 2 +- mathics/builtin/makeboxes.py | 2 +- mathics/builtin/manipulate.py | 2 +- mathics/builtin/matrices/constrmatrix.py | 2 +- mathics/builtin/matrices/partmatrix.py | 2 +- mathics/builtin/messages.py | 2 +- mathics/builtin/numbers/algebra.py | 2 +- mathics/builtin/numbers/calculus.py | 2 +- mathics/builtin/numbers/constants.py | 2 +- mathics/builtin/numbers/diffeqns.py | 2 +- mathics/builtin/numbers/exp.py | 2 +- mathics/builtin/numbers/hyperbolic.py | 2 +- mathics/builtin/numbers/integer.py | 2 +- mathics/builtin/numbers/linalg.py | 2 +- mathics/builtin/numbers/numbertheory.py | 2 +- mathics/builtin/numbers/randomnumbers.py | 2 +- mathics/builtin/numbers/trig.py | 2 +- mathics/builtin/numeric.py | 2 +- mathics/builtin/optimization.py | 2 +- mathics/builtin/options.py | 2 +- mathics/builtin/patterns.py | 18 +++++++++--------- mathics/builtin/physchemdata.py | 2 +- mathics/builtin/procedural.py | 2 +- mathics/builtin/quantities.py | 2 +- mathics/builtin/quantum_mechanics/angular.py | 2 +- mathics/builtin/recurrence.py | 2 +- mathics/builtin/scipy_utils/integrators.py | 2 +- mathics/builtin/scipy_utils/optimizers.py | 2 +- mathics/builtin/scoping.py | 2 +- mathics/builtin/sparse.py | 2 +- mathics/builtin/specialfns/bessel.py | 2 +- mathics/builtin/specialfns/elliptic.py | 2 +- mathics/builtin/specialfns/erf.py | 2 +- mathics/builtin/specialfns/expintegral.py | 2 +- mathics/builtin/specialfns/gamma.py | 6 +++--- mathics/builtin/specialfns/orthogonal.py | 2 +- mathics/builtin/specialfns/zeta.py | 2 +- mathics/builtin/statistics/base.py | 2 +- mathics/builtin/statistics/dependency.py | 2 +- mathics/builtin/statistics/general.py | 4 ++-- mathics/builtin/statistics/location.py | 2 +- mathics/builtin/statistics/orderstats.py | 2 +- mathics/builtin/statistics/shape.py | 2 +- mathics/builtin/string/characters.py | 2 +- mathics/builtin/string/charcodes.py | 2 +- mathics/builtin/string/operations.py | 2 +- mathics/builtin/string/patterns.py | 2 +- mathics/builtin/string/regexp.py | 2 +- mathics/builtin/system.py | 2 +- mathics/builtin/tensors.py | 2 +- .../testing_expressions/equality_inequality.py | 2 +- .../testing_expressions/expression_tests.py | 2 +- .../testing_expressions/list_oriented.py | 2 +- mathics/builtin/testing_expressions/logic.py | 2 +- .../numerical_properties.py | 2 +- mathics/builtin/trace.py | 2 +- mathics/builtin/vectors/constructing.py | 2 +- mathics/builtin/vectors/math_ops.py | 2 +- .../builtin/vectors/vector_space_operations.py | 2 +- mathics/core/assignment.py | 2 +- mathics/{builtin/base.py => core/builtin.py} | 0 mathics/core/expression.py | 2 +- mathics/core/load_builtin.py | 10 +++++----- mathics/doc/common_doc.py | 2 +- mathics/eval/image.py | 2 +- mathics/eval/pymathics.py | 2 +- mathics/timing.py | 2 +- test/builtin/box/test_custom_boxexpression.py | 2 +- test/builtin/drawing/test_image.py | 2 +- test/builtin/numbers/test_calculus.py | 2 +- test/builtin/numbers/test_nintegrate.py | 2 +- .../test_duplicate_builtins.py | 2 +- .../consistency-and-style/test_summary_text.py | 2 +- test/core/test_expression.py | 2 +- test/format/test_format.py | 2 +- test/test_help.py | 2 +- 157 files changed, 188 insertions(+), 188 deletions(-) rename mathics/{builtin/base.py => core/builtin.py} (100%) diff --git a/admin-tools/build_and_check_manifest.py b/admin-tools/build_and_check_manifest.py index 0feb64af9..9a8400068 100755 --- a/admin-tools/build_and_check_manifest.py +++ b/admin-tools/build_and_check_manifest.py @@ -2,7 +2,7 @@ import sys -from mathics.builtin.base import Builtin +from mathics.core.builtin import Builtin from mathics.core.load_builtin import ( import_and_load_builtins, modules, diff --git a/mathics/builtin/arithfns/basic.py b/mathics/builtin/arithfns/basic.py index ca56158fb..2729ba25a 100644 --- a/mathics/builtin/arithfns/basic.py +++ b/mathics/builtin/arithfns/basic.py @@ -8,13 +8,6 @@ """ from mathics.builtin.arithmetic import create_infix -from mathics.builtin.base import ( - BinaryOperator, - Builtin, - MPMathFunction, - PrefixOperator, - SympyFunction, -) from mathics.core.atoms import ( Complex, Integer, @@ -37,6 +30,13 @@ A_PROTECTED, A_READ_PROTECTED, ) +from mathics.core.builtin import ( + BinaryOperator, + Builtin, + MPMathFunction, + PrefixOperator, + SympyFunction, +) from mathics.core.convert.expression import to_expression from mathics.core.convert.sympy import from_sympy from mathics.core.expression import Expression diff --git a/mathics/builtin/arithfns/sums.py b/mathics/builtin/arithfns/sums.py index 79b33ed4f..50f571a06 100644 --- a/mathics/builtin/arithfns/sums.py +++ b/mathics/builtin/arithfns/sums.py @@ -6,7 +6,7 @@ """ -from mathics.builtin.base import Builtin +from mathics.core.builtin import Builtin class Accumulate(Builtin): diff --git a/mathics/builtin/arithmetic.py b/mathics/builtin/arithmetic.py index 3ba5caae2..0f5a329cc 100644 --- a/mathics/builtin/arithmetic.py +++ b/mathics/builtin/arithmetic.py @@ -10,15 +10,6 @@ import sympy -from mathics.builtin.base import ( - Builtin, - IterationFunction, - MPMathFunction, - Predefined, - SympyFunction, - SympyObject, - Test, -) from mathics.builtin.inference import get_assumptions_list from mathics.builtin.numeric import Abs from mathics.builtin.scoping import dynamic_scoping @@ -41,6 +32,15 @@ A_NUMERIC_FUNCTION, A_PROTECTED, ) +from mathics.core.builtin import ( + Builtin, + IterationFunction, + MPMathFunction, + Predefined, + SympyFunction, + SympyObject, + Test, +) from mathics.core.convert.sympy import SympyExpression, from_sympy, sympy_symbol_prefix from mathics.core.element import BaseElement from mathics.core.evaluation import Evaluation diff --git a/mathics/builtin/assignments/assign_binaryop.py b/mathics/builtin/assignments/assign_binaryop.py index d204bb456..645b56b45 100644 --- a/mathics/builtin/assignments/assign_binaryop.py +++ b/mathics/builtin/assignments/assign_binaryop.py @@ -16,8 +16,8 @@ """ -from mathics.builtin.base import BinaryOperator, PostfixOperator, PrefixOperator from mathics.core.attributes import A_HOLD_FIRST, A_PROTECTED, A_READ_PROTECTED +from mathics.core.builtin import BinaryOperator, PostfixOperator, PrefixOperator class AddTo(BinaryOperator): diff --git a/mathics/builtin/assignments/assignment.py b/mathics/builtin/assignments/assignment.py index f960691c5..0c145feca 100644 --- a/mathics/builtin/assignments/assignment.py +++ b/mathics/builtin/assignments/assignment.py @@ -4,7 +4,6 @@ """ -from mathics.builtin.base import BinaryOperator, Builtin from mathics.core.assignment import ( ASSIGNMENT_FUNCTION_MAP, AssignmentException, @@ -18,6 +17,7 @@ A_PROTECTED, A_SEQUENCE_HOLD, ) +from mathics.core.builtin import BinaryOperator, Builtin from mathics.core.symbols import SymbolNull from mathics.core.systemsymbols import SymbolFailed from mathics.eval.pymathics import PyMathicsLoadException, eval_LoadModule diff --git a/mathics/builtin/assignments/clear.py b/mathics/builtin/assignments/clear.py index c5640f7da..f69fc034c 100644 --- a/mathics/builtin/assignments/clear.py +++ b/mathics/builtin/assignments/clear.py @@ -4,7 +4,6 @@ """ -from mathics.builtin.base import Builtin, PostfixOperator from mathics.core.assignment import is_protected from mathics.core.atoms import String from mathics.core.attributes import ( @@ -16,6 +15,7 @@ A_PROTECTED, A_READ_PROTECTED, ) +from mathics.core.builtin import Builtin, PostfixOperator from mathics.core.expression import Expression from mathics.core.symbols import Atom, Symbol, SymbolNull, symbol_set from mathics.core.systemsymbols import ( diff --git a/mathics/builtin/assignments/types.py b/mathics/builtin/assignments/types.py index b0188efa7..71ddd557f 100644 --- a/mathics/builtin/assignments/types.py +++ b/mathics/builtin/assignments/types.py @@ -11,9 +11,9 @@ """ -from mathics.builtin.base import Builtin from mathics.core.assignment import get_symbol_values from mathics.core.attributes import A_HOLD_ALL, A_PROTECTED +from mathics.core.builtin import Builtin class DefaultValues(Builtin): diff --git a/mathics/builtin/assignments/upvalues.py b/mathics/builtin/assignments/upvalues.py index ac05393ac..2fb6b0d0f 100644 --- a/mathics/builtin/assignments/upvalues.py +++ b/mathics/builtin/assignments/upvalues.py @@ -9,9 +9,9 @@ https://reference.wolfram.com/language/tutorial/TransformationRulesAndDefinitions.html#6972. """ -from mathics.builtin.base import Builtin from mathics.core.assignment import get_symbol_values from mathics.core.attributes import A_HOLD_ALL, A_PROTECTED +from mathics.core.builtin import Builtin # In Mathematica 5, this appears under "Types of Values". diff --git a/mathics/builtin/atomic/atomic.py b/mathics/builtin/atomic/atomic.py index d86d156fc..9c57460ce 100644 --- a/mathics/builtin/atomic/atomic.py +++ b/mathics/builtin/atomic/atomic.py @@ -3,8 +3,8 @@ Atomic Primitives """ -from mathics.builtin.base import Builtin, Test from mathics.core.atoms import Atom +from mathics.core.builtin import Builtin, Test class AtomQ(Test): diff --git a/mathics/builtin/atomic/numbers.py b/mathics/builtin/atomic/numbers.py index 1c4cd851b..81f8c5e73 100644 --- a/mathics/builtin/atomic/numbers.py +++ b/mathics/builtin/atomic/numbers.py @@ -22,9 +22,9 @@ import mpmath import sympy -from mathics.builtin.base import Builtin, Predefined from mathics.core.atoms import Integer, Integer0, Integer10, MachineReal, Rational from mathics.core.attributes import A_LISTABLE, A_PROTECTED +from mathics.core.builtin import Builtin, Predefined from mathics.core.convert.python import from_python from mathics.core.expression import Expression from mathics.core.list import ListExpression diff --git a/mathics/builtin/atomic/strings.py b/mathics/builtin/atomic/strings.py index ebd2052f4..25d14d394 100644 --- a/mathics/builtin/atomic/strings.py +++ b/mathics/builtin/atomic/strings.py @@ -12,9 +12,9 @@ from mathics_scanner import TranslateError -from mathics.builtin.base import Builtin, Predefined, PrefixOperator, Test from mathics.core.atoms import Integer, Integer0, Integer1, String from mathics.core.attributes import A_LISTABLE, A_PROTECTED +from mathics.core.builtin import Builtin, Predefined, PrefixOperator, Test from mathics.core.convert.expression import to_mathics_list from mathics.core.convert.python import from_bool from mathics.core.convert.regex import to_regex diff --git a/mathics/builtin/atomic/symbols.py b/mathics/builtin/atomic/symbols.py index 417f22c15..befe8c810 100644 --- a/mathics/builtin/atomic/symbols.py +++ b/mathics/builtin/atomic/symbols.py @@ -10,7 +10,6 @@ from mathics_scanner import is_symbol_name -from mathics.builtin.base import Builtin, PrefixOperator, Test from mathics.core.assignment import get_symbol_values from mathics.core.atoms import String from mathics.core.attributes import ( @@ -22,6 +21,7 @@ A_SEQUENCE_HOLD, attributes_bitset_to_list, ) +from mathics.core.builtin import Builtin, PrefixOperator, Test from mathics.core.convert.expression import to_mathics_list from mathics.core.convert.regex import to_regex from mathics.core.evaluation import Evaluation diff --git a/mathics/builtin/attributes.py b/mathics/builtin/attributes.py index 4163cd372..bc5cd6c34 100644 --- a/mathics/builtin/attributes.py +++ b/mathics/builtin/attributes.py @@ -17,7 +17,6 @@ sort_order = "mathics.builtin.definition-attributes" -from mathics.builtin.base import Builtin, Predefined from mathics.core.assignment import get_symbol_list from mathics.core.atoms import String from mathics.core.attributes import ( @@ -29,6 +28,7 @@ attribute_string_to_number, attributes_bitset_to_list, ) +from mathics.core.builtin import Builtin, Predefined from mathics.core.expression import Expression from mathics.core.list import ListExpression from mathics.core.symbols import Symbol, SymbolNull diff --git a/mathics/builtin/binary/bytearray.py b/mathics/builtin/binary/bytearray.py index 940962f94..dbcd06283 100644 --- a/mathics/builtin/binary/bytearray.py +++ b/mathics/builtin/binary/bytearray.py @@ -3,8 +3,8 @@ Byte Arrays """ -from mathics.builtin.base import Builtin from mathics.core.atoms import ByteArrayAtom, Integer, String +from mathics.core.builtin import Builtin from mathics.core.convert.expression import to_mathics_list from mathics.core.expression import Expression from mathics.core.systemsymbols import SymbolByteArray, SymbolFailed diff --git a/mathics/builtin/binary/io.py b/mathics/builtin/binary/io.py index d4fe8c7a2..b8014a3b5 100644 --- a/mathics/builtin/binary/io.py +++ b/mathics/builtin/binary/io.py @@ -10,8 +10,8 @@ import mpmath import sympy -from mathics.builtin.base import Builtin from mathics.core.atoms import Complex, Integer, MachineReal, Real, String +from mathics.core.builtin import Builtin from mathics.core.convert.expression import to_expression, to_mathics_list from mathics.core.convert.mpmath import from_mpmath from mathics.core.expression import Expression diff --git a/mathics/builtin/binary/system.py b/mathics/builtin/binary/system.py index 62f8f1308..8b6e52f83 100644 --- a/mathics/builtin/binary/system.py +++ b/mathics/builtin/binary/system.py @@ -5,8 +5,8 @@ import sys -from mathics.builtin.base import Predefined from mathics.core.atoms import Integer, Integer1, IntegerM1 +from mathics.core.builtin import Predefined class ByteOrdering(Predefined): diff --git a/mathics/builtin/binary/types.py b/mathics/builtin/binary/types.py index f0fc13aab..d1c7a7991 100644 --- a/mathics/builtin/binary/types.py +++ b/mathics/builtin/binary/types.py @@ -4,7 +4,7 @@ """ -from mathics.builtin.base import Builtin +from mathics.core.builtin import Builtin class Byte(Builtin): diff --git a/mathics/builtin/box/expression.py b/mathics/builtin/box/expression.py index 51fa69d25..c7847398d 100644 --- a/mathics/builtin/box/expression.py +++ b/mathics/builtin/box/expression.py @@ -1,8 +1,8 @@ # This is never intended to go in Mathics3 docs no_doc = True -from mathics.builtin.base import BuiltinElement from mathics.core.attributes import A_PROTECTED, A_READ_PROTECTED +from mathics.core.builtin import BuiltinElement from mathics.core.element import BoxElementMixin from mathics.core.expression import Expression from mathics.core.list import ListExpression diff --git a/mathics/builtin/box/layout.py b/mathics/builtin/box/layout.py index eb7b55e8d..ee157d57e 100644 --- a/mathics/builtin/box/layout.py +++ b/mathics/builtin/box/layout.py @@ -8,11 +8,11 @@ collection of Expressions usually contained in boxes. """ -from mathics.builtin.base import Builtin from mathics.builtin.box.expression import BoxExpression from mathics.builtin.options import options_to_rules from mathics.core.atoms import Atom, String from mathics.core.attributes import A_HOLD_ALL_COMPLETE, A_PROTECTED, A_READ_PROTECTED +from mathics.core.builtin import Builtin from mathics.core.element import BoxElementMixin from mathics.core.evaluation import Evaluation from mathics.core.exceptions import BoxConstructError diff --git a/mathics/builtin/colors/color_directives.py b/mathics/builtin/colors/color_directives.py index 516908116..227560c58 100644 --- a/mathics/builtin/colors/color_directives.py +++ b/mathics/builtin/colors/color_directives.py @@ -8,10 +8,10 @@ from math import atan2, cos, exp, pi, radians, sin, sqrt -from mathics.builtin.base import Builtin from mathics.builtin.colors.color_internals import convert_color from mathics.builtin.drawing.graphics_internals import _GraphicsDirective, get_class from mathics.core.atoms import Integer, MachineReal, Real, String +from mathics.core.builtin import Builtin from mathics.core.convert.expression import to_expression, to_mathics_list from mathics.core.convert.python import from_python from mathics.core.element import ImmutableValueMixin diff --git a/mathics/builtin/colors/color_operations.py b/mathics/builtin/colors/color_operations.py index 3fced32b8..89c5fe7d1 100644 --- a/mathics/builtin/colors/color_operations.py +++ b/mathics/builtin/colors/color_operations.py @@ -9,11 +9,11 @@ import itertools from math import floor -from mathics.builtin.base import Builtin from mathics.builtin.colors.color_directives import ColorError, RGBColor, _ColorObject from mathics.builtin.colors.color_internals import convert_color from mathics.builtin.image.base import Image from mathics.core.atoms import Integer, MachineReal, Rational, Real, String +from mathics.core.builtin import Builtin from mathics.core.convert.expression import to_expression, to_mathics_list from mathics.core.evaluation import Evaluation from mathics.core.expression import Expression diff --git a/mathics/builtin/colors/named_colors.py b/mathics/builtin/colors/named_colors.py index cd5008c0e..309053290 100644 --- a/mathics/builtin/colors/named_colors.py +++ b/mathics/builtin/colors/named_colors.py @@ -4,7 +4,7 @@ Mathics has definitions for the most common color names which can be used in a graphics or style specification. """ -from mathics.builtin.base import Builtin +from mathics.core.builtin import Builtin from mathics.core.symbols import strip_context diff --git a/mathics/builtin/compilation.py b/mathics/builtin/compilation.py index 7b33f5437..1d03e027f 100644 --- a/mathics/builtin/compilation.py +++ b/mathics/builtin/compilation.py @@ -10,10 +10,10 @@ import ctypes from types import FunctionType -from mathics.builtin.base import Builtin from mathics.builtin.box.compilation import CompiledCodeBox from mathics.core.atoms import Integer, String from mathics.core.attributes import A_HOLD_ALL, A_PROTECTED +from mathics.core.builtin import Builtin from mathics.core.convert.expression import to_mathics_list from mathics.core.convert.function import ( CompileDuplicateArgName, diff --git a/mathics/builtin/compress.py b/mathics/builtin/compress.py index 340c2d3ae..40b2ded03 100644 --- a/mathics/builtin/compress.py +++ b/mathics/builtin/compress.py @@ -4,8 +4,8 @@ import base64 import zlib -from mathics.builtin.base import Builtin from mathics.core.atoms import String +from mathics.core.builtin import Builtin from mathics.core.evaluation import Evaluation diff --git a/mathics/builtin/datentime.py b/mathics/builtin/datentime.py index 0ff8f0e38..af7c8a527 100644 --- a/mathics/builtin/datentime.py +++ b/mathics/builtin/datentime.py @@ -16,7 +16,6 @@ import dateutil.parser -from mathics.builtin.base import Builtin, Predefined from mathics.core.atoms import Integer, Real, String from mathics.core.attributes import ( A_HOLD_ALL, @@ -24,6 +23,7 @@ A_PROTECTED, A_READ_PROTECTED, ) +from mathics.core.builtin import Builtin, Predefined from mathics.core.convert.expression import to_expression, to_mathics_list from mathics.core.convert.python import from_python from mathics.core.element import ImmutableValueMixin diff --git a/mathics/builtin/directories/directory_names.py b/mathics/builtin/directories/directory_names.py index 893f8561f..7724e1f58 100644 --- a/mathics/builtin/directories/directory_names.py +++ b/mathics/builtin/directories/directory_names.py @@ -5,8 +5,8 @@ import os import os.path as osp -from mathics.builtin.base import Builtin from mathics.core.atoms import String +from mathics.core.builtin import Builtin from mathics.core.convert.expression import to_expression from mathics.core.convert.python import from_python from mathics.core.evaluation import Evaluation diff --git a/mathics/builtin/directories/directory_operations.py b/mathics/builtin/directories/directory_operations.py index 7d8ab1762..ce27bf5bf 100644 --- a/mathics/builtin/directories/directory_operations.py +++ b/mathics/builtin/directories/directory_operations.py @@ -7,9 +7,9 @@ import shutil import tempfile -from mathics.builtin.base import Builtin from mathics.core.atoms import String from mathics.core.attributes import A_LISTABLE, A_PROTECTED +from mathics.core.builtin import Builtin from mathics.core.convert.expression import to_expression from mathics.core.evaluation import Evaluation from mathics.core.symbols import SymbolNull diff --git a/mathics/builtin/directories/system_directories.py b/mathics/builtin/directories/system_directories.py index 185a2509a..15b0e5352 100644 --- a/mathics/builtin/directories/system_directories.py +++ b/mathics/builtin/directories/system_directories.py @@ -2,9 +2,9 @@ System File Directories """ -from mathics.builtin.base import Predefined from mathics.core.atoms import String from mathics.core.attributes import A_NO_ATTRIBUTES +from mathics.core.builtin import Predefined from mathics.core.evaluation import Evaluation from mathics.core.streams import ROOT_DIR from mathics.eval.directories import INITIAL_DIR, SYS_ROOT_DIR, TMP_DIR diff --git a/mathics/builtin/directories/user_directories.py b/mathics/builtin/directories/user_directories.py index 0a9e86bef..03281c43a 100644 --- a/mathics/builtin/directories/user_directories.py +++ b/mathics/builtin/directories/user_directories.py @@ -4,9 +4,9 @@ import os -from mathics.builtin.base import Predefined from mathics.core.atoms import String from mathics.core.attributes import A_NO_ATTRIBUTES +from mathics.core.builtin import Predefined from mathics.core.convert.expression import to_mathics_list from mathics.core.evaluation import Evaluation from mathics.core.streams import HOME_DIR, PATH_VAR diff --git a/mathics/builtin/distance/clusters.py b/mathics/builtin/distance/clusters.py index 37771f7f5..ebd904540 100644 --- a/mathics/builtin/distance/clusters.py +++ b/mathics/builtin/distance/clusters.py @@ -13,9 +13,9 @@ kmeans, optimize, ) -from mathics.builtin.base import Builtin from mathics.builtin.options import options_to_rules from mathics.core.atoms import FP_MANTISA_BINARY_DIGITS, Integer, Real, String, min_prec +from mathics.core.builtin import Builtin from mathics.core.convert.expression import to_mathics_list from mathics.core.evaluation import Evaluation from mathics.core.expression import Expression diff --git a/mathics/builtin/distance/numeric.py b/mathics/builtin/distance/numeric.py index c5d78d968..04d22270c 100644 --- a/mathics/builtin/distance/numeric.py +++ b/mathics/builtin/distance/numeric.py @@ -2,8 +2,8 @@ Numerical Data """ -from mathics.builtin.base import Builtin from mathics.core.atoms import Integer1, Integer2 +from mathics.core.builtin import Builtin from mathics.core.expression import Evaluation, Expression from mathics.core.symbols import ( SymbolAbs, diff --git a/mathics/builtin/distance/stringdata.py b/mathics/builtin/distance/stringdata.py index cb9562f06..e4099c6b5 100644 --- a/mathics/builtin/distance/stringdata.py +++ b/mathics/builtin/distance/stringdata.py @@ -6,8 +6,8 @@ import unicodedata from typing import Callable -from mathics.builtin.base import Builtin from mathics.core.atoms import Integer, String, Symbol +from mathics.core.builtin import Builtin from mathics.core.evaluation import Evaluation from mathics.core.expression import Expression from mathics.core.symbols import SymbolTrue diff --git a/mathics/builtin/drawing/drawing_options.py b/mathics/builtin/drawing/drawing_options.py index 5b88f680c..5f6f9c549 100644 --- a/mathics/builtin/drawing/drawing_options.py +++ b/mathics/builtin/drawing/drawing_options.py @@ -15,7 +15,7 @@ # builtins. -from mathics.builtin.base import Builtin +from mathics.core.builtin import Builtin # This tells documentation how to sort this module sort_order = "mathics.builtin.graphing-and-drawing.drawing-options-and-option-values" diff --git a/mathics/builtin/drawing/graphics3d.py b/mathics/builtin/drawing/graphics3d.py index f50ac9bae..ea28c9e18 100644 --- a/mathics/builtin/drawing/graphics3d.py +++ b/mathics/builtin/drawing/graphics3d.py @@ -5,7 +5,6 @@ Functions for working with 3D graphics. """ -from mathics.builtin.base import Builtin from mathics.builtin.colors.color_directives import RGBColor from mathics.builtin.graphics import ( CoordinatesError, @@ -14,6 +13,7 @@ _GraphicsElements, ) from mathics.core.atoms import Integer, Rational, Real +from mathics.core.builtin import Builtin from mathics.core.expression import Evaluation, Expression from mathics.core.symbols import SymbolN from mathics.eval.nevaluator import eval_N diff --git a/mathics/builtin/drawing/graphics_internals.py b/mathics/builtin/drawing/graphics_internals.py index 3f2c009d6..3dcceff7a 100644 --- a/mathics/builtin/drawing/graphics_internals.py +++ b/mathics/builtin/drawing/graphics_internals.py @@ -4,8 +4,8 @@ # Also no docstring which may confuse the doc system -from mathics.builtin.base import BuiltinElement from mathics.builtin.box.expression import BoxExpression +from mathics.core.builtin import BuiltinElement from mathics.core.exceptions import BoxExpressionError from mathics.core.symbols import Symbol, system_symbols_dict diff --git a/mathics/builtin/drawing/plot.py b/mathics/builtin/drawing/plot.py index 87789651c..60e0e8b2e 100644 --- a/mathics/builtin/drawing/plot.py +++ b/mathics/builtin/drawing/plot.py @@ -14,12 +14,12 @@ import palettable -from mathics.builtin.base import Builtin from mathics.builtin.drawing.graphics3d import Graphics3D from mathics.builtin.graphics import Graphics from mathics.builtin.options import options_to_rules from mathics.core.atoms import Integer, Integer0, Integer1, MachineReal, Real, String from mathics.core.attributes import A_HOLD_ALL, A_PROTECTED, A_READ_PROTECTED +from mathics.core.builtin import Builtin from mathics.core.convert.expression import to_expression, to_mathics_list from mathics.core.convert.python import from_python from mathics.core.evaluation import Evaluation diff --git a/mathics/builtin/drawing/splines.py b/mathics/builtin/drawing/splines.py index 5f98f7614..99281cac6 100644 --- a/mathics/builtin/drawing/splines.py +++ b/mathics/builtin/drawing/splines.py @@ -9,8 +9,8 @@ # Here we are also hiding "drawing" since this can erroneously appear at the top level. sort_order = "mathics.builtin.splines" -from mathics.builtin.base import Builtin from mathics.core.attributes import A_LISTABLE, A_NUMERIC_FUNCTION, A_PROTECTED +from mathics.core.builtin import Builtin # For a more generic implementation in Python using scipy, diff --git a/mathics/builtin/drawing/uniform_polyhedra.py b/mathics/builtin/drawing/uniform_polyhedra.py index 03f6d10e9..fafa36b37 100644 --- a/mathics/builtin/drawing/uniform_polyhedra.py +++ b/mathics/builtin/drawing/uniform_polyhedra.py @@ -11,7 +11,7 @@ # Here we are also hiding "drawing" since this can erroneously appear at the top level. sort_order = "mathics.builtin.uniform-polyhedra" -from mathics.builtin.base import Builtin +from mathics.core.builtin import Builtin from mathics.core.evaluation import Evaluation uniform_polyhedra_names = "tetrahedron, octahedron, dodecahedron, icosahedron" diff --git a/mathics/builtin/evaluation.py b/mathics/builtin/evaluation.py index 0e743586b..8458153df 100644 --- a/mathics/builtin/evaluation.py +++ b/mathics/builtin/evaluation.py @@ -1,9 +1,9 @@ # -*- coding: utf-8 -*- -from mathics.builtin.base import Builtin, Predefined from mathics.core.atoms import Integer from mathics.core.attributes import A_HOLD_ALL, A_HOLD_ALL_COMPLETE, A_PROTECTED +from mathics.core.builtin import Builtin, Predefined from mathics.core.evaluation import ( MAX_RECURSION_DEPTH, Evaluation, diff --git a/mathics/builtin/exp_structure/general.py b/mathics/builtin/exp_structure/general.py index f2ae816a3..aa40b57c5 100644 --- a/mathics/builtin/exp_structure/general.py +++ b/mathics/builtin/exp_structure/general.py @@ -3,8 +3,8 @@ General Structural Expression Functions """ -from mathics.builtin.base import BinaryOperator, Builtin, Predefined from mathics.core.atoms import Integer, Integer0, Integer1, Rational +from mathics.core.builtin import BinaryOperator, Builtin, Predefined from mathics.core.exceptions import InvalidLevelspecError from mathics.core.expression import Evaluation, Expression from mathics.core.list import ListExpression diff --git a/mathics/builtin/exp_structure/size_and_sig.py b/mathics/builtin/exp_structure/size_and_sig.py index 16b01e4e0..24b9cd121 100644 --- a/mathics/builtin/exp_structure/size_and_sig.py +++ b/mathics/builtin/exp_structure/size_and_sig.py @@ -5,9 +5,9 @@ import platform import zlib -from mathics.builtin.base import Builtin from mathics.core.atoms import ByteArrayAtom, Integer, String from mathics.core.attributes import A_PROTECTED, A_READ_PROTECTED +from mathics.core.builtin import Builtin from mathics.core.evaluation import Evaluation from mathics.core.expression import Expression from mathics.core.systemsymbols import SymbolByteArray diff --git a/mathics/builtin/file_operations/file_properties.py b/mathics/builtin/file_operations/file_properties.py index a665b6c32..176221c2a 100644 --- a/mathics/builtin/file_operations/file_properties.py +++ b/mathics/builtin/file_operations/file_properties.py @@ -6,11 +6,11 @@ import os.path as osp import time -from mathics.builtin.base import Builtin, MessageException from mathics.builtin.exp_structure.size_and_sig import Hash from mathics.builtin.files_io.files import MathicsOpen from mathics.core.atoms import Real, String from mathics.core.attributes import A_PROTECTED, A_READ_PROTECTED +from mathics.core.builtin import Builtin, MessageException from mathics.core.convert.expression import to_expression from mathics.core.convert.python import from_python from mathics.core.evaluation import Evaluation diff --git a/mathics/builtin/file_operations/file_utilities.py b/mathics/builtin/file_operations/file_utilities.py index 30e243f36..ae63a0403 100644 --- a/mathics/builtin/file_operations/file_utilities.py +++ b/mathics/builtin/file_operations/file_utilities.py @@ -2,8 +2,8 @@ File Utilities """ -from mathics.builtin.base import Builtin, MessageException from mathics.builtin.files_io.files import MathicsOpen +from mathics.core.builtin import Builtin, MessageException from mathics.core.convert.expression import to_expression from mathics.core.convert.python import from_python from mathics.core.evaluation import Evaluation diff --git a/mathics/builtin/fileformats/htmlformat.py b/mathics/builtin/fileformats/htmlformat.py index 7fc1a798a..a1f037d1a 100644 --- a/mathics/builtin/fileformats/htmlformat.py +++ b/mathics/builtin/fileformats/htmlformat.py @@ -10,9 +10,9 @@ import re from io import BytesIO -from mathics.builtin.base import Builtin, MessageException from mathics.builtin.files_io.files import MathicsOpen from mathics.core.atoms import String +from mathics.core.builtin import Builtin, MessageException from mathics.core.convert.expression import to_expression, to_mathics_list from mathics.core.convert.python import from_python from mathics.core.expression import Expression diff --git a/mathics/builtin/fileformats/xmlformat.py b/mathics/builtin/fileformats/xmlformat.py index 181b2153c..78b76fd3e 100644 --- a/mathics/builtin/fileformats/xmlformat.py +++ b/mathics/builtin/fileformats/xmlformat.py @@ -10,9 +10,9 @@ import re from io import BytesIO -from mathics.builtin.base import Builtin, MessageException from mathics.builtin.files_io.files import MathicsOpen from mathics.core.atoms import String +from mathics.core.builtin import Builtin, MessageException from mathics.core.convert.expression import to_expression, to_mathics_list from mathics.core.convert.python import from_python from mathics.core.expression import Evaluation, Expression diff --git a/mathics/builtin/files_io/files.py b/mathics/builtin/files_io/files.py index fa60a823d..2c3272af4 100644 --- a/mathics/builtin/files_io/files.py +++ b/mathics/builtin/files_io/files.py @@ -13,16 +13,16 @@ from mathics_scanner import TranslateError import mathics -from mathics.builtin.base import ( +from mathics.core import read +from mathics.core.atoms import Integer, String, SymbolString +from mathics.core.attributes import A_PROTECTED, A_READ_PROTECTED +from mathics.core.builtin import ( BinaryOperator, Builtin, MessageException, Predefined, PrefixOperator, ) -from mathics.core import read -from mathics.core.atoms import Integer, String, SymbolString -from mathics.core.attributes import A_PROTECTED, A_READ_PROTECTED from mathics.core.convert.expression import to_expression, to_mathics_list from mathics.core.convert.python import from_python from mathics.core.evaluation import Evaluation diff --git a/mathics/builtin/files_io/filesystem.py b/mathics/builtin/files_io/filesystem.py index 24e4c250d..edb9fdb3e 100644 --- a/mathics/builtin/files_io/filesystem.py +++ b/mathics/builtin/files_io/filesystem.py @@ -11,10 +11,10 @@ import shutil from typing import List -from mathics.builtin.base import Builtin, MessageException, Predefined from mathics.builtin.files_io.files import MathicsOpen from mathics.core.atoms import Integer, String from mathics.core.attributes import A_LISTABLE, A_LOCKED, A_PROTECTED +from mathics.core.builtin import Builtin, MessageException, Predefined from mathics.core.convert.expression import to_expression, to_mathics_list from mathics.core.convert.python import from_python from mathics.core.convert.regex import to_regex diff --git a/mathics/builtin/files_io/importexport.py b/mathics/builtin/files_io/importexport.py index 1aa656f1d..42a147eb9 100644 --- a/mathics/builtin/files_io/importexport.py +++ b/mathics/builtin/files_io/importexport.py @@ -25,10 +25,10 @@ from itertools import chain from urllib.error import HTTPError, URLError -from mathics.builtin.base import Builtin, Integer, Predefined, String, get_option from mathics.builtin.pymimesniffer import magic from mathics.core.atoms import ByteArrayAtom from mathics.core.attributes import A_NO_ATTRIBUTES, A_PROTECTED, A_READ_PROTECTED +from mathics.core.builtin import Builtin, Integer, Predefined, String, get_option from mathics.core.convert.expression import to_mathics_list from mathics.core.convert.python import from_python from mathics.core.evaluation import Evaluation diff --git a/mathics/builtin/forms/base.py b/mathics/builtin/forms/base.py index 248c63ba3..fc673944c 100644 --- a/mathics/builtin/forms/base.py +++ b/mathics/builtin/forms/base.py @@ -1,5 +1,5 @@ import mathics.core.definitions as definitions -from mathics.builtin.base import Builtin +from mathics.core.builtin import Builtin from mathics.core.symbols import Symbol form_symbol_to_class = {} diff --git a/mathics/builtin/forms/output.py b/mathics/builtin/forms/output.py index 76f05d1e3..d0c27a756 100644 --- a/mathics/builtin/forms/output.py +++ b/mathics/builtin/forms/output.py @@ -16,7 +16,6 @@ from math import ceil from typing import Optional -from mathics.builtin.base import Builtin from mathics.builtin.box.layout import GridBox, RowBox, to_boxes from mathics.builtin.forms.base import FormBaseClass from mathics.builtin.makeboxes import MakeBoxes, number_form @@ -29,6 +28,7 @@ String, StringFromPython, ) +from mathics.core.builtin import Builtin from mathics.core.evaluation import Evaluation from mathics.core.expression import BoxError, Expression from mathics.core.list import ListExpression diff --git a/mathics/builtin/forms/variables.py b/mathics/builtin/forms/variables.py index 43f1fb749..d71df5121 100644 --- a/mathics/builtin/forms/variables.py +++ b/mathics/builtin/forms/variables.py @@ -3,8 +3,8 @@ """ -from mathics.builtin.base import Predefined from mathics.core.attributes import A_LOCKED, A_PROTECTED +from mathics.core.builtin import Predefined from mathics.core.list import ListExpression diff --git a/mathics/builtin/functional/application.py b/mathics/builtin/functional/application.py index 34656b184..db092937b 100644 --- a/mathics/builtin/functional/application.py +++ b/mathics/builtin/functional/application.py @@ -10,8 +10,8 @@ from itertools import chain -from mathics.builtin.base import Builtin, PostfixOperator from mathics.core.attributes import A_HOLD_ALL, A_N_HOLD_ALL, A_PROTECTED +from mathics.core.builtin import Builtin, PostfixOperator from mathics.core.convert.sympy import SymbolFunction from mathics.core.evaluation import Evaluation from mathics.core.expression import Expression diff --git a/mathics/builtin/functional/apply_fns_to_lists.py b/mathics/builtin/functional/apply_fns_to_lists.py index fdfa31da4..171901e02 100644 --- a/mathics/builtin/functional/apply_fns_to_lists.py +++ b/mathics/builtin/functional/apply_fns_to_lists.py @@ -14,9 +14,9 @@ from typing import Iterable -from mathics.builtin.base import BinaryOperator, Builtin from mathics.builtin.list.constructing import List from mathics.core.atoms import Integer +from mathics.core.builtin import BinaryOperator, Builtin from mathics.core.convert.expression import to_mathics_list from mathics.core.evaluation import Evaluation from mathics.core.exceptions import ( diff --git a/mathics/builtin/functional/composition.py b/mathics/builtin/functional/composition.py index 04b1408cc..2c5853282 100644 --- a/mathics/builtin/functional/composition.py +++ b/mathics/builtin/functional/composition.py @@ -21,8 +21,8 @@ # This tells documentation how to sort this module sort_order = "mathics.builtin.functional-composition" -from mathics.builtin.base import Builtin from mathics.core.attributes import A_FLAT, A_ONE_IDENTITY, A_PROTECTED +from mathics.core.builtin import Builtin from mathics.core.evaluation import Evaluation from mathics.core.expression import Expression diff --git a/mathics/builtin/functional/functional_iteration.py b/mathics/builtin/functional/functional_iteration.py index e82fbf8a0..fba768326 100644 --- a/mathics/builtin/functional/functional_iteration.py +++ b/mathics/builtin/functional/functional_iteration.py @@ -5,8 +5,8 @@ Functional iteration is an elegant way to represent repeated operations that is used a lot. """ -from mathics.builtin.base import Builtin from mathics.core.atoms import Integer1 +from mathics.core.builtin import Builtin from mathics.core.convert.python import from_python from mathics.core.evaluation import Evaluation from mathics.core.expression import Expression diff --git a/mathics/builtin/graphics.py b/mathics/builtin/graphics.py index f1ba9993b..d60aed079 100644 --- a/mathics/builtin/graphics.py +++ b/mathics/builtin/graphics.py @@ -7,7 +7,6 @@ from math import sqrt -from mathics.builtin.base import Builtin from mathics.builtin.colors.color_directives import ( CMYKColor, GrayLevel, @@ -29,6 +28,7 @@ from mathics.builtin.options import options_to_rules from mathics.core.atoms import Integer, Rational, Real from mathics.core.attributes import A_PROTECTED, A_READ_PROTECTED +from mathics.core.builtin import Builtin from mathics.core.convert.expression import to_expression, to_mathics_list from mathics.core.exceptions import BoxExpressionError from mathics.core.expression import Expression diff --git a/mathics/builtin/image/base.py b/mathics/builtin/image/base.py index d87f758b7..4fbafbb5d 100644 --- a/mathics/builtin/image/base.py +++ b/mathics/builtin/image/base.py @@ -6,10 +6,10 @@ import numpy import PIL.Image -from mathics.builtin.base import AtomBuiltin, String from mathics.builtin.box.image import ImageBox from mathics.builtin.colors.color_internals import convert_color from mathics.core.atoms import Atom +from mathics.core.builtin import AtomBuiltin, String from mathics.core.evaluation import Evaluation from mathics.core.expression import Expression from mathics.core.list import ListExpression diff --git a/mathics/builtin/image/basic.py b/mathics/builtin/image/basic.py index 7d916bb48..184a0d456 100644 --- a/mathics/builtin/image/basic.py +++ b/mathics/builtin/image/basic.py @@ -5,7 +5,6 @@ import numpy import PIL -from mathics.builtin.base import Builtin, String from mathics.builtin.image.base import Image, image_common_messages from mathics.core.atoms import ( Integer, @@ -14,6 +13,7 @@ MachineReal, is_integer_rational_or_real, ) +from mathics.core.builtin import Builtin, String from mathics.core.convert.python import from_python from mathics.core.evaluation import Evaluation from mathics.core.list import ListExpression diff --git a/mathics/builtin/image/colors.py b/mathics/builtin/image/colors.py index 53119df13..a9975f60e 100644 --- a/mathics/builtin/image/colors.py +++ b/mathics/builtin/image/colors.py @@ -5,10 +5,10 @@ import numpy import PIL -from mathics.builtin.base import Builtin, String from mathics.builtin.colors.color_internals import colorspaces as known_colorspaces from mathics.builtin.image.base import Image, image_common_messages from mathics.core.atoms import Integer, is_integer_rational_or_real +from mathics.core.builtin import Builtin, String from mathics.core.evaluation import Evaluation from mathics.core.expression import Expression from mathics.core.list import ListExpression diff --git a/mathics/builtin/image/composition.py b/mathics/builtin/image/composition.py index 0135f2896..66cee1f47 100644 --- a/mathics/builtin/image/composition.py +++ b/mathics/builtin/image/composition.py @@ -6,9 +6,9 @@ import numpy -from mathics.builtin.base import Builtin, String from mathics.builtin.image.base import Image from mathics.core.atoms import Integer, Rational, Real +from mathics.core.builtin import Builtin, String from mathics.core.evaluation import Evaluation from mathics.core.symbols import Symbol from mathics.eval.image import pixels_as_float diff --git a/mathics/builtin/image/filters.py b/mathics/builtin/image/filters.py index 073a45054..2eec05881 100644 --- a/mathics/builtin/image/filters.py +++ b/mathics/builtin/image/filters.py @@ -5,9 +5,9 @@ import numpy import PIL -from mathics.builtin.base import Builtin from mathics.builtin.image.base import Image from mathics.core.atoms import Integer, is_integer_rational_or_real +from mathics.core.builtin import Builtin from mathics.core.evaluation import Evaluation from mathics.eval.image import convolve, matrix_to_numpy, pixels_as_float diff --git a/mathics/builtin/image/geometric.py b/mathics/builtin/image/geometric.py index 8b4d7bdf3..afaa51abf 100644 --- a/mathics/builtin/image/geometric.py +++ b/mathics/builtin/image/geometric.py @@ -10,8 +10,8 @@ import PIL.ImageFilter import PIL.ImageOps -from mathics.builtin.base import Builtin from mathics.builtin.image.base import Image +from mathics.core.builtin import Builtin from mathics.core.convert.expression import to_mathics_list from mathics.core.evaluation import Evaluation from mathics.core.expression import Expression diff --git a/mathics/builtin/image/misc.py b/mathics/builtin/image/misc.py index 3bd0ada25..89256f919 100644 --- a/mathics/builtin/image/misc.py +++ b/mathics/builtin/image/misc.py @@ -8,8 +8,8 @@ import numpy import PIL -from mathics.builtin.base import Builtin, String from mathics.builtin.image.base import Image, skimage_requires +from mathics.core.builtin import Builtin, String from mathics.core.convert.python import from_python from mathics.core.evaluation import Evaluation from mathics.core.expression import Expression diff --git a/mathics/builtin/image/morph.py b/mathics/builtin/image/morph.py index ac2ba7470..d11f17ae1 100644 --- a/mathics/builtin/image/morph.py +++ b/mathics/builtin/image/morph.py @@ -2,8 +2,8 @@ Morphological Image Processing """ -from mathics.builtin.base import Builtin from mathics.builtin.image.base import Image, skimage_requires +from mathics.core.builtin import Builtin from mathics.core.convert.python import from_python from mathics.core.evaluation import Evaluation from mathics.eval.image import matrix_to_numpy, pixels_as_float, pixels_as_ubyte diff --git a/mathics/builtin/image/pixel.py b/mathics/builtin/image/pixel.py index d50136d16..ebd519daa 100644 --- a/mathics/builtin/image/pixel.py +++ b/mathics/builtin/image/pixel.py @@ -3,9 +3,9 @@ """ import numpy -from mathics.builtin.base import Builtin from mathics.builtin.image.base import Image from mathics.core.atoms import Integer, MachineReal +from mathics.core.builtin import Builtin from mathics.core.convert.expression import to_mathics_list from mathics.core.evaluation import Evaluation from mathics.core.list import ListExpression diff --git a/mathics/builtin/image/properties.py b/mathics/builtin/image/properties.py index 908e03975..38ffc4dbb 100644 --- a/mathics/builtin/image/properties.py +++ b/mathics/builtin/image/properties.py @@ -2,8 +2,8 @@ Image Properties """ -from mathics.builtin.base import Builtin, String from mathics.core.atoms import Integer +from mathics.core.builtin import Builtin, String from mathics.core.convert.expression import from_python, to_mathics_list from mathics.core.evaluation import Evaluation from mathics.core.expression import Expression diff --git a/mathics/builtin/image/structure.py b/mathics/builtin/image/structure.py index 3e45689db..ff12ef6f4 100644 --- a/mathics/builtin/image/structure.py +++ b/mathics/builtin/image/structure.py @@ -3,9 +3,9 @@ """ import numpy -from mathics.builtin.base import Builtin from mathics.builtin.image.base import Image from mathics.core.atoms import Integer +from mathics.core.builtin import Builtin from mathics.core.evaluation import Evaluation from mathics.eval.image import numpy_flip diff --git a/mathics/builtin/image/test.py b/mathics/builtin/image/test.py index b8fdcb472..86254e8a2 100644 --- a/mathics/builtin/image/test.py +++ b/mathics/builtin/image/test.py @@ -1,8 +1,8 @@ """ Image testing """ -from mathics.builtin.base import Test from mathics.builtin.image.base import Image, skimage_requires +from mathics.core.builtin import Test # This tells documentation how to sort this module sort_order = "mathics.builtin.image.image-filters" diff --git a/mathics/builtin/inout.py b/mathics/builtin/inout.py index 581b09612..607fc9c06 100644 --- a/mathics/builtin/inout.py +++ b/mathics/builtin/inout.py @@ -4,8 +4,8 @@ import re -from mathics.builtin.base import Builtin, Predefined from mathics.core.attributes import A_NO_ATTRIBUTES +from mathics.core.builtin import Builtin, Predefined from mathics.core.evaluation import Evaluation from mathics.core.expression import Expression from mathics.core.list import ListExpression diff --git a/mathics/builtin/intfns/combinatorial.py b/mathics/builtin/intfns/combinatorial.py index 6bb62aa88..681f9277d 100644 --- a/mathics/builtin/intfns/combinatorial.py +++ b/mathics/builtin/intfns/combinatorial.py @@ -14,7 +14,6 @@ from itertools import combinations -from mathics.builtin.base import Builtin, MPMathFunction, SympyFunction from mathics.core.atoms import Integer from mathics.core.attributes import ( A_LISTABLE, @@ -23,6 +22,7 @@ A_PROTECTED, A_READ_PROTECTED, ) +from mathics.core.builtin import Builtin, MPMathFunction, SympyFunction from mathics.core.expression import Expression from mathics.core.list import ListExpression from mathics.core.symbols import ( diff --git a/mathics/builtin/intfns/divlike.py b/mathics/builtin/intfns/divlike.py index c0e7dfef8..864558707 100644 --- a/mathics/builtin/intfns/divlike.py +++ b/mathics/builtin/intfns/divlike.py @@ -9,7 +9,6 @@ import sympy from sympy import Q, ask -from mathics.builtin.base import Builtin, SympyFunction from mathics.core.atoms import Integer from mathics.core.attributes import ( A_FLAT, @@ -20,6 +19,7 @@ A_PROTECTED, A_READ_PROTECTED, ) +from mathics.core.builtin import Builtin, SympyFunction from mathics.core.convert.expression import to_mathics_list from mathics.core.convert.python import from_bool from mathics.core.evaluation import Evaluation diff --git a/mathics/builtin/intfns/misc.py b/mathics/builtin/intfns/misc.py index 2370c0817..3e8d018f8 100644 --- a/mathics/builtin/intfns/misc.py +++ b/mathics/builtin/intfns/misc.py @@ -1,5 +1,5 @@ -from mathics.builtin.base import MPMathFunction from mathics.core.attributes import A_LISTABLE, A_PROTECTED +from mathics.core.builtin import MPMathFunction class BernoulliB(MPMathFunction): diff --git a/mathics/builtin/intfns/recurrence.py b/mathics/builtin/intfns/recurrence.py index cbe3fdc5b..aaf544c36 100644 --- a/mathics/builtin/intfns/recurrence.py +++ b/mathics/builtin/intfns/recurrence.py @@ -11,7 +11,6 @@ from sympy.functions.combinatorial.numbers import stirling -from mathics.builtin.base import Builtin, MPMathFunction from mathics.core.atoms import Integer from mathics.core.attributes import ( A_LISTABLE, @@ -19,6 +18,7 @@ A_PROTECTED, A_READ_PROTECTED, ) +from mathics.core.builtin import Builtin, MPMathFunction from mathics.core.evaluation import Evaluation diff --git a/mathics/builtin/layout.py b/mathics/builtin/layout.py index 0397b09b3..a8a83e4de 100644 --- a/mathics/builtin/layout.py +++ b/mathics/builtin/layout.py @@ -12,11 +12,11 @@ """ -from mathics.builtin.base import BinaryOperator, Builtin, Operator from mathics.builtin.box.layout import GridBox, RowBox, to_boxes from mathics.builtin.makeboxes import MakeBoxes from mathics.builtin.options import options_to_rules from mathics.core.atoms import Real, String +from mathics.core.builtin import BinaryOperator, Builtin, Operator from mathics.core.expression import Evaluation, Expression from mathics.core.list import ListExpression from mathics.core.symbols import Symbol diff --git a/mathics/builtin/list/associations.py b/mathics/builtin/list/associations.py index 9c32c9386..f23224948 100644 --- a/mathics/builtin/list/associations.py +++ b/mathics/builtin/list/associations.py @@ -9,10 +9,10 @@ """ -from mathics.builtin.base import Builtin, Test from mathics.builtin.box.layout import RowBox from mathics.core.atoms import Integer from mathics.core.attributes import A_HOLD_ALL_COMPLETE, A_PROTECTED +from mathics.core.builtin import Builtin, Test from mathics.core.convert.expression import to_mathics_list from mathics.core.evaluation import Evaluation from mathics.core.expression import Expression diff --git a/mathics/builtin/list/constructing.py b/mathics/builtin/list/constructing.py index 93e20f267..f1ee2ef7e 100644 --- a/mathics/builtin/list/constructing.py +++ b/mathics/builtin/list/constructing.py @@ -10,10 +10,10 @@ from itertools import permutations -from mathics.builtin.base import Builtin, IterationFunction, Pattern from mathics.builtin.box.layout import RowBox from mathics.core.atoms import Integer, is_integer_rational_or_real from mathics.core.attributes import A_HOLD_FIRST, A_LISTABLE, A_LOCKED, A_PROTECTED +from mathics.core.builtin import Builtin, IterationFunction, Pattern from mathics.core.convert.expression import to_expression from mathics.core.convert.sympy import from_sympy from mathics.core.element import ElementsProperties diff --git a/mathics/builtin/list/eol.py b/mathics/builtin/list/eol.py index 79c9c0176..45a478cc4 100644 --- a/mathics/builtin/list/eol.py +++ b/mathics/builtin/list/eol.py @@ -9,7 +9,6 @@ from itertools import chain -from mathics.builtin.base import BinaryOperator, Builtin from mathics.builtin.box.layout import RowBox from mathics.core.atoms import Integer, Integer0, Integer1, String from mathics.core.attributes import ( @@ -19,6 +18,7 @@ A_PROTECTED, A_READ_PROTECTED, ) +from mathics.core.builtin import BinaryOperator, Builtin from mathics.core.convert.expression import to_mathics_list from mathics.core.convert.python import from_python from mathics.core.exceptions import ( diff --git a/mathics/builtin/list/math.py b/mathics/builtin/list/math.py index ad2a5f9b2..a0452d37d 100644 --- a/mathics/builtin/list/math.py +++ b/mathics/builtin/list/math.py @@ -3,7 +3,7 @@ """ import heapq -from mathics.builtin.base import Builtin, CountableInteger, NegativeIntegerException +from mathics.core.builtin import Builtin, CountableInteger, NegativeIntegerException from mathics.core.exceptions import MessageException from mathics.core.expression import Expression from mathics.core.list import ListExpression diff --git a/mathics/builtin/list/predicates.py b/mathics/builtin/list/predicates.py index 80b9053fa..e16ad3f18 100644 --- a/mathics/builtin/list/predicates.py +++ b/mathics/builtin/list/predicates.py @@ -2,9 +2,9 @@ Predicates on Lists """ -from mathics.builtin.base import Builtin from mathics.builtin.options import options_to_rules from mathics.core.attributes import A_PROTECTED, A_READ_PROTECTED +from mathics.core.builtin import Builtin from mathics.core.expression import Expression from mathics.core.list import ListExpression from mathics.core.symbols import Symbol, SymbolFalse, SymbolTrue diff --git a/mathics/builtin/list/rearrange.py b/mathics/builtin/list/rearrange.py index 952859860..497ad2c5c 100644 --- a/mathics/builtin/list/rearrange.py +++ b/mathics/builtin/list/rearrange.py @@ -10,9 +10,9 @@ from itertools import chain from typing import Callable -from mathics.builtin.base import Builtin, MessageException from mathics.core.atoms import Integer, Integer0 from mathics.core.attributes import A_FLAT, A_ONE_IDENTITY, A_PROTECTED +from mathics.core.builtin import Builtin, MessageException from mathics.core.evaluation import Evaluation from mathics.core.expression import Expression, structure from mathics.core.expression_predefined import MATHICS3_INFINITY diff --git a/mathics/builtin/mainloop.py b/mathics/builtin/mainloop.py index 63d4ab110..c81631df7 100644 --- a/mathics/builtin/mainloop.py +++ b/mathics/builtin/mainloop.py @@ -23,8 +23,8 @@ input, the second step listed above. """ -from mathics.builtin.base import Builtin from mathics.core.attributes import A_LISTABLE, A_NO_ATTRIBUTES, A_PROTECTED +from mathics.core.builtin import Builtin # This tells documentation how to sort this module sort_order = "mathics.builtin.the-main-loop" diff --git a/mathics/builtin/makeboxes.py b/mathics/builtin/makeboxes.py index 2c25b84db..58a1b2315 100644 --- a/mathics/builtin/makeboxes.py +++ b/mathics/builtin/makeboxes.py @@ -7,10 +7,10 @@ import mpmath -from mathics.builtin.base import Builtin, Predefined from mathics.builtin.box.layout import RowBox, to_boxes from mathics.core.atoms import Integer, Integer1, Real, String from mathics.core.attributes import A_HOLD_ALL_COMPLETE, A_READ_PROTECTED +from mathics.core.builtin import Builtin, Predefined from mathics.core.convert.op import operator_to_ascii, operator_to_unicode from mathics.core.element import BaseElement, BoxElementMixin from mathics.core.evaluation import Evaluation diff --git a/mathics/builtin/manipulate.py b/mathics/builtin/manipulate.py index 421deab10..87a3215c1 100644 --- a/mathics/builtin/manipulate.py +++ b/mathics/builtin/manipulate.py @@ -8,7 +8,7 @@ # from mathics import settings -# from mathics.builtin.base import Builtin +# from mathics.core.builtin import Builtin # from mathics.core.atoms import Integer, String # from mathics.core.attributes import A_HOLD_ALL, A_PROTECTED # from mathics.core.convert.python import from_python diff --git a/mathics/builtin/matrices/constrmatrix.py b/mathics/builtin/matrices/constrmatrix.py index 317eaa471..1bd4600a3 100644 --- a/mathics/builtin/matrices/constrmatrix.py +++ b/mathics/builtin/matrices/constrmatrix.py @@ -6,8 +6,8 @@ """ import math -from mathics.builtin.base import Builtin from mathics.core.atoms import Integer0, Integer1, is_integer_rational_or_real +from mathics.core.builtin import Builtin from mathics.core.evaluation import Evaluation from mathics.core.list import ListExpression diff --git a/mathics/builtin/matrices/partmatrix.py b/mathics/builtin/matrices/partmatrix.py index e9ace7d84..f87a3fe0b 100644 --- a/mathics/builtin/matrices/partmatrix.py +++ b/mathics/builtin/matrices/partmatrix.py @@ -7,7 +7,7 @@ """ -from mathics.builtin.base import Builtin +from mathics.core.builtin import Builtin from mathics.core.evaluation import Evaluation from mathics.core.list import ListExpression diff --git a/mathics/builtin/messages.py b/mathics/builtin/messages.py index 8c9c1b4b1..8fa195448 100644 --- a/mathics/builtin/messages.py +++ b/mathics/builtin/messages.py @@ -6,9 +6,9 @@ import typing from typing import Any -from mathics.builtin.base import BinaryOperator, Builtin, Predefined from mathics.core.atoms import String from mathics.core.attributes import A_HOLD_ALL, A_HOLD_FIRST, A_PROTECTED +from mathics.core.builtin import BinaryOperator, Builtin, Predefined from mathics.core.evaluation import Evaluation, Message as EvaluationMessage from mathics.core.expression import Expression from mathics.core.list import ListExpression diff --git a/mathics/builtin/numbers/algebra.py b/mathics/builtin/numbers/algebra.py index 5cbbe3871..3ea0052d9 100644 --- a/mathics/builtin/numbers/algebra.py +++ b/mathics/builtin/numbers/algebra.py @@ -18,12 +18,12 @@ import sympy from mathics.algorithm.simplify import default_complexity_function -from mathics.builtin.base import Builtin from mathics.builtin.inference import evaluate_predicate from mathics.builtin.options import options_to_rules from mathics.builtin.scoping import dynamic_scoping from mathics.core.atoms import Integer, Integer0, Integer1, Number, RationalOneHalf from mathics.core.attributes import A_LISTABLE, A_PROTECTED +from mathics.core.builtin import Builtin from mathics.core.convert.python import from_bool from mathics.core.convert.sympy import from_sympy, sympy_symbol_prefix from mathics.core.element import BaseElement diff --git a/mathics/builtin/numbers/calculus.py b/mathics/builtin/numbers/calculus.py index 501883b1c..987d201a0 100644 --- a/mathics/builtin/numbers/calculus.py +++ b/mathics/builtin/numbers/calculus.py @@ -27,7 +27,6 @@ series_plus_series, series_times_series, ) -from mathics.builtin.base import Builtin, PostfixOperator, SympyFunction from mathics.builtin.scoping import dynamic_scoping from mathics.core.atoms import ( Atom, @@ -49,6 +48,7 @@ A_PROTECTED, A_READ_PROTECTED, ) +from mathics.core.builtin import Builtin, PostfixOperator, SympyFunction from mathics.core.convert.expression import to_expression, to_mathics_list from mathics.core.convert.function import expression_to_callable_and_args from mathics.core.convert.python import from_python diff --git a/mathics/builtin/numbers/constants.py b/mathics/builtin/numbers/constants.py index 32c0715cd..26e39a974 100644 --- a/mathics/builtin/numbers/constants.py +++ b/mathics/builtin/numbers/constants.py @@ -16,9 +16,9 @@ import numpy import sympy -from mathics.builtin.base import Builtin, Predefined, SympyObject from mathics.core.atoms import NUMERICAL_CONSTANTS, MachineReal, PrecisionReal from mathics.core.attributes import A_CONSTANT, A_PROTECTED, A_READ_PROTECTED +from mathics.core.builtin import Builtin, Predefined, SympyObject from mathics.core.element import BaseElement from mathics.core.evaluation import Evaluation from mathics.core.number import MACHINE_DIGITS, PrecisionValueError, get_precision, prec diff --git a/mathics/builtin/numbers/diffeqns.py b/mathics/builtin/numbers/diffeqns.py index 9f158f48c..383e5322a 100644 --- a/mathics/builtin/numbers/diffeqns.py +++ b/mathics/builtin/numbers/diffeqns.py @@ -6,7 +6,7 @@ import sympy -from mathics.builtin.base import Builtin +from mathics.core.builtin import Builtin from mathics.core.convert.sympy import from_sympy from mathics.core.evaluation import Evaluation from mathics.core.expression import Expression diff --git a/mathics/builtin/numbers/exp.py b/mathics/builtin/numbers/exp.py index 301da0a83..e4c626e65 100644 --- a/mathics/builtin/numbers/exp.py +++ b/mathics/builtin/numbers/exp.py @@ -14,9 +14,9 @@ import mpmath -from mathics.builtin.base import Builtin, MPMathFunction from mathics.core.atoms import Real from mathics.core.attributes import A_LISTABLE, A_NUMERIC_FUNCTION, A_PROTECTED +from mathics.core.builtin import Builtin, MPMathFunction from mathics.core.convert.python import from_python from mathics.core.expression import Expression from mathics.core.symbols import Symbol, SymbolPower diff --git a/mathics/builtin/numbers/hyperbolic.py b/mathics/builtin/numbers/hyperbolic.py index f4ffe5727..8f999077e 100644 --- a/mathics/builtin/numbers/hyperbolic.py +++ b/mathics/builtin/numbers/hyperbolic.py @@ -14,8 +14,8 @@ from typing import Optional -from mathics.builtin.base import Builtin, MPMathFunction, SympyFunction from mathics.core.atoms import IntegerM1 +from mathics.core.builtin import Builtin, MPMathFunction, SympyFunction from mathics.core.convert.sympy import SympyExpression from mathics.core.evaluation import Evaluation from mathics.core.expression import Expression diff --git a/mathics/builtin/numbers/integer.py b/mathics/builtin/numbers/integer.py index 9b15fc606..e2a4c0714 100644 --- a/mathics/builtin/numbers/integer.py +++ b/mathics/builtin/numbers/integer.py @@ -8,9 +8,9 @@ import sympy -from mathics.builtin.base import Builtin, SympyFunction from mathics.core.atoms import Integer, Integer0, String from mathics.core.attributes import A_LISTABLE, A_NUMERIC_FUNCTION, A_PROTECTED +from mathics.core.builtin import Builtin, SympyFunction from mathics.core.convert.expression import to_mathics_list from mathics.core.convert.sympy import from_sympy from mathics.core.expression import Expression diff --git a/mathics/builtin/numbers/linalg.py b/mathics/builtin/numbers/linalg.py index 287b8b9bf..1a9da9992 100644 --- a/mathics/builtin/numbers/linalg.py +++ b/mathics/builtin/numbers/linalg.py @@ -8,8 +8,8 @@ import sympy from sympy import im, re -from mathics.builtin.base import Builtin from mathics.core.atoms import Integer, Integer0 +from mathics.core.builtin import Builtin from mathics.core.convert.expression import to_mathics_list from mathics.core.convert.matrix import matrix_data from mathics.core.convert.mpmath import from_mpmath, to_mpmath_matrix diff --git a/mathics/builtin/numbers/numbertheory.py b/mathics/builtin/numbers/numbertheory.py index 05431cee2..85687c3db 100644 --- a/mathics/builtin/numbers/numbertheory.py +++ b/mathics/builtin/numbers/numbertheory.py @@ -7,7 +7,6 @@ import mpmath import sympy -from mathics.builtin.base import Builtin, SympyFunction from mathics.core.atoms import Integer, Integer0, Integer10, Rational, Real from mathics.core.attributes import ( A_LISTABLE, @@ -16,6 +15,7 @@ A_PROTECTED, A_READ_PROTECTED, ) +from mathics.core.builtin import Builtin, SympyFunction from mathics.core.convert.expression import to_mathics_list from mathics.core.convert.python import from_bool, from_python from mathics.core.convert.sympy import SympyPrime, from_sympy diff --git a/mathics/builtin/numbers/randomnumbers.py b/mathics/builtin/numbers/randomnumbers.py index 100da9b1e..580ce0c35 100644 --- a/mathics/builtin/numbers/randomnumbers.py +++ b/mathics/builtin/numbers/randomnumbers.py @@ -16,9 +16,9 @@ import numpy -from mathics.builtin.base import Builtin from mathics.builtin.numpy_utils import instantiate_elements, stack from mathics.core.atoms import Complex, Integer, Real, String +from mathics.core.builtin import Builtin from mathics.core.expression import Expression from mathics.core.list import ListExpression from mathics.core.symbols import Symbol, SymbolDivide, SymbolNull diff --git a/mathics/builtin/numbers/trig.py b/mathics/builtin/numbers/trig.py index 389a76211..1218ae2b7 100644 --- a/mathics/builtin/numbers/trig.py +++ b/mathics/builtin/numbers/trig.py @@ -14,8 +14,8 @@ import mpmath -from mathics.builtin.base import Builtin, MPMathFunction from mathics.core.atoms import Integer, Integer0, IntegerM1, Real +from mathics.core.builtin import Builtin, MPMathFunction from mathics.core.convert.python import from_python from mathics.core.exceptions import IllegalStepSpecification from mathics.core.expression import Expression diff --git a/mathics/builtin/numeric.py b/mathics/builtin/numeric.py index 5d3926e8d..44c8999ea 100644 --- a/mathics/builtin/numeric.py +++ b/mathics/builtin/numeric.py @@ -15,7 +15,6 @@ import sympy -from mathics.builtin.base import Builtin, MPMathFunction, SympyFunction from mathics.builtin.inference import evaluate_predicate from mathics.core.atoms import ( Complex, @@ -32,6 +31,7 @@ A_NUMERIC_FUNCTION, A_PROTECTED, ) +from mathics.core.builtin import Builtin, MPMathFunction, SympyFunction from mathics.core.convert.sympy import from_sympy from mathics.core.element import BaseElement from mathics.core.evaluation import Evaluation diff --git a/mathics/builtin/optimization.py b/mathics/builtin/optimization.py index 46d8694f6..ce208a5ac 100644 --- a/mathics/builtin/optimization.py +++ b/mathics/builtin/optimization.py @@ -18,9 +18,9 @@ import sympy -from mathics.builtin.base import Builtin from mathics.core.atoms import IntegerM1 from mathics.core.attributes import A_CONSTANT, A_PROTECTED, A_READ_PROTECTED +from mathics.core.builtin import Builtin from mathics.core.convert.python import from_python from mathics.core.convert.sympy import from_sympy from mathics.core.evaluation import Evaluation diff --git a/mathics/builtin/options.py b/mathics/builtin/options.py index 3b6acb581..387bbdcbf 100644 --- a/mathics/builtin/options.py +++ b/mathics/builtin/options.py @@ -11,9 +11,9 @@ https://reference.wolfram.com/language/guide/OptionsManagement.html """ -from mathics.builtin.base import Builtin, Predefined, Test, get_option from mathics.builtin.image.base import Image from mathics.core.atoms import String +from mathics.core.builtin import Builtin, Predefined, Test, get_option from mathics.core.evaluation import Evaluation from mathics.core.expression import Expression, SymbolDefault, get_default_value from mathics.core.list import ListExpression diff --git a/mathics/builtin/patterns.py b/mathics/builtin/patterns.py index 8dd1b315d..0642e1347 100644 --- a/mathics/builtin/patterns.py +++ b/mathics/builtin/patterns.py @@ -42,14 +42,6 @@ from typing import Callable, List, Optional as OptionalType, Tuple, Union -from mathics.builtin.base import ( - AtomBuiltin, - BinaryOperator, - Builtin, - PatternError, - PatternObject, - PostfixOperator, -) from mathics.core.atoms import Integer, Number, Rational, Real, String from mathics.core.attributes import ( A_HOLD_ALL, @@ -58,6 +50,14 @@ A_PROTECTED, A_SEQUENCE_HOLD, ) +from mathics.core.builtin import ( + AtomBuiltin, + BinaryOperator, + Builtin, + PatternError, + PatternObject, + PostfixOperator, +) from mathics.core.element import BaseElement, EvalMixin from mathics.core.evaluation import Evaluation from mathics.core.exceptions import InvalidLevelspecError @@ -700,7 +700,7 @@ def quick_pattern_test(self, candidate, test, evaluation: Evaluation): and candidate.elements[1].value < 0 ) else: - from mathics.builtin.base import Test + from mathics.core.builtin import Test builtin = None builtin = evaluation.definitions.get_definition(test) diff --git a/mathics/builtin/physchemdata.py b/mathics/builtin/physchemdata.py index 9f0812e6c..343a07459 100644 --- a/mathics/builtin/physchemdata.py +++ b/mathics/builtin/physchemdata.py @@ -8,8 +8,8 @@ import os from csv import reader as csvreader -from mathics.builtin.base import Builtin from mathics.core.atoms import Integer, String +from mathics.core.builtin import Builtin from mathics.core.convert.python import from_python from mathics.core.evaluation import Evaluation from mathics.core.expression import Expression diff --git a/mathics/builtin/procedural.py b/mathics/builtin/procedural.py index 8a1307267..bbe9f2938 100644 --- a/mathics/builtin/procedural.py +++ b/mathics/builtin/procedural.py @@ -17,13 +17,13 @@ """ -from mathics.builtin.base import BinaryOperator, Builtin, IterationFunction from mathics.core.attributes import ( A_HOLD_ALL, A_HOLD_REST, A_PROTECTED, A_READ_PROTECTED, ) +from mathics.core.builtin import BinaryOperator, Builtin, IterationFunction from mathics.core.evaluation import Evaluation from mathics.core.expression import Expression from mathics.core.interrupt import ( diff --git a/mathics/builtin/quantities.py b/mathics/builtin/quantities.py index 20f24adbb..2a786bb2f 100644 --- a/mathics/builtin/quantities.py +++ b/mathics/builtin/quantities.py @@ -5,7 +5,6 @@ from pint import UnitRegistry -from mathics.builtin.base import Builtin, Test from mathics.core.atoms import Integer, Integer1, Number, Real, String from mathics.core.attributes import ( A_HOLD_REST, @@ -13,6 +12,7 @@ A_PROTECTED, A_READ_PROTECTED, ) +from mathics.core.builtin import Builtin, Test from mathics.core.convert.expression import to_mathics_list from mathics.core.convert.python import from_python from mathics.core.evaluation import Evaluation diff --git a/mathics/builtin/quantum_mechanics/angular.py b/mathics/builtin/quantum_mechanics/angular.py index b063c7081..bddc80dc3 100644 --- a/mathics/builtin/quantum_mechanics/angular.py +++ b/mathics/builtin/quantum_mechanics/angular.py @@ -15,12 +15,12 @@ from sympy.physics.quantum.cg import CG from sympy.physics.wigner import wigner_3j, wigner_6j -from mathics.builtin.base import SympyFunction from mathics.core.atoms import Integer from mathics.core.attributes import ( # A_LISTABLE,; A_NUMERIC_FUNCTION, A_PROTECTED, A_READ_PROTECTED, ) +from mathics.core.builtin import SympyFunction from mathics.core.convert.python import from_python from mathics.core.convert.sympy import from_sympy from mathics.core.evaluation import Evaluation diff --git a/mathics/builtin/recurrence.py b/mathics/builtin/recurrence.py index f6c215b26..470b1ca72 100644 --- a/mathics/builtin/recurrence.py +++ b/mathics/builtin/recurrence.py @@ -12,9 +12,9 @@ import sympy -from mathics.builtin.base import Builtin from mathics.core.atoms import IntegerM1 from mathics.core.attributes import A_CONSTANT +from mathics.core.builtin import Builtin from mathics.core.convert.sympy import from_sympy, sympy_symbol_prefix from mathics.core.evaluation import Evaluation from mathics.core.expression import Expression diff --git a/mathics/builtin/scipy_utils/integrators.py b/mathics/builtin/scipy_utils/integrators.py index 72dde20fe..82db83667 100644 --- a/mathics/builtin/scipy_utils/integrators.py +++ b/mathics/builtin/scipy_utils/integrators.py @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- -from mathics.builtin.base import check_requires_list +from mathics.core.builtin import check_requires_list from mathics.core.util import IS_PYPY if IS_PYPY or not check_requires_list(["scipy", "numpy"]): diff --git a/mathics/builtin/scipy_utils/optimizers.py b/mathics/builtin/scipy_utils/optimizers.py index 4ca04a67e..dcc52b47a 100644 --- a/mathics/builtin/scipy_utils/optimizers.py +++ b/mathics/builtin/scipy_utils/optimizers.py @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- -from mathics.builtin.base import check_requires_list from mathics.core.atoms import Number, Real +from mathics.core.builtin import check_requires_list from mathics.core.convert.function import expression_to_callable_and_args from mathics.core.evaluation import Evaluation from mathics.core.expression import Expression diff --git a/mathics/builtin/scoping.py b/mathics/builtin/scoping.py index f317f22a6..df6ad1f74 100644 --- a/mathics/builtin/scoping.py +++ b/mathics/builtin/scoping.py @@ -5,10 +5,10 @@ from mathics_scanner import is_symbol_name -from mathics.builtin.base import Builtin, Predefined from mathics.core.assignment import get_symbol_list from mathics.core.atoms import Integer, String from mathics.core.attributes import A_HOLD_ALL, A_PROTECTED, attribute_string_to_number +from mathics.core.builtin import Builtin, Predefined from mathics.core.evaluation import Evaluation from mathics.core.list import ListExpression from mathics.core.symbols import Symbol, fully_qualified_symbol_name diff --git a/mathics/builtin/sparse.py b/mathics/builtin/sparse.py index d2511fda7..8d82edc21 100644 --- a/mathics/builtin/sparse.py +++ b/mathics/builtin/sparse.py @@ -5,8 +5,8 @@ """ -from mathics.builtin.base import Builtin from mathics.core.atoms import Integer, Integer0 +from mathics.core.builtin import Builtin from mathics.core.evaluation import Evaluation from mathics.core.expression import Expression from mathics.core.list import ListExpression diff --git a/mathics/builtin/specialfns/bessel.py b/mathics/builtin/specialfns/bessel.py index f5c80ce4f..e2e2455da 100644 --- a/mathics/builtin/specialfns/bessel.py +++ b/mathics/builtin/specialfns/bessel.py @@ -4,7 +4,6 @@ import mpmath -from mathics.builtin.base import Builtin, MPMathFunction from mathics.core.atoms import Integer from mathics.core.attributes import ( A_LISTABLE, @@ -13,6 +12,7 @@ A_PROTECTED, A_READ_PROTECTED, ) +from mathics.core.builtin import Builtin, MPMathFunction from mathics.core.convert.mpmath import from_mpmath from mathics.core.evaluation import Evaluation from mathics.core.number import ( diff --git a/mathics/builtin/specialfns/elliptic.py b/mathics/builtin/specialfns/elliptic.py index 928b4bd26..a0db45c02 100644 --- a/mathics/builtin/specialfns/elliptic.py +++ b/mathics/builtin/specialfns/elliptic.py @@ -12,9 +12,9 @@ import sympy -from mathics.builtin.base import SympyFunction from mathics.core.atoms import Integer from mathics.core.attributes import A_LISTABLE, A_NUMERIC_FUNCTION, A_PROTECTED +from mathics.core.builtin import SympyFunction from mathics.core.convert.sympy import from_sympy, to_numeric_sympy_args from mathics.eval.numerify import numerify diff --git a/mathics/builtin/specialfns/erf.py b/mathics/builtin/specialfns/erf.py index 2e8a4f938..08f33f860 100644 --- a/mathics/builtin/specialfns/erf.py +++ b/mathics/builtin/specialfns/erf.py @@ -5,8 +5,8 @@ """ -from mathics.builtin.base import MPMathFunction, MPMathMultiFunction from mathics.core.attributes import A_LISTABLE, A_NUMERIC_FUNCTION, A_PROTECTED +from mathics.core.builtin import MPMathFunction, MPMathMultiFunction class Erf(MPMathMultiFunction): diff --git a/mathics/builtin/specialfns/expintegral.py b/mathics/builtin/specialfns/expintegral.py index fd7468c46..6bf73e001 100644 --- a/mathics/builtin/specialfns/expintegral.py +++ b/mathics/builtin/specialfns/expintegral.py @@ -5,7 +5,7 @@ """ -from mathics.builtin.base import MPMathFunction +from mathics.core.builtin import MPMathFunction class ExpIntegralE(MPMathFunction): diff --git a/mathics/builtin/specialfns/gamma.py b/mathics/builtin/specialfns/gamma.py index 9c935d1ae..33746fd11 100644 --- a/mathics/builtin/specialfns/gamma.py +++ b/mathics/builtin/specialfns/gamma.py @@ -6,14 +6,14 @@ import mpmath import sympy -from mathics.builtin.base import ( +from mathics.core.atoms import Integer, Integer0, Number +from mathics.core.attributes import A_LISTABLE, A_NUMERIC_FUNCTION, A_PROTECTED +from mathics.core.builtin import ( MPMathFunction, MPMathMultiFunction, PostfixOperator, SympyFunction, ) -from mathics.core.atoms import Integer, Integer0, Number -from mathics.core.attributes import A_LISTABLE, A_NUMERIC_FUNCTION, A_PROTECTED from mathics.core.convert.mpmath import from_mpmath from mathics.core.convert.python import from_python from mathics.core.convert.sympy import from_sympy diff --git a/mathics/builtin/specialfns/orthogonal.py b/mathics/builtin/specialfns/orthogonal.py index 9815087f7..464b148f9 100644 --- a/mathics/builtin/specialfns/orthogonal.py +++ b/mathics/builtin/specialfns/orthogonal.py @@ -3,8 +3,8 @@ """ -from mathics.builtin.base import MPMathFunction from mathics.core.atoms import Integer0 +from mathics.core.builtin import MPMathFunction class ChebyshevT(MPMathFunction): diff --git a/mathics/builtin/specialfns/zeta.py b/mathics/builtin/specialfns/zeta.py index 84ce43bdb..dd1e49e8f 100644 --- a/mathics/builtin/specialfns/zeta.py +++ b/mathics/builtin/specialfns/zeta.py @@ -6,7 +6,7 @@ import mpmath -from mathics.builtin.base import MPMathFunction +from mathics.core.builtin import MPMathFunction from mathics.core.convert.mpmath import from_mpmath diff --git a/mathics/builtin/statistics/base.py b/mathics/builtin/statistics/base.py index 8ec4fccf5..b181cf71d 100644 --- a/mathics/builtin/statistics/base.py +++ b/mathics/builtin/statistics/base.py @@ -1,7 +1,7 @@ """ Base classes for Descriptive Statistics """ -from mathics.builtin.base import Builtin +from mathics.core.builtin import Builtin from mathics.core.expression import Expression from mathics.core.list import ListExpression from mathics.core.symbols import Symbol diff --git a/mathics/builtin/statistics/dependency.py b/mathics/builtin/statistics/dependency.py index 899e77e12..e2949f40e 100644 --- a/mathics/builtin/statistics/dependency.py +++ b/mathics/builtin/statistics/dependency.py @@ -9,9 +9,9 @@ # Here we are also hiding "moements" since this can erroneously appear at the top level. sort_order = "mathics.builtin.special-moments" -from mathics.builtin.base import Builtin from mathics.builtin.statistics.base import NotRectangularException, Rectangular from mathics.core.atoms import Integer +from mathics.core.builtin import Builtin from mathics.core.evaluation import Evaluation from mathics.core.expression import Expression from mathics.core.symbols import Symbol, SymbolDivide diff --git a/mathics/builtin/statistics/general.py b/mathics/builtin/statistics/general.py index 1ad3726da..782c8147b 100644 --- a/mathics/builtin/statistics/general.py +++ b/mathics/builtin/statistics/general.py @@ -3,8 +3,8 @@ General Statistics """ -# from mathics.builtin.base import Builtin, SympyFunction -from mathics.builtin.base import Builtin +# from mathics.core.builtin import Builtin, SympyFunction +from mathics.core.builtin import Builtin # import sympy.stats # from mathics.core.convert.sympy import from_sympy diff --git a/mathics/builtin/statistics/location.py b/mathics/builtin/statistics/location.py index 2999289a1..079e290ea 100644 --- a/mathics/builtin/statistics/location.py +++ b/mathics/builtin/statistics/location.py @@ -3,9 +3,9 @@ """ from mathics.algorithm.introselect import introselect -from mathics.builtin.base import Builtin from mathics.builtin.statistics.base import NotRectangularException, Rectangular from mathics.core.atoms import Integer2 +from mathics.core.builtin import Builtin from mathics.core.evaluation import Evaluation from mathics.core.expression import Expression from mathics.core.symbols import SymbolDivide, SymbolPlus diff --git a/mathics/builtin/statistics/orderstats.py b/mathics/builtin/statistics/orderstats.py index 5a8f63f0c..eb9b9a5da 100644 --- a/mathics/builtin/statistics/orderstats.py +++ b/mathics/builtin/statistics/orderstats.py @@ -16,9 +16,9 @@ from mpmath import ceil as mpceil, floor as mpfloor from mathics.algorithm.introselect import introselect -from mathics.builtin.base import Builtin from mathics.builtin.list.math import _RankedTakeLargest, _RankedTakeSmallest from mathics.core.atoms import Atom, Integer, Symbol, SymbolTrue +from mathics.core.builtin import Builtin from mathics.core.expression import Evaluation, Expression from mathics.core.list import ListExpression from mathics.core.symbols import SymbolFloor, SymbolPlus, SymbolTimes diff --git a/mathics/builtin/statistics/shape.py b/mathics/builtin/statistics/shape.py index b89d7b93b..f0b9e6218 100644 --- a/mathics/builtin/statistics/shape.py +++ b/mathics/builtin/statistics/shape.py @@ -4,7 +4,7 @@ Shape Statistics """ -from mathics.builtin.base import Builtin +from mathics.core.builtin import Builtin class Kurtosis(Builtin): diff --git a/mathics/builtin/string/characters.py b/mathics/builtin/string/characters.py index 37e0b9a70..fedb5e4eb 100644 --- a/mathics/builtin/string/characters.py +++ b/mathics/builtin/string/characters.py @@ -4,9 +4,9 @@ """ -from mathics.builtin.base import Builtin, Test from mathics.core.atoms import String from mathics.core.attributes import A_LISTABLE, A_PROTECTED, A_READ_PROTECTED +from mathics.core.builtin import Builtin, Test from mathics.core.convert.expression import to_mathics_list from mathics.core.evaluation import Evaluation from mathics.core.list import ListExpression diff --git a/mathics/builtin/string/charcodes.py b/mathics/builtin/string/charcodes.py index 54a022f8a..838575d66 100644 --- a/mathics/builtin/string/charcodes.py +++ b/mathics/builtin/string/charcodes.py @@ -6,8 +6,8 @@ import sys from mathics.builtin.atomic.strings import to_python_encoding -from mathics.builtin.base import Builtin from mathics.core.atoms import Integer, Integer1, String +from mathics.core.builtin import Builtin from mathics.core.convert.expression import to_mathics_list from mathics.core.evaluation import Evaluation from mathics.core.expression import Expression diff --git a/mathics/builtin/string/operations.py b/mathics/builtin/string/operations.py index e06d44ce0..3e06fbf5e 100644 --- a/mathics/builtin/string/operations.py +++ b/mathics/builtin/string/operations.py @@ -13,7 +13,6 @@ mathics_split, to_regex, ) -from mathics.builtin.base import BinaryOperator, Builtin from mathics.core.atoms import Integer, Integer1, String from mathics.core.attributes import ( A_FLAT, @@ -22,6 +21,7 @@ A_PROTECTED, A_READ_PROTECTED, ) +from mathics.core.builtin import BinaryOperator, Builtin from mathics.core.convert.python import from_python from mathics.core.evaluation import Evaluation from mathics.core.expression import BoxError, Expression, string_list diff --git a/mathics/builtin/string/patterns.py b/mathics/builtin/string/patterns.py index c280db4a6..12b7bea1a 100644 --- a/mathics/builtin/string/patterns.py +++ b/mathics/builtin/string/patterns.py @@ -13,9 +13,9 @@ anchor_pattern, to_regex, ) -from mathics.builtin.base import BinaryOperator, Builtin from mathics.core.atoms import Integer1, String from mathics.core.attributes import A_FLAT, A_LISTABLE, A_ONE_IDENTITY, A_PROTECTED +from mathics.core.builtin import BinaryOperator, Builtin from mathics.core.evaluation import Evaluation from mathics.core.expression import Expression from mathics.core.list import ListExpression diff --git a/mathics/builtin/string/regexp.py b/mathics/builtin/string/regexp.py index 9776ffabb..da8d55ff7 100644 --- a/mathics/builtin/string/regexp.py +++ b/mathics/builtin/string/regexp.py @@ -4,7 +4,7 @@ """ -from mathics.builtin.base import Builtin +from mathics.core.builtin import Builtin # eval.strings.to_regex seems to have the implementation. diff --git a/mathics/builtin/system.py b/mathics/builtin/system.py index b2feca05d..b4db5b05b 100644 --- a/mathics/builtin/system.py +++ b/mathics/builtin/system.py @@ -13,8 +13,8 @@ import sys from mathics import version_string -from mathics.builtin.base import Builtin, Predefined from mathics.core.atoms import Integer, Integer0, IntegerM1, Real, String +from mathics.core.builtin import Builtin, Predefined from mathics.core.convert.expression import to_mathics_list from mathics.core.expression import Expression from mathics.core.list import ListExpression diff --git a/mathics/builtin/tensors.py b/mathics/builtin/tensors.py index c76f74486..c67a0ac66 100644 --- a/mathics/builtin/tensors.py +++ b/mathics/builtin/tensors.py @@ -19,9 +19,9 @@ """ -from mathics.builtin.base import BinaryOperator, Builtin from mathics.core.atoms import Integer, String from mathics.core.attributes import A_FLAT, A_ONE_IDENTITY, A_PROTECTED +from mathics.core.builtin import BinaryOperator, Builtin from mathics.core.evaluation import Evaluation from mathics.core.expression import Expression from mathics.core.list import ListExpression diff --git a/mathics/builtin/testing_expressions/equality_inequality.py b/mathics/builtin/testing_expressions/equality_inequality.py index 59152e31e..eca27a151 100644 --- a/mathics/builtin/testing_expressions/equality_inequality.py +++ b/mathics/builtin/testing_expressions/equality_inequality.py @@ -7,7 +7,6 @@ import sympy -from mathics.builtin.base import BinaryOperator, Builtin, SympyFunction from mathics.builtin.numbers.constants import mp_convert_constant from mathics.core.atoms import COMPARE_PREC, Integer, Integer1, Number, String from mathics.core.attributes import ( @@ -17,6 +16,7 @@ A_ORDERLESS, A_PROTECTED, ) +from mathics.core.builtin import BinaryOperator, Builtin, SympyFunction from mathics.core.convert.expression import to_expression, to_numeric_args from mathics.core.expression import Expression from mathics.core.expression_predefined import ( diff --git a/mathics/builtin/testing_expressions/expression_tests.py b/mathics/builtin/testing_expressions/expression_tests.py index 258bfd1e1..59ce5547b 100644 --- a/mathics/builtin/testing_expressions/expression_tests.py +++ b/mathics/builtin/testing_expressions/expression_tests.py @@ -1,7 +1,7 @@ """ Expression Tests """ -from mathics.builtin.base import Builtin, PatternError, Test +from mathics.core.builtin import Builtin, PatternError, Test from mathics.core.evaluation import Evaluation from mathics.core.symbols import SymbolFalse, SymbolTrue from mathics.eval.patterns import match diff --git a/mathics/builtin/testing_expressions/list_oriented.py b/mathics/builtin/testing_expressions/list_oriented.py index 74b92c511..2032f8961 100644 --- a/mathics/builtin/testing_expressions/list_oriented.py +++ b/mathics/builtin/testing_expressions/list_oriented.py @@ -2,8 +2,8 @@ List-Oriented Tests """ -from mathics.builtin.base import Builtin, Test from mathics.core.atoms import Integer, Integer1, Integer2 +from mathics.core.builtin import Builtin, Test from mathics.core.evaluation import Evaluation from mathics.core.exceptions import InvalidLevelspecError from mathics.core.expression import Expression diff --git a/mathics/builtin/testing_expressions/logic.py b/mathics/builtin/testing_expressions/logic.py index 1501b3c11..f7809ebe0 100644 --- a/mathics/builtin/testing_expressions/logic.py +++ b/mathics/builtin/testing_expressions/logic.py @@ -2,7 +2,6 @@ """ Logical Combinations """ -from mathics.builtin.base import BinaryOperator, Builtin, Predefined, PrefixOperator from mathics.core.attributes import ( A_FLAT, A_HOLD_ALL, @@ -11,6 +10,7 @@ A_ORDERLESS, A_PROTECTED, ) +from mathics.core.builtin import BinaryOperator, Builtin, Predefined, PrefixOperator from mathics.core.evaluation import Evaluation from mathics.core.exceptions import InvalidLevelspecError from mathics.core.expression import Expression diff --git a/mathics/builtin/testing_expressions/numerical_properties.py b/mathics/builtin/testing_expressions/numerical_properties.py index 5f5822f9e..c1f8b0a18 100644 --- a/mathics/builtin/testing_expressions/numerical_properties.py +++ b/mathics/builtin/testing_expressions/numerical_properties.py @@ -5,9 +5,9 @@ import sympy -from mathics.builtin.base import Builtin, SympyFunction, Test from mathics.core.atoms import Integer, Integer0, Number from mathics.core.attributes import A_LISTABLE, A_NUMERIC_FUNCTION, A_PROTECTED +from mathics.core.builtin import Builtin, SympyFunction, Test from mathics.core.convert.python import from_bool, from_python from mathics.core.evaluation import Evaluation from mathics.core.expression import Expression diff --git a/mathics/builtin/trace.py b/mathics/builtin/trace.py index 759c4df31..c75d73b42 100644 --- a/mathics/builtin/trace.py +++ b/mathics/builtin/trace.py @@ -22,8 +22,8 @@ from time import time from typing import Callable -from mathics.builtin.base import Builtin from mathics.core.attributes import A_HOLD_ALL, A_HOLD_ALL_COMPLETE, A_PROTECTED +from mathics.core.builtin import Builtin from mathics.core.convert.python import from_bool, from_python from mathics.core.definitions import Definitions from mathics.core.evaluation import Evaluation diff --git a/mathics/builtin/vectors/constructing.py b/mathics/builtin/vectors/constructing.py index 267aa379e..551617bbf 100644 --- a/mathics/builtin/vectors/constructing.py +++ b/mathics/builtin/vectors/constructing.py @@ -8,7 +8,7 @@ See also Constructing Lists. """ -from mathics.builtin.base import Builtin +from mathics.core.builtin import Builtin class AngleVector(Builtin): diff --git a/mathics/builtin/vectors/math_ops.py b/mathics/builtin/vectors/math_ops.py index c57d86721..19f373740 100644 --- a/mathics/builtin/vectors/math_ops.py +++ b/mathics/builtin/vectors/math_ops.py @@ -6,8 +6,8 @@ import sympy -from mathics.builtin.base import Builtin, SympyFunction from mathics.core.attributes import A_PROTECTED +from mathics.core.builtin import Builtin, SympyFunction from mathics.core.convert.sympy import from_sympy, to_sympy_matrix from mathics.eval.math_ops import eval_Norm, eval_Norm_p diff --git a/mathics/builtin/vectors/vector_space_operations.py b/mathics/builtin/vectors/vector_space_operations.py index b6175df0b..e0146d977 100644 --- a/mathics/builtin/vectors/vector_space_operations.py +++ b/mathics/builtin/vectors/vector_space_operations.py @@ -6,12 +6,12 @@ from sympy.physics.quantum import TensorProduct -from mathics.builtin.base import Builtin, SympyFunction from mathics.core.atoms import Complex, Integer, Integer0, Integer1, Real from mathics.core.attributes import ( # A_LISTABLE,; A_NUMERIC_FUNCTION, A_PROTECTED, A_READ_PROTECTED, ) +from mathics.core.builtin import Builtin, SympyFunction from mathics.core.convert.sympy import from_sympy, to_sympy_matrix from mathics.core.evaluation import Evaluation from mathics.core.expression import Expression diff --git a/mathics/core/assignment.py b/mathics/core/assignment.py index ab10eacee..6c66e69c0 100644 --- a/mathics/core/assignment.py +++ b/mathics/core/assignment.py @@ -468,7 +468,7 @@ def eval_assign_list(self, lhs, rhs, evaluation, tags, upset): def eval_assign_makeboxes(self, lhs, rhs, evaluation, tags, upset): # FIXME: the below is a big hack. # Currently MakeBoxes boxing is implemented as a bunch of rules. - # See mathics.builtin.base contribute(). + # See mathics.core.builtin contribute(). # I think we want to change this so it works like normal SetDelayed # That is: # MakeBoxes[CubeRoot, StandardForm] := RadicalBox[3, StandardForm] diff --git a/mathics/builtin/base.py b/mathics/core/builtin.py similarity index 100% rename from mathics/builtin/base.py rename to mathics/core/builtin.py diff --git a/mathics/core/expression.py b/mathics/core/expression.py index 098e385a0..50f77a777 100644 --- a/mathics/core/expression.py +++ b/mathics/core/expression.py @@ -1454,7 +1454,7 @@ def to_python(self, *args, **kwargs): numbers -> Python number If kwarg n_evaluation is given, apply N first to the expression. """ - from mathics.builtin.base import mathics_to_python + from mathics.core.builtin import mathics_to_python n_evaluation = kwargs.get("n_evaluation", None) assert n_evaluation is None diff --git a/mathics/core/load_builtin.py b/mathics/core/load_builtin.py index a2a3453e2..6e53add36 100755 --- a/mathics/core/load_builtin.py +++ b/mathics/core/load_builtin.py @@ -34,7 +34,7 @@ # The fact that are importing inside here, suggests add_builtins # should get moved elsewhere. def add_builtins(new_builtins): - from mathics.builtin.base import ( + from mathics.core.builtin import ( Operator, PatternObject, SympyObject, @@ -63,7 +63,7 @@ def add_builtins(new_builtins): def add_builtins_from_builtin_modules(modules: List[ModuleType]): # This can be put at the top after mathics.builtin.__init__ # cleanup is done. - from mathics.builtin.base import Builtin + from mathics.core.builtin import Builtin builtins_list = [] for module in modules: @@ -256,8 +256,8 @@ def name_is_builtin_symbol(module: ModuleType, name: str) -> Optional[type]: ) is not module and not module.__name__.startswith("pymathics."): return None - # Skip objects in module mathics.builtin.base. - if module_object.__module__ == "mathics.builtin.base": + # Skip objects in module mathics.core.builtin. + if module_object.__module__ == "mathics.core.builtin": return None # Skip those builtins that are not submodules of mathics.builtin. @@ -267,7 +267,7 @@ def name_is_builtin_symbol(module: ModuleType, name: str) -> Optional[type]: ): return None - from mathics.builtin.base import Builtin + from mathics.core.builtin import Builtin # If it is not a subclass of Builtin, skip it. if not issubclass(module_object, Builtin): diff --git a/mathics/doc/common_doc.py b/mathics/doc/common_doc.py index 617c43e27..fa42b2898 100644 --- a/mathics/doc/common_doc.py +++ b/mathics/doc/common_doc.py @@ -32,7 +32,7 @@ from typing import Callable from mathics import settings -from mathics.builtin.base import check_requires_list +from mathics.core.builtin import check_requires_list from mathics.core.evaluation import Message, Print from mathics.core.load_builtin import ( builtins_by_module as global_builtins_by_module, diff --git a/mathics/eval/image.py b/mathics/eval/image.py index 18bb6dee6..b53d9ecf0 100644 --- a/mathics/eval/image.py +++ b/mathics/eval/image.py @@ -12,8 +12,8 @@ import PIL import PIL.Image -from mathics.builtin.base import String from mathics.core.atoms import Rational +from mathics.core.builtin import String from mathics.core.convert.python import from_python from mathics.core.evaluation import Evaluation from mathics.core.expression import Expression diff --git a/mathics/eval/pymathics.py b/mathics/eval/pymathics.py index d5ef66dfb..f61b41570 100644 --- a/mathics/eval/pymathics.py +++ b/mathics/eval/pymathics.py @@ -6,7 +6,7 @@ import inspect import sys -from mathics.builtin.base import Builtin +from mathics.core.builtin import Builtin from mathics.core.definitions import Definitions from mathics.core.load_builtin import builtins_by_module, name_is_builtin_symbol diff --git a/mathics/timing.py b/mathics/timing.py index 72ac28737..2f9538a61 100644 --- a/mathics/timing.py +++ b/mathics/timing.py @@ -66,8 +66,8 @@ def show_lru_cache_statistics(): Print statistics from LRU caches (@lru_cache of functools) """ from mathics.builtin.atomic.numbers import log_n_b - from mathics.builtin.base import MPMathFunction, run_sympy from mathics.core.atoms import Integer, Rational + from mathics.core.builtin import MPMathFunction, run_sympy from mathics.core.convert.mpmath import from_mpmath from mathics.eval.arithmetic import call_mpmath diff --git a/test/builtin/box/test_custom_boxexpression.py b/test/builtin/box/test_custom_boxexpression.py index f83335c92..6616a1e45 100644 --- a/test/builtin/box/test_custom_boxexpression.py +++ b/test/builtin/box/test_custom_boxexpression.py @@ -1,9 +1,9 @@ from test.helper import evaluate, session -from mathics.builtin.base import Predefined from mathics.builtin.box.expression import BoxExpression from mathics.builtin.graphics import GRAPHICS_OPTIONS from mathics.core.attributes import A_HOLD_ALL, A_PROTECTED, A_READ_PROTECTED +from mathics.core.builtin import Predefined from mathics.core.evaluation import Evaluation from mathics.core.expression import Expression from mathics.core.symbols import Symbol diff --git a/test/builtin/drawing/test_image.py b/test/builtin/drawing/test_image.py index 7f2835609..c7e52b74e 100644 --- a/test/builtin/drawing/test_image.py +++ b/test/builtin/drawing/test_image.py @@ -9,7 +9,7 @@ import pytest -from mathics.builtin.base import check_requires_list +from mathics.core.builtin import check_requires_list from mathics.core.symbols import SymbolNull # Note we test with tif, jpg, and gif. Add others? diff --git a/test/builtin/numbers/test_calculus.py b/test/builtin/numbers/test_calculus.py index 44d36a9e3..5f89b8615 100644 --- a/test/builtin/numbers/test_calculus.py +++ b/test/builtin/numbers/test_calculus.py @@ -13,7 +13,7 @@ import pytest -from mathics.builtin.base import check_requires_list +from mathics.core.builtin import check_requires_list if check_requires_list(["scipy", "scipy.integrate"]): methods_findminimum = ["Automatic", "Newton", "brent", "golden"] diff --git a/test/builtin/numbers/test_nintegrate.py b/test/builtin/numbers/test_nintegrate.py index e88f8ae29..cfe1e2b05 100644 --- a/test/builtin/numbers/test_nintegrate.py +++ b/test/builtin/numbers/test_nintegrate.py @@ -10,7 +10,7 @@ import pytest -from mathics.builtin.base import check_requires_list +from mathics.core.builtin import check_requires_list if check_requires_list(["scipy", "scipy.integrate"]): methods = ["Automatic", "Romberg", "Internal", "NQuadrature"] diff --git a/test/consistency-and-style/test_duplicate_builtins.py b/test/consistency-and-style/test_duplicate_builtins.py index 5ece63ccb..3e1914119 100644 --- a/test/consistency-and-style/test_duplicate_builtins.py +++ b/test/consistency-and-style/test_duplicate_builtins.py @@ -8,7 +8,7 @@ import pytest -from mathics.builtin.base import Builtin +from mathics.core.builtin import Builtin from mathics.core.load_builtin import mathics3_builtins_modules, name_is_builtin_symbol diff --git a/test/consistency-and-style/test_summary_text.py b/test/consistency-and-style/test_summary_text.py index 88b87aa71..e27d4c79c 100644 --- a/test/consistency-and-style/test_summary_text.py +++ b/test/consistency-and-style/test_summary_text.py @@ -7,7 +7,7 @@ import pytest from mathics import __file__ as mathics_initfile_path -from mathics.builtin.base import Builtin +from mathics.core.builtin import Builtin from mathics.core.load_builtin import name_is_builtin_symbol from mathics.doc.common_doc import skip_doc diff --git a/test/core/test_expression.py b/test/core/test_expression.py index 3878de520..62676a23c 100644 --- a/test/core/test_expression.py +++ b/test/core/test_expression.py @@ -4,7 +4,7 @@ import pytest -from mathics.builtin.base import check_requires_list +from mathics.core.builtin import check_requires_list from mathics.core.expression import Expression from mathics.core.symbols import Symbol, SymbolPlus, SymbolTimes diff --git a/test/format/test_format.py b/test/format/test_format.py index cc01d3439..4f6c8af50 100644 --- a/test/format/test_format.py +++ b/test/format/test_format.py @@ -6,7 +6,7 @@ session = MathicsSession() -# from mathics.builtin.base import BoxConstruct, Predefined +# from mathics.core.builtin import BoxConstruct, Predefined import pytest diff --git a/test/test_help.py b/test/test_help.py index 4d8fe28d1..f4d9bd945 100755 --- a/test/test_help.py +++ b/test/test_help.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -from mathics.builtin.base import Builtin +from mathics.core.builtin import Builtin from .helper import check_evaluation From bcdb519d9fd1179fb4c310e780426f47ec9170a9 Mon Sep 17 00:00:00 2001 From: rocky Date: Sun, 6 Aug 2023 20:49:20 -0400 Subject: [PATCH 2/2] Add docstring for mathics.core.builtin module --- mathics/core/builtin.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/mathics/core/builtin.py b/mathics/core/builtin.py index 306acc62e..31845afa7 100644 --- a/mathics/core/builtin.py +++ b/mathics/core/builtin.py @@ -1,4 +1,10 @@ # -*- coding: utf-8 -*- +""" +Class definitions used in mathics.builtin modules that define the +base Mathics3's classes: Predefined, Builtin, Test, Operator (and from that +UnaryOperator, BinaryOperator, PrefixOperator, PostfixOperator, etc.), +SympyFunction, MPMathFunction, etc. +""" import importlib import re @@ -61,9 +67,6 @@ from mathics.eval.numerify import numerify from mathics.eval.scoping import dynamic_scoping -# Signals to Mathics doc processing not to include this module in its documentation. -no_doc = True - class Builtin: """ @@ -791,7 +794,7 @@ def eval_range(self, expr, i, imax, evaluation): def eval_max(self, expr, imax, evaluation): "%(name)s[expr_, {imax_}]" - # Even though `imax` should be an integeral value, its type does not + # Even though `imax` should be an integral value, its type does not # have to be an Integer. result = []