@@ -144,12 +144,7 @@ def from_python(arg):
144
144
# return Symbol(arg)
145
145
elif isinstance (arg , dict ):
146
146
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
153
148
]
154
149
return Expression (SymbolList , * entries )
155
150
elif isinstance (arg , BaseExpression ):
@@ -1318,11 +1313,10 @@ def evaluate(self, evaluation) -> typing.Union["Expression", "Symbol"]:
1318
1313
# evaluation.cache_result can be set here or from inside the evaluation
1319
1314
# of a branch. Once it is set to false, the result is not cached,
1320
1315
# 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
+ ):
1326
1320
evaluation .cache_result = False
1327
1321
1328
1322
if evaluation .cache_result :
@@ -1901,21 +1895,17 @@ def thread(self, evaluation, head=None) -> typing.Tuple[bool, "Expression"]:
1901
1895
return True , Expression (head , * leaves )
1902
1896
1903
1897
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 )
1919
1909
# TODO: complete list of numeric functions, or access NumericFunction
1920
1910
# attribute
1921
1911
0 commit comments