Skip to content

Commit 0a26f3f

Browse files
committed
clean up
1 parent 6f25908 commit 0a26f3f

8 files changed

Lines changed: 6 additions & 38 deletions

File tree

mathics/builtin/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
PatternObject,
2424
)
2525

26+
from mathics.settings import ENABLE_FILES_MODULE
2627

2728
exclude_files = set(("files", "codetables", "base", "importexport", "colors"))
2829
module_names = [

mathics/builtin/functional.py

Lines changed: 1 addition & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -89,38 +89,9 @@ def apply_named(self, vars, body, args, evaluation):
8989
var.get_name() for var in vars), args[:len(vars)])))
9090
return body.replace_vars(vars)
9191

92-
def apply_named_attr(self, vars, body, attr, args, evaluation):
93-
'Function[vars_, body_, attr_][args___]'
94-
95-
## FIXME: In order to get the proper behaviour, we need
96-
## to take into account the attributes in the evaluation
97-
##
98-
99-
print("Warning: incomplete implementation")
100-
if attr.has_form('List', None):
101-
attr = [str(a) for a in attr.leaves]
102-
else:
103-
attr = [str(attr)]
104-
105-
106-
if vars.has_form('List', None):
107-
vars = vars.leaves
108-
else:
109-
vars = [vars]
110-
111-
112-
args = args.get_sequence()
113-
if len(vars) > len(args):
114-
evaluation.message('Function', 'fpct', )
115-
else:
116-
vars = dict(list(zip((
117-
var.get_name() for var in vars), args[:len(vars)])))
118-
return body.replace_vars(vars)
119-
120-
12192
# Not sure if DRY is possible here...
12293
def apply_named_attr(self, vars, body, attr, args, evaluation):
123-
'Function[vars_, body_, attr_][args___]'
94+
'Function[vars_, body_, attr_][args___]'
12495
if vars.has_form('List', None):
12596
vars = vars.leaves
12697
else:

mathics/builtin/lists.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -443,6 +443,7 @@ def select(inner):
443443

444444
return select
445445

446+
446447
def _parts_span_selector(pspec):
447448
if len(pspec.leaves) > 3:
448449
raise MessageException("Part", "span", pspec)

mathics/builtin/options.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,7 @@ class OptionValue(Builtin):
129129
'optnf': "Option name `1` not found.",
130130
}
131131

132+
132133
rules = {
133134
'OptionValue[optnames_List]': 'OptionValue/@optnames',
134135
'OptionValue[f_, optnames_List]': 'OptionValue[f,#1]&/@optnames',
@@ -298,8 +299,6 @@ def test(self, expr):
298299
expr = [expr]
299300
else:
300301
expr = expr.get_leaves()
301-
302-
303302
return all(e.has_form('Rule', None) or e.has_form('RuleDelayed', 2)
304303
for e in expr)
305304

mathics/builtin/patterns.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -759,7 +759,6 @@ class Pattern_(PatternObject):
759759
'pattern_?(!MatchQ[#, _Blank|_BlankSequence|_BlankNullSequence]&)]': (
760760
'Infix[{symbol, pattern}, ":", 150, Left]'),
761761
}
762-
precedence = 1000
763762

764763
def init(self, expr):
765764
super(Pattern_, self).init(expr)

mathics/builtin/strings.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1575,6 +1575,7 @@ class ToString(Builtin):
15751575
>> "U" <> ToString[2]
15761576
= U2
15771577
"""
1578+
15781579
options = {'CharacterEncoding' : '"Unicode"',
15791580
'FormatType' : 'OutputForm',
15801581
'NumberMarks': '$NumberMarks',

test/test_cellstotex.py

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,6 @@ def test_load():
4747
expected2 = _evaluate('{"CellToTeX", "CellsToTeXException", "CellsToTeXPreamble"}')
4848
print(result2)
4949
assert result2 == expected2
50-
5150

5251

5352
@pytest.mark.skipif(not url_reachable, reason="skipping since we can't reach %s" % external_url)
@@ -65,15 +64,12 @@ def test_load_and_run():
6564
if result0 == Symbol("System`$Failed"):
6665
return 0
6766

68-
69-
7067
str_expr1 = 'CellsToTeXPreamble[]'
7168
str_expected1 = '"\\mmaSet{morefv={gobble=2,},}\\n"'
7269
result1 = _evaluate(str_expr1)
7370
expected1 = _evaluate(str_expected1)
7471
assert result1 == expected1
7572

76-
7773
str_expr1 = 'boxes=MakeBoxes[Pi];\
7874
cell = Cell[BoxData[boxes], "Input"];res=Catch[CellToTeX[cell, Style->"Input"]]'
7975
str_expected1 = '"\\begin{mmaCell}{Input}\n \\pi\n\\end{mmaCell}"'

test/test_evaluation.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@
5555
def test_evaluation(str_expr: str, str_expected: str, message=""):
5656
result = session.evaluate(str_expr)
5757
expected = session.evaluate(str_expected)
58-
print("message=", message)
58+
5959
if message:
6060
assert result == expected, message
6161
else:

0 commit comments

Comments
 (0)