diff --git a/.github/workflows/consistency-checks.yml b/.github/workflows/consistency-checks.yml index ea3742c34..0cbf4dc4c 100644 --- a/.github/workflows/consistency-checks.yml +++ b/.github/workflows/consistency-checks.yml @@ -35,3 +35,4 @@ jobs: - name: Test Mathics Consistency and Style run: | make check-consistency-and-style + make check-builtin-manifest diff --git a/SYMBOLS_MANIFEST.txt b/SYMBOLS_MANIFEST.txt index 43c6e2162..47d30dde6 100644 --- a/SYMBOLS_MANIFEST.txt +++ b/SYMBOLS_MANIFEST.txt @@ -1,4 +1,3 @@ -CombinatoricaOld`BinarySearch HTML`DataImport HTML`FullDataImport HTML`HyperlinksImport @@ -40,6 +39,7 @@ System`$Machine System`$MachineEpsilon System`$MachineName System`$MachinePrecision +System`$MaxLengthIntStringConversion System`$MaxMachineNumber System`$MaxPrecision System`$MinMachineNumber @@ -105,7 +105,6 @@ System`Apart System`Append System`AppendTo System`Apply -System`ApplyLevel System`ArcCos System`ArcCosh System`ArcCot @@ -134,10 +133,12 @@ System`Attributes System`Automatic System`Axes System`Axis +System`Background System`BarChart System`BaseForm System`Begin System`BeginPackage +System`BellB System`BernoulliB System`BernsteinBasis System`BesselI @@ -197,6 +198,7 @@ System`ChartLegends System`ChebyshevT System`ChebyshevU System`Check +System`CheckAbort System`ChessboardDistance System`Chop System`Circle @@ -238,6 +240,7 @@ System`ConditionalExpression System`Cone System`Cone3DBox System`Conjugate +System`ConjugateTranspose System`Constant System`ConstantArray System`ContainsOnly @@ -322,6 +325,8 @@ System`Dispatch System`Divide System`DivideBy System`Divisible +System`DivisorSigma +System`DivisorSum System`Divisors System`Do System`Dodecahedron @@ -355,12 +360,14 @@ System`Erf System`Erfc System`Erosion System`EuclideanDistance +System`EulerE System`EulerGamma System`EulerPhi System`Evaluate System`EvenQ System`ExactNumberQ System`Except +System`Exit System`Exp System`ExpIntegralE System`ExpIntegralEi @@ -526,6 +533,8 @@ System`Integer System`IntegerDigits System`IntegerExponent System`IntegerLength +System`IntegerPart +System`IntegerPartitions System`IntegerQ System`IntegerReverse System`IntegerString @@ -543,6 +552,7 @@ System`InverseGudermannian System`InverseHaversine System`JaccardDissimilarity System`JacobiP +System`JacobiSymbol System`Join System`Joined System`KelvinBei @@ -554,6 +564,7 @@ System`Keys System`Khinchin System`KnownUnitQ System`KroneckerProduct +System`KroneckerSymbol System`Kurtosis System`LABColor System`LCHColor @@ -574,9 +585,9 @@ System`LessEqual System`LetterCharacter System`LetterNumber System`LetterQ -System`LeviCivitaTensor System`Level System`LevelQ +System`LeviCivitaTensor System`LightBlue System`LightBrown System`LightCyan @@ -600,6 +611,7 @@ System`ListLinePlot System`ListLogPlot System`ListPlot System`ListQ +System`ListStepPlot System`Listable System`LoadModule System`Locked @@ -612,6 +624,7 @@ System`LogisticSigmoid System`Longest System`Lookup System`LowerCaseQ +System`LucasL System`MachineNumberQ System`MachinePrecision System`Magenta @@ -619,6 +632,7 @@ System`MakeBoxes System`ManhattanDistance System`MantissaExponent System`Map +System`MapApply System`MapAt System`MapIndexed System`MapThread @@ -642,6 +656,7 @@ System`Medium System`MemberQ System`MemoryAvailable System`MemoryInUse +System`MersennePrimeExponent System`Mesh System`Message System`MessageName @@ -655,6 +670,7 @@ System`Missing System`Mod System`ModularInverse System`Module +System`MoebiusMu System`MorphologicalComponents System`Most System`Multinomial @@ -760,6 +776,7 @@ System`PolyGamma System`Polygon System`Polygon3DBox System`PolygonBox +System`PolygonalNumber System`PolynomialQ System`Position System`Positive @@ -768,6 +785,7 @@ System`Postfix System`Power System`PowerExpand System`PowerMod +System`PowersRepresentations System`PreDecrement System`PreIncrement System`Precedence @@ -793,6 +811,7 @@ System`PseudoInverse System`Purple System`Put System`PutAppend +System`PythonCProfileEvaluation System`PythonForm System`QRDecomposition System`Quantile @@ -827,8 +846,8 @@ System`ReadProtected System`Real System`RealAbs System`RealDigits -System`RealNumberQ System`RealSign +System`RealValuedNumberQ System`Reals System`Reap System`Record @@ -855,6 +874,7 @@ System`ResetDirectory System`Rest System`Return System`Reverse +System`ReverseSort System`Riffle System`Right System`RogersTanimotoDissimilarity @@ -886,6 +906,7 @@ System`Set System`SetAttributes System`SetDelayed System`SetDirectory +System`SetEnvironment System`SetFileDate System`SetOptions System`SetStreamPosition @@ -925,6 +946,7 @@ System`SplitBy System`Sqrt System`SqrtBox System`SquaredEuclideanDistance +System`SquaresR System`StandardDeviation System`StandardForm System`StartOfLine diff --git a/admin-tools/build_and_check_manifest.py b/admin-tools/build_and_check_manifest.py index 9a8400068..2a1c33fdb 100755 --- a/admin-tools/build_and_check_manifest.py +++ b/admin-tools/build_and_check_manifest.py @@ -5,7 +5,7 @@ from mathics.core.builtin import Builtin from mathics.core.load_builtin import ( import_and_load_builtins, - modules, + mathics3_builtins_modules, name_is_builtin_symbol, ) @@ -15,7 +15,7 @@ def generate_available_builtins_names(): msg = "" builtins_by_name = {} - for module in modules: + for module in mathics3_builtins_modules: vars = dir(module) for name in vars: var = name_is_builtin_symbol(module, name) diff --git a/mathics/builtin/atomic/strings.py b/mathics/builtin/atomic/strings.py index 72326d7b7..22291b7ec 100644 --- a/mathics/builtin/atomic/strings.py +++ b/mathics/builtin/atomic/strings.py @@ -411,14 +411,16 @@ class HexadecimalCharacter(Builtin): # This isn't your normal Box class. We'll keep this here rather than # in mathics.builtin.box for now. -class InterpretationBox(PrefixOperator): +# mmatera commenct: This does not even exist in WMA. \! should be associated +# to `ToExpression`, but it was not properly implemented by now... +class InterpretedBox(PrefixOperator): r""" :WMA link: https://reference.wolfram.com/language/ref/InterpretationBox.html
-
'InterpretationBox[$box$]' +
'InterpretedBox[$box$]'
is the ad hoc fullform for \! $box$. just for internal use...
@@ -430,7 +432,7 @@ class InterpretationBox(PrefixOperator): summary_text = "interpret boxes as an expression" def eval(self, boxes, evaluation: Evaluation): - """InterpretationBox[boxes_]""" + """InterpretedBox[boxes_]""" # TODO: the following is a very raw and dummy way to # handle these expressions. # In the first place, this should handle different kind diff --git a/mathics/builtin/files_io/filesystem.py b/mathics/builtin/files_io/filesystem.py index f0faf505e..59a7fea58 100644 --- a/mathics/builtin/files_io/filesystem.py +++ b/mathics/builtin/files_io/filesystem.py @@ -346,63 +346,6 @@ def eval(self, evaluation: Evaluation): return String(result) -class DirectoryName(Builtin): - """ - :WMA link:https://reference.wolfram.com/language/ref/DirectoryName.html - -
-
'DirectoryName["$name$"]' -
extracts the directory name from a filename. -
- - >> DirectoryName["a/b/c"] - = a/b - - >> DirectoryName["a/b/c", 2] - = a - """ - - messages = { - "string": "String expected at position 1 in `1`.", - "intpm": ("Positive machine-sized integer expected at " "position 2 in `1`."), - } - - options = { - "OperatingSystem": "$OperatingSystem", - } - summary_text = "directory part of a filename" - - def eval_with_n(self, name, n, evaluation: Evaluation, options: dict): - "DirectoryName[name_, n_, OptionsPattern[DirectoryName]]" - - if n is None: - expr = to_expression("DirectoryName", name) - py_n = 1 - else: - expr = to_expression("DirectoryName", name, n) - py_n = n.to_python() - - if not (isinstance(py_n, int) and py_n > 0): - evaluation.message("DirectoryName", "intpm", expr) - return - - py_name = name.to_python() - if not (isinstance(py_name, str) and py_name[0] == py_name[-1] == '"'): - evaluation.message("DirectoryName", "string", expr) - return - py_name = py_name[1:-1] - - result = py_name - for i in range(py_n): - (result, tmp) = osp.split(result) - - return String(result) - - def eval(self, name, evaluation: Evaluation, options: dict): - "DirectoryName[name_, OptionsPattern[DirectoryName]]" - return self.eval_with_n(name, None, evaluation, options) - - class DirectoryStack(Builtin): """ :WMA link:https://reference.wolfram.com/language/ref/DirectoryStack.html diff --git a/mathics/builtin/numbers/constants.py b/mathics/builtin/numbers/constants.py index fc9067197..2f4e4a1d6 100644 --- a/mathics/builtin/numbers/constants.py +++ b/mathics/builtin/numbers/constants.py @@ -756,3 +756,8 @@ class Underflow(Builtin): instance = cls(expression=False) val = instance.get_constant() NUMERICAL_CONSTANTS[instance.symbol] = MachineReal(val.value) + +# Remove these variables to prevent errors in the SYMBOL_MANIFEST check. +del cls +del instance +del val