Skip to content

Commit

Permalink
fixup: Format Python code with Black
Browse files Browse the repository at this point in the history
  • Loading branch information
rocky committed Jun 29, 2021
1 parent de14b91 commit 934273c
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 11 deletions.
5 changes: 3 additions & 2 deletions mathics/builtin/assignment.py
Original file line number Diff line number Diff line change
Expand Up @@ -315,8 +315,9 @@ def assign_elementary(self, lhs, rhs, evaluation, tags=None, upset=False):
# $Context = $Context <> "test`"
#
if new_context.startswith("`"):
new_context = evaluation.definitions.get_current_context() + new_context.lstrip(
"`"
new_context = (
evaluation.definitions.get_current_context()
+ new_context.lstrip("`")
)

evaluation.definitions.set_current_context(new_context)
Expand Down
4 changes: 2 additions & 2 deletions mathics/builtin/files_io/importexport.py
Original file line number Diff line number Diff line change
Expand Up @@ -1092,7 +1092,7 @@ class RegisterImport(Builtin):

def apply(self, formatname, function, posts, evaluation, options):
"""ImportExport`RegisterImport[formatname_String, function_, posts_,
OptionsPattern[ImportExport`RegisterImport]]"""
OptionsPattern[ImportExport`RegisterImport]]"""
evaluation.cache_result = False

if function.has_form("List", None):
Expand Down Expand Up @@ -1175,7 +1175,7 @@ class RegisterExport(Builtin):

def apply(self, formatname, function, evaluation, options):
"""ImportExport`RegisterExport[formatname_String, function_,
OptionsPattern[ImportExport`RegisterExport]]"""
OptionsPattern[ImportExport`RegisterExport]]"""

evaluation.cache_result = False
EXPORTERS[formatname.get_string_value()] = (function, options)
Expand Down
2 changes: 1 addition & 1 deletion mathics/builtin/system.py
Original file line number Diff line number Diff line change
Expand Up @@ -621,7 +621,7 @@ class ClearSystemCache(Builtin):
<dt>'ClearSystemCache[]'
<dd> Clears the internal system cache of expressions.
</dl>
"""

def apply_clear(self, evaluation):
Expand Down
1 change: 0 additions & 1 deletion mathics/core/evaluation.py
Original file line number Diff line number Diff line change
Expand Up @@ -267,7 +267,6 @@ def __init__(
self.cache_eval = {}
self.cache_result = False


def parse(self, query):
"Parse a single expression and print the messages."
from mathics.core.parser import MathicsSingleLineFeeder
Expand Down
13 changes: 8 additions & 5 deletions mathics/core/expression.py
Original file line number Diff line number Diff line change
Expand Up @@ -1318,11 +1318,14 @@ def evaluate(self, evaluation) -> typing.Union["Expression", "Symbol"]:
# evaluation.cache_result can be set here or from inside the evaluation
# of a branch. Once it is set to false, the result is not cached,
# and hence, not used.
if evaluation.cache_result and (self.get_head_name() in (
"System`Out",
"System`ToBoxes",
"System`MakeBoxes",
)):
if evaluation.cache_result and (
self.get_head_name()
in (
"System`Out",
"System`ToBoxes",
"System`MakeBoxes",
)
):
evaluation.cache_result = False

if evaluation.cache_result:
Expand Down

0 comments on commit 934273c

Please sign in to comment.