Skip to content

Commit 1dd6fb9

Browse files
authored
Merge pull request #673 from Mathics3/complete_doc_url_bunch_e
Another bunch of urls in docstrings
2 parents 50b5619 + c2affac commit 1dd6fb9

File tree

16 files changed

+327
-74
lines changed

16 files changed

+327
-74
lines changed

mathics/builtin/attributes.py

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -14,17 +14,17 @@
1414
"""
1515

1616

17-
from mathics.builtin.base import Predefined, Builtin
17+
from mathics.builtin.base import Builtin, Predefined
1818
from mathics.core.assignment import get_symbol_list
1919
from mathics.core.atoms import String
2020
from mathics.core.attributes import (
21-
attributes_bitset_to_list,
22-
attribute_string_to_number,
2321
A_HOLD_ALL,
2422
A_HOLD_FIRST,
2523
A_LISTABLE,
2624
A_LOCKED,
2725
A_PROTECTED,
26+
attribute_string_to_number,
27+
attributes_bitset_to_list,
2828
)
2929
from mathics.core.expression import Expression
3030
from mathics.core.list import ListExpression
@@ -237,7 +237,7 @@ class HoldAll(Predefined):
237237
<dl>
238238
<dt>'HoldAll'
239239
<dd>is an attribute specifying that all arguments of a \
240-
function should be left unevaluated.
240+
function should be left unevaluated.
241241
</dl>
242242
243243
>> Attributes[Function]
@@ -256,8 +256,8 @@ class HoldAllComplete(Predefined):
256256
<dl>
257257
<dt>'HoldAllComplete'
258258
<dd>is an attribute that includes the effects of 'HoldAll' and \
259-
'SequenceHold', and also protects the function from being \
260-
affected by the upvalues of any arguments.
259+
'SequenceHold', and also protects the function from being \
260+
affected by the upvalues of any arguments.
261261
</dl>
262262
263263
'HoldAllComplete' even prevents upvalues from being used, and \
@@ -271,7 +271,8 @@ class HoldAllComplete(Predefined):
271271
= f[Sequence[a, b]]
272272
"""
273273

274-
summary_text = "attribute for symbols that keep unevaluated all their elements, and discards upvalues"
274+
summary_text = "attribute for symbols that keep unevaluated all \
275+
their elements, and discards upvalues"
275276

276277

277278
class HoldFirst(Predefined):
@@ -283,14 +284,15 @@ class HoldFirst(Predefined):
283284
<dl>
284285
<dt>'HoldFirst'
285286
<dd>is an attribute specifying that the first argument of a \
286-
function should be left unevaluated.
287+
function should be left unevaluated.
287288
</dl>
288289
289290
>> Attributes[Set]
290291
= {HoldFirst, Protected, SequenceHold}
291292
"""
292293

293-
summary_text = "attribute for symbols that keep unevaluated their first element"
294+
summary_text = "attribute for symbols that keep unevaluated their \
295+
first element"
294296

295297

296298
class HoldRest(Predefined):
@@ -379,7 +381,7 @@ class NHoldAll(Predefined):
379381
<dl>
380382
<dt>'NHoldAll'
381383
<dd>is an attribute that protects all arguments of a \
382-
function from numeric evaluation.
384+
function from numeric evaluation.
383385
</dl>
384386
385387
>> N[f[2, 3]]

mathics/builtin/binary/io.py

Lines changed: 27 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -4,29 +4,26 @@
44
"""
55

66
import math
7-
import mpmath
87
import struct
9-
import sympy
10-
118
from itertools import chain
129

10+
import mpmath
11+
import sympy
12+
1313
from mathics.builtin.base import Builtin
1414
from mathics.core.atoms import Complex, Integer, MachineReal, Real, String
1515
from mathics.core.convert.expression import to_expression, to_mathics_list
1616
from mathics.core.convert.mpmath import from_mpmath
1717
from mathics.core.expression import Expression
18-
19-
from mathics.core.systemsymbols import (
20-
SymbolDirectedInfinity,
21-
SymbolIndeterminate,
22-
)
23-
2418
from mathics.core.number import dps
2519
from mathics.core.read import SymbolEndOfFile
2620
from mathics.core.streams import stream_manager
2721
from mathics.core.symbols import Symbol
28-
from mathics.core.systemsymbols import SymbolComplex
29-
22+
from mathics.core.systemsymbols import (
23+
SymbolComplex,
24+
SymbolDirectedInfinity,
25+
SymbolIndeterminate,
26+
)
3027
from mathics.eval.nevaluator import eval_N
3128

3229
SymbolBinaryWrite = Symbol("BinaryWrite")
@@ -362,12 +359,18 @@ def _UnsignedInteger128_writer(s, x):
362359

363360
class BinaryRead(Builtin):
364361
"""
362+
<url>
363+
:WMA link:
364+
https://reference.wolfram.com/language/ref/BinaryRead.html</url>
365+
365366
<dl>
366-
<dt>'BinaryRead[$stream$]'
367+
<dt>'BinaryRead[$stream$]'
367368
<dd>reads one byte from the stream as an integer from 0 to 255.
368-
<dt>'BinaryRead[$stream$, $type$]'
369+
370+
<dt>'BinaryRead[$stream$, $type$]'
369371
<dd>reads one object of specified type from the stream.
370-
<dt>'BinaryRead[$stream$, {$type1$, $type2$, ...}]'
372+
373+
<dt>'BinaryRead[$stream$, {$type1$, $type2$, ...}]'
371374
<dd>reads a sequence of objects of specified types.
372375
</dl>
373376
@@ -603,11 +606,11 @@ class BinaryRead(Builtin):
603606
"bfmt": "The stream `1` has been opened with BinaryFormat -> False and cannot be used with binary data.",
604607
}
605608

606-
def apply_empty(self, name, n, evaluation):
609+
def eval_empty(self, name, n, evaluation):
607610
"BinaryRead[InputStream[name_, n_Integer]]"
608-
return self.apply(name, n, None, evaluation)
611+
return self.eval(name, n, None, evaluation)
609612

610-
def apply(self, name, n, typ, evaluation):
613+
def eval(self, name, n, typ, evaluation):
611614
"BinaryRead[InputStream[name_, n_Integer], typ_]"
612615

613616
channel = to_expression("InputStream", name, n)
@@ -657,6 +660,10 @@ def apply(self, name, n, typ, evaluation):
657660

658661
class BinaryWrite(Builtin):
659662
"""
663+
<url>
664+
:WMA link:
665+
https://reference.wolfram.com/language/ref/BinaryWrite.html</url>
666+
660667
<dl>
661668
<dt>'BinaryWrite[$channel$, $b$]'
662669
<dd>writes a single byte given as an integer from 0 to 255.
@@ -894,11 +901,11 @@ class BinaryWrite(Builtin):
894901

895902
writers = _BinaryFormat.get_writers()
896903

897-
def apply_notype(self, name, n, b, evaluation):
904+
def eval_notype(self, name, n, b, evaluation):
898905
"BinaryWrite[OutputStream[name_, n_], b_]"
899-
return self.apply(name, n, b, None, evaluation)
906+
return self.eval(name, n, b, None, evaluation)
900907

901-
def apply(self, name, n, b, typ, evaluation):
908+
def eval(self, name, n, b, typ, evaluation):
902909
"BinaryWrite[OutputStream[name_, n_], b_, typ_]"
903910

904911
channel = to_expression("OutputStream", name, n)

mathics/builtin/binary/system.py

Lines changed: 16 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,15 @@
1111

1212
class ByteOrdering(Predefined):
1313
"""
14+
<url>
15+
:WMA link:
16+
https://reference.wolfram.com/language/ref/ByteOrdering.html</url>
17+
1418
<dl>
1519
<dt>'ByteOrdering'
16-
<dd> is an option for BinaryRead, BinaryWrite, and related functions that specifies what ordering
17-
of bytes should be assumed for your computer system..
20+
<dd> is an option for BinaryRead, BinaryWrite, and related functions \
21+
that specifies what ordering of bytes should be assumed for your \
22+
computer system..
1823
</dl>
1924
2025
X> ByteOrdering
@@ -31,16 +36,17 @@ class ByteOrdering(Predefined):
3136

3237
class ByteOrdering_(Predefined):
3338
"""
34-
<dl>
35-
<dt>'$ByteOrdering'
36-
<dd>returns the native ordering of bytes in binary data on your computer system.
37-
</dl>
39+
<url>:WMA link:https://reference.wolfram.com/language/ref/$ByteOrdering.html</url>
40+
<dl>
41+
<dt>'$ByteOrdering'
42+
<dd>returns the native ordering of bytes in binary data on your computer system.
43+
</dl>
3844
39-
X> $ByteOrdering
40-
= 1
45+
X> $ByteOrdering
46+
= 1
4147
42-
#> $ByteOrdering == -1 || $ByteOrdering == 1
43-
= True
48+
#> $ByteOrdering == -1 || $ByteOrdering == 1
49+
= True
4450
"""
4551

4652
name = "$ByteOrdering"

mathics/builtin/binary/types.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@
99

1010
class Byte(Builtin):
1111
"""
12+
<url>:WMA link:https://reference.wolfram.com/language/ref/Byte.html</url>
13+
1214
<dl>
1315
<dt>'Byte'
1416
<dd>is a data type for 'Read'.

0 commit comments

Comments
 (0)