Skip to content

Commit 0eba075

Browse files
authored
Merge pull request #1505 from mathics/doc-abstracts
Start adding builtin summary texts
2 parents 16bc004 + 9f3cb1d commit 0eba075

File tree

3 files changed

+32
-4
lines changed

3 files changed

+32
-4
lines changed

mathics/builtin/arithfns/basic.py

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,8 @@ class CubeRoot(Builtin):
8787
),
8888
}
8989

90+
summary_text = "cubed root"
91+
9092
def apply(self, n, evaluation):
9193
"CubeRoot[n_Complex]"
9294

@@ -155,6 +157,8 @@ class Divide(BinaryOperator):
155157
),
156158
}
157159

160+
summary_text = r"division"
161+
158162

159163
class Minus(PrefixOperator):
160164
"""
@@ -192,6 +196,8 @@ class Minus(PrefixOperator):
192196
),
193197
}
194198

199+
summary_text = "arithmetic negation"
200+
195201
def apply_int(self, x, evaluation):
196202
"Minus[x_Integer]"
197203

@@ -273,6 +279,7 @@ class Plus(BinaryOperator, SympyFunction):
273279
None: "0",
274280
}
275281

282+
summary_text = "addition of numbers, lists, arrays, or symbolic expressions"
276283
sympy_name = "Add"
277284

278285
def format_plus(self, items, evaluation):
@@ -536,6 +543,8 @@ class Power(BinaryOperator, _MPMathFunction):
536543
"Power[x_]": "x",
537544
}
538545

546+
summary_text = "exponentiation"
547+
539548
def apply_check(self, x, y, evaluation):
540549
"Power[x_, y_]"
541550

@@ -603,6 +612,8 @@ class Sqrt(SympyFunction):
603612
),
604613
}
605614

615+
summary_text = "square root"
616+
606617

607618
class Subtract(BinaryOperator):
608619
"""
@@ -632,6 +643,8 @@ class Subtract(BinaryOperator):
632643
"Subtract[x_, y_]": "Plus[x, Times[-1, y]]",
633644
}
634645

646+
summary_text = "subtraction"
647+
635648

636649
class Times(BinaryOperator, SympyFunction):
637650
"""
@@ -731,11 +744,13 @@ class Times(BinaryOperator, SympyFunction):
731744

732745
default_formats = False
733746

734-
sympy_name = "Mul"
747+
formats = {}
735748

736749
rules = {}
737750

738-
formats = {}
751+
sympy_name = "Mul"
752+
753+
summary_text = "mutiplication"
739754

740755
def format_times(self, items, evaluation, op="\u2062"):
741756
"Times[items__]"

mathics/builtin/datentime.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -757,6 +757,8 @@ class AbsoluteTime(_DateFormat):
757757
= 1000
758758
"""
759759

760+
abstract = "absolute time in seconds"
761+
760762
def apply_now(self, evaluation):
761763
"AbsoluteTime[]"
762764

mathics/builtin/list/associations.py

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,8 @@ class Association(Builtin):
8888
"Protected",
8989
)
9090

91+
summary_text = "an association between keys and values"
92+
9193
def apply_makeboxes(self, rules, f, evaluation):
9294
"""MakeBoxes[<|rules___|>,
9395
f:StandardForm|TraditionalForm|OutputForm|InputForm]"""
@@ -179,8 +181,11 @@ class AssociationQ(Test):
179181
180182
>> AssociationQ[<|a, b|>]
181183
= False
184+
182185
"""
183186

187+
summary_text = "test if an expression is a valid association"
188+
184189
def test(self, expr):
185190
def validate(leaves):
186191
for leaf in leaves:
@@ -263,6 +268,8 @@ class Keys(Builtin):
263268
"invrl": "The argument `1` is not a valid Association or a list of rules.",
264269
}
265270

271+
summary_text = "list association keys"
272+
266273
def apply(self, rules, evaluation):
267274
"Keys[rules___]"
268275

@@ -291,8 +298,8 @@ def get_keys(expr):
291298
class Lookup(Builtin):
292299
"""
293300
<dl>
294-
<dt>Lookup[$assoc$, $key$]
295-
<dd> looks up the value associated with $key$ in the association $assoc$, or Missing[$KeyAbsent$].
301+
<dt>Lookup[$assoc$, $key$]
302+
<dd> looks up the value associated with $key$ in the association $assoc$, or Missing[$KeyAbsent$].
296303
</dl>
297304
"""
298305

@@ -302,6 +309,8 @@ class Lookup(Builtin):
302309
"Lookup[assoc_?AssociationQ, key_]": 'Lookup[assoc, key, Missing["KeyAbsent", key]]',
303310
}
304311

312+
summary_text = "perform lookup of a value by key, returning a specified default if it is not found"
313+
305314

306315
class Missing(Builtin):
307316
pass
@@ -374,6 +383,8 @@ class Values(Builtin):
374383
"invrl": "The argument `1` is not a valid Association or a list of rules.",
375384
}
376385

386+
summary_text = "list association values"
387+
377388
def apply(self, rules, evaluation):
378389
"Values[rules___]"
379390

0 commit comments

Comments
 (0)