Skip to content

Commit ada387b

Browse files
committed
black
1 parent de14b91 commit ada387b

File tree

2 files changed

+16
-27
lines changed

2 files changed

+16
-27
lines changed

mathics/core/evaluation.py

-1
Original file line numberDiff line numberDiff line change
@@ -267,7 +267,6 @@ def __init__(
267267
self.cache_eval = {}
268268
self.cache_result = False
269269

270-
271270
def parse(self, query):
272271
"Parse a single expression and print the messages."
273272
from mathics.core.parser import MathicsSingleLineFeeder

mathics/core/expression.py

+16-26
Original file line numberDiff line numberDiff line change
@@ -144,12 +144,7 @@ def from_python(arg):
144144
# return Symbol(arg)
145145
elif isinstance(arg, dict):
146146
entries = [
147-
Expression(
148-
"Rule",
149-
from_python(key),
150-
from_python(arg[key]),
151-
)
152-
for key in arg
147+
Expression("Rule", from_python(key), from_python(arg[key]),) for key in arg
153148
]
154149
return Expression(SymbolList, *entries)
155150
elif isinstance(arg, BaseExpression):
@@ -1318,11 +1313,10 @@ def evaluate(self, evaluation) -> typing.Union["Expression", "Symbol"]:
13181313
# evaluation.cache_result can be set here or from inside the evaluation
13191314
# of a branch. Once it is set to false, the result is not cached,
13201315
# and hence, not used.
1321-
if evaluation.cache_result and (self.get_head_name() in (
1322-
"System`Out",
1323-
"System`ToBoxes",
1324-
"System`MakeBoxes",
1325-
)):
1316+
if evaluation.cache_result and (
1317+
self.get_head_name()
1318+
in ("System`Out", "System`ToBoxes", "System`MakeBoxes",)
1319+
):
13261320
evaluation.cache_result = False
13271321

13281322
if evaluation.cache_result:
@@ -1901,21 +1895,17 @@ def thread(self, evaluation, head=None) -> typing.Tuple[bool, "Expression"]:
19011895
return True, Expression(head, *leaves)
19021896

19031897
def is_numeric(self) -> bool:
1904-
return (
1905-
self._head.get_name()
1906-
in system_symbols(
1907-
"Sqrt",
1908-
"Times",
1909-
"Plus",
1910-
"Subtract",
1911-
"Minus",
1912-
"Power",
1913-
"Abs",
1914-
"Divide",
1915-
"Sin",
1916-
)
1917-
and all(leaf.is_numeric() for leaf in self._leaves)
1918-
)
1898+
return self._head.get_name() in system_symbols(
1899+
"Sqrt",
1900+
"Times",
1901+
"Plus",
1902+
"Subtract",
1903+
"Minus",
1904+
"Power",
1905+
"Abs",
1906+
"Divide",
1907+
"Sin",
1908+
) and all(leaf.is_numeric() for leaf in self._leaves)
19191909
# TODO: complete list of numeric functions, or access NumericFunction
19201910
# attribute
19211911

0 commit comments

Comments
 (0)