Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 8 additions & 5 deletions CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,19 @@ CHANGES
2.1.1
-----

New builtins
++++++++++++
New variables and builtins
++++++++++++++++++++++++++

* ``Arg``
* ``Dispatch``
* ``FullSimplify``
* ``LetterNumber`` #1298. The ``alphabet`` parameter supports only a minimal number of languages.
* ``MemoryAvailable``
* ``MemoryInUse``
* ``Nand`` and ``Nor`` logical functions.
* ``Series``, ``O`` and ``SeriesData``
* ``StringReverse``
* ``$SystemMemory``
* Add all of the named colors, e.g. ``Brown`` or ``LighterMagenta``.


Expand All @@ -28,7 +31,7 @@ Enhancements
* ``D`` and ``Derivative`` improvements.
* ``FileNames`` returns a sorted list (#1250).
* ``FindRoot`` now receives several optional parameters like ``Method`` and ``MaxIterations``.
* ``FixedPoint`` now supports the ``SameTest`` option.
* ``FixedPoint`` now supports the ``SameTest`` option.
* ``Prime`` and ``PrimePi`` now accept a list parameter and have the ``NumericFunction`` attribute.
* ``ReplaceRepeated`` and ``FixedPoint`` now supports the ``MaxIteration`` option (#1260).
* ``Simplify`` performs a more sophisticated set of simplifications.
Expand All @@ -38,7 +41,7 @@ Enhancements
* ``ToString`` accepts an optional *form* parameter.
* ``ToExpression`` handles multi-line string input
* The implementation of Streams was redone.



Bug fixes
Expand All @@ -54,7 +57,7 @@ Internal changes
----------------

* doctest accepts the option `-d` to show how long it takes to parse, evaluate and compare each individual test.


2.1.0
-----
Expand Down
20 changes: 6 additions & 14 deletions mathics/builtin/system.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

import os
import platform
import psutil
import sys
import re
import subprocess
Expand Down Expand Up @@ -472,13 +473,8 @@ class SystemMemory(Predefined):
name = "$SystemMemory"

def evaluate(self, evaluation) -> Integer:
try:
import psutil
totalmem = psutil.virtual_memory().total
return Integer(total)
except:
return String(SymbolFailed)

totalmem = psutil.virtual_memory().total
return Integer(totalmem)

class MemoryAvailable(Builtin):
"""
Expand All @@ -491,14 +487,10 @@ class MemoryAvailable(Builtin):
= ...
"""

def apply_0(self, evaluation) -> Integer:
def apply(self, evaluation) -> Integer:
"""MemoryAvailable[]"""
try:
import psutil
totalmem = psutil.virtual_memory().available
return Integer(total)
except:
return String(SymbolFailed)
totalmem = psutil.virtual_memory().available
return Integer(totalmem)


class MemoryInUse(Builtin):
Expand Down
1 change: 1 addition & 0 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@ def read(*rnames):
"palettable",
"pint",
"python-dateutil",
"psutil", # for $SystemMemory
"llvmlite",
"requests",
"scikit-image",
Expand Down