Skip to content

Commit 3ba2611

Browse files
authored
Rename BinaryOperator to InfixOperator.. (#1175)
Rename BinaryOperator to InfixOperator, since that is more precisely what it is. Also, order the builtin class names more alphabetically within each category of classes. Attach ABC to some abstract classes.
1 parent bf6a8c0 commit 3ba2611

File tree

20 files changed

+240
-230
lines changed

20 files changed

+240
-230
lines changed

mathics/builtin/arithfns/basic.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,8 @@
3131
A_READ_PROTECTED,
3232
)
3333
from mathics.core.builtin import (
34-
BinaryOperator,
3534
Builtin,
35+
InfixOperator,
3636
MPMathFunction,
3737
PrefixOperator,
3838
SympyFunction,
@@ -107,7 +107,7 @@ def eval(self, n, evaluation):
107107
)
108108

109109

110-
class Divide(BinaryOperator):
110+
class Divide(InfixOperator):
111111
"""
112112
<url>
113113
:Division:
@@ -219,7 +219,7 @@ def eval_int(self, x: Integer, evaluation):
219219
return Integer(-x.value)
220220

221221

222-
class Plus(BinaryOperator, SympyFunction):
222+
class Plus(InfixOperator, SympyFunction):
223223
"""
224224
<url>
225225
:Addition:
@@ -345,7 +345,7 @@ def eval(self, items, evaluation):
345345
return eval_Plus(*items_tuple)
346346

347347

348-
class Power(BinaryOperator, MPMathFunction):
348+
class Power(InfixOperator, MPMathFunction):
349349
"""
350350
<url>
351351
:Exponentiation:
@@ -525,7 +525,7 @@ class Sqrt(SympyFunction):
525525
summary_text = "square root"
526526

527527

528-
class Subtract(BinaryOperator):
528+
class Subtract(InfixOperator):
529529
"""
530530
<url>
531531
:Subtraction:
@@ -559,7 +559,7 @@ class Subtract(BinaryOperator):
559559
summary_text = "subtract"
560560

561561

562-
class Times(BinaryOperator, SympyFunction):
562+
class Times(InfixOperator, SympyFunction):
563563
"""
564564
<url>
565565
:Multiplication:

mathics/builtin/assignments/assign_binaryop.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,10 @@
1717

1818

1919
from mathics.core.attributes import A_HOLD_FIRST, A_PROTECTED, A_READ_PROTECTED
20-
from mathics.core.builtin import BinaryOperator, PostfixOperator, PrefixOperator
20+
from mathics.core.builtin import InfixOperator, PostfixOperator, PrefixOperator
2121

2222

23-
class AddTo(BinaryOperator):
23+
class AddTo(InfixOperator):
2424
"""
2525
<url>:WMA link:https://reference.wolfram.com/language/ref/AddTo.html</url>
2626
@@ -78,7 +78,7 @@ class Decrement(PostfixOperator):
7878
)
7979

8080

81-
class DivideBy(BinaryOperator):
81+
class DivideBy(InfixOperator):
8282
"""
8383
<url>:WMA link:https://reference.wolfram.com/language/ref/DivideBy.html</url>
8484
@@ -202,7 +202,7 @@ class PreDecrement(PrefixOperator):
202202
summary_text = "decrease the value by one and assigns that returning the new value"
203203

204204

205-
class SubtractFrom(BinaryOperator):
205+
class SubtractFrom(InfixOperator):
206206
"""
207207
<url>:WMA link:
208208
https://reference.wolfram.com/language/ref/SubtractFrom.html</url>
@@ -230,7 +230,7 @@ class SubtractFrom(BinaryOperator):
230230
summary_text = "subtract a value and assins that returning the new value"
231231

232232

233-
class TimesBy(BinaryOperator):
233+
class TimesBy(InfixOperator):
234234
"""
235235
<url>:WMA link:https://reference.wolfram.com/language/ref/TimesBy.html</url>
236236

mathics/builtin/assignments/assignment.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
A_PROTECTED,
1818
A_SEQUENCE_HOLD,
1919
)
20-
from mathics.core.builtin import BinaryOperator, Builtin
20+
from mathics.core.builtin import Builtin, InfixOperator
2121
from mathics.core.symbols import SymbolNull
2222
from mathics.core.systemsymbols import SymbolFailed
2323
from mathics.eval.pymathics import PyMathicsLoadException, eval_LoadModule
@@ -94,7 +94,7 @@ def eval(self, module, evaluation):
9494
return module
9595

9696

97-
class Set(BinaryOperator, _SetOperator):
97+
class Set(InfixOperator, _SetOperator):
9898
"""
9999
<url>:WMA link:https://reference.wolfram.com/language/ref/Set.html</url>
100100
@@ -338,7 +338,7 @@ def eval(self, f, lhs, rhs, evaluation):
338338
return SymbolFailed
339339

340340

341-
class UpSet(BinaryOperator, _SetOperator):
341+
class UpSet(InfixOperator, _SetOperator):
342342
"""
343343
<url>:WMA link:
344344
https://reference.wolfram.com/language/ref/UpSet.html</url>

mathics/builtin/exp_structure/general.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
"""
55

66
from mathics.core.atoms import Integer
7-
from mathics.core.builtin import BinaryOperator, Builtin, Predefined
7+
from mathics.core.builtin import Builtin, InfixOperator, Predefined
88
from mathics.core.exceptions import InvalidLevelspecError
99
from mathics.core.expression import Evaluation, Expression
1010
from mathics.core.list import ListExpression
@@ -14,7 +14,7 @@
1414
from mathics.eval.parts import python_levelspec, walk_levels
1515

1616

17-
class MapApply(BinaryOperator):
17+
class MapApply(InfixOperator):
1818
"""
1919
<url>
2020
:WMA link:

mathics/builtin/files_io/files.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@
1515
from mathics.core.atoms import Integer, Integer3, String, SymbolString
1616
from mathics.core.attributes import A_PROTECTED, A_READ_PROTECTED
1717
from mathics.core.builtin import (
18-
BinaryOperator,
1918
Builtin,
19+
InfixOperator,
2020
MessageException,
2121
Predefined,
2222
PrefixOperator,
@@ -511,7 +511,7 @@ class OpenAppend(_OpenAction):
511511
)
512512

513513

514-
class Put(BinaryOperator):
514+
class Put(InfixOperator):
515515
"""
516516
<url>:WMA link:https://reference.wolfram.com/language/ref/Put.html</url>
517517
@@ -615,7 +615,7 @@ def eval_default(self, exprs, filename, evaluation):
615615
return expr
616616

617617

618-
class PutAppend(BinaryOperator):
618+
class PutAppend(InfixOperator):
619619
"""
620620
<url>
621621
:WMA link:

mathics/builtin/functional/apply_fns_to_lists.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616

1717
from mathics.builtin.list.constructing import List
1818
from mathics.core.atoms import Integer, Integer3
19-
from mathics.core.builtin import BinaryOperator, Builtin
19+
from mathics.core.builtin import Builtin, InfixOperator
2020
from mathics.core.convert.expression import to_mathics_list
2121
from mathics.core.evaluation import Evaluation
2222
from mathics.core.exceptions import (
@@ -31,7 +31,7 @@
3131
from mathics.eval.parts import python_levelspec, walk_levels
3232

3333

34-
class Apply(BinaryOperator):
34+
class Apply(InfixOperator):
3535
"""
3636
<dl>
3737
<dt>'Apply[$f$, $expr$]'
@@ -103,7 +103,7 @@ def callback(level):
103103
return result
104104

105105

106-
class Map(BinaryOperator):
106+
class Map(InfixOperator):
107107
"""
108108
<dl>
109109
<dt>'Map[$f$, $expr$]' or '$f$ /@ $expr$'

mathics/builtin/list/eol.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
A_PROTECTED,
1919
A_READ_PROTECTED,
2020
)
21-
from mathics.core.builtin import BinaryOperator, Builtin
21+
from mathics.core.builtin import Builtin, InfixOperator
2222
from mathics.core.convert.expression import to_mathics_list
2323
from mathics.core.convert.python import from_python
2424
from mathics.core.evaluation import Evaluation
@@ -1537,7 +1537,7 @@ def cond(element):
15371537
return items.filter(items.head, cond, evaluation)
15381538

15391539

1540-
class Span(BinaryOperator):
1540+
class Span(InfixOperator):
15411541
"""
15421542
<url>:WMA link:https://reference.wolfram.com/language/ref/Span.html</url>
15431543

mathics/builtin/messages.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
from mathics.core.atoms import String
1010
from mathics.core.attributes import A_HOLD_ALL, A_HOLD_FIRST, A_LOCKED, A_PROTECTED
11-
from mathics.core.builtin import BinaryOperator, Builtin, Predefined
11+
from mathics.core.builtin import Builtin, InfixOperator, Predefined
1212
from mathics.core.evaluation import Evaluation, Message as EvaluationMessage
1313
from mathics.core.expression import Expression
1414
from mathics.core.list import ListExpression
@@ -299,7 +299,7 @@ def check_message(expr) -> bool:
299299
return False
300300

301301

302-
class MessageName(BinaryOperator):
302+
class MessageName(InfixOperator):
303303
"""
304304
<url>:WMA link:https://reference.wolfram.com/language/ref/MessageName.html</url>
305305

mathics/builtin/no_meaning.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,10 @@
99
"""
1010

1111
from mathics.core.attributes import A_NO_ATTRIBUTES
12-
from mathics.core.builtin import BinaryOperator
12+
from mathics.core.builtin import InfixOperator
1313

1414

15-
class Star(BinaryOperator):
15+
class Star(InfixOperator):
1616
r"""
1717
Star <url>
1818
:WML link:

mathics/builtin/patterns/composite.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
from typing import Optional as OptionalType, Tuple, Union
88

99
from mathics.core.attributes import A_HOLD_ALL, A_HOLD_FIRST, A_PROTECTED
10-
from mathics.core.builtin import BinaryOperator, Builtin, PatternObject, PostfixOperator
10+
from mathics.core.builtin import Builtin, InfixOperator, PatternObject, PostfixOperator
1111
from mathics.core.element import BaseElement, EvalMixin
1212
from mathics.core.evaluation import Evaluation
1313
from mathics.core.expression import Expression, SymbolVerbatim
@@ -23,7 +23,7 @@ class _StopGeneratorExcept(StopGenerator):
2323
pass
2424

2525

26-
class Alternatives(BinaryOperator, PatternObject):
26+
class Alternatives(InfixOperator, PatternObject):
2727
"""
2828
<url>
2929
:WMA link:

0 commit comments

Comments
 (0)