From ada387bc55282a0fd211ea70942baa79d8822da5 Mon Sep 17 00:00:00 2001 From: mmatera Date: Tue, 29 Jun 2021 19:14:22 -0300 Subject: [PATCH] black --- mathics/core/evaluation.py | 1 - mathics/core/expression.py | 42 +++++++++++++++----------------------- 2 files changed, 16 insertions(+), 27 deletions(-) diff --git a/mathics/core/evaluation.py b/mathics/core/evaluation.py index 2bc938ec0..f4c046433 100644 --- a/mathics/core/evaluation.py +++ b/mathics/core/evaluation.py @@ -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 diff --git a/mathics/core/expression.py b/mathics/core/expression.py index 6a672ad6d..01f6361cc 100644 --- a/mathics/core/expression.py +++ b/mathics/core/expression.py @@ -144,12 +144,7 @@ def from_python(arg): # return Symbol(arg) elif isinstance(arg, dict): entries = [ - Expression( - "Rule", - from_python(key), - from_python(arg[key]), - ) - for key in arg + Expression("Rule", from_python(key), from_python(arg[key]),) for key in arg ] return Expression(SymbolList, *entries) elif isinstance(arg, BaseExpression): @@ -1318,11 +1313,10 @@ 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: @@ -1901,21 +1895,17 @@ def thread(self, evaluation, head=None) -> typing.Tuple[bool, "Expression"]: return True, Expression(head, *leaves) def is_numeric(self) -> bool: - return ( - self._head.get_name() - in system_symbols( - "Sqrt", - "Times", - "Plus", - "Subtract", - "Minus", - "Power", - "Abs", - "Divide", - "Sin", - ) - and all(leaf.is_numeric() for leaf in self._leaves) - ) + return self._head.get_name() in system_symbols( + "Sqrt", + "Times", + "Plus", + "Subtract", + "Minus", + "Power", + "Abs", + "Divide", + "Sin", + ) and all(leaf.is_numeric() for leaf in self._leaves) # TODO: complete list of numeric functions, or access NumericFunction # attribute