Skip to content

Commit fd6b27f

Browse files
committed
revert mistaken docstring change -- read! vs readbytes!
update base/docs/helpdb/Base.jl update rst docs, BBEditTextWrangler-julia.plist replace missing chomp() in getmetabranch() doc tweaks make && make julia-genstdlib more doc tweaks whitespace tweak doc: read!(stream or filename, ...)
1 parent 8279ec9 commit fd6b27f

File tree

7 files changed

+39
-54
lines changed

7 files changed

+39
-54
lines changed

base/docs/helpdb/Base.jl

+14-22
Original file line numberDiff line numberDiff line change
@@ -48,9 +48,9 @@ the same object. `fill!(A, Foo())` will return `A` filled with the result of eva
4848
fill!
4949

5050
"""
51-
read!(stream, array::Array)
51+
read!(stream or filename, array::Array)
5252
53-
Read binary data from a stream, filling in the argument `array`.
53+
Read binary data from a stream or file, filling in the argument `array`.
5454
"""
5555
read!
5656

@@ -452,7 +452,7 @@ the mantissa.
452452
precision
453453

454454
"""
455-
readlines(stream)
455+
readlines(stream or filename)
456456
457457
Read all lines as an array.
458458
"""
@@ -1018,7 +1018,7 @@ See `rounding` for available rounding modes.
10181018
Float32
10191019

10201020
"""
1021-
readuntil(stream, delim)
1021+
readuntil(stream or filename, delim)
10221022
10231023
Read a string, up to and including the given delimiter byte.
10241024
"""
@@ -2438,19 +2438,11 @@ the process.
24382438
triu!(M, k)
24392439

24402440
"""
2441-
readstring(stream::IO)
2441+
readstring(stream or filename)
24422442
2443-
Read the entire contents of an I/O stream as a string.
2443+
Read the entire contents of an I/O stream or a file as a string.
24442444
"""
2445-
readstring(stream::IO)
2446-
2447-
"""
2448-
readstring(filename::AbstractString)
2449-
2450-
Open `filename`, read the entire contents as a string, then close the file. Equivalent to
2451-
`open(readstring, filename)`.
2452-
"""
2453-
readstring(filename::AbstractString)
2445+
readstring
24542446

24552447
"""
24562448
poll_file(path, interval_s::Real, timeout_s::Real) -> (previous::StatStruct, current::StatStruct)
@@ -2468,9 +2460,9 @@ it is more reliable and efficient, although in some situations it may not be ava
24682460
poll_file
24692461

24702462
"""
2471-
eachline(stream)
2463+
eachline(stream or filename)
24722464
2473-
Create an iterable object that will yield each line from a stream.
2465+
Create an iterable object that will yield each line.
24742466
"""
24752467
eachline
24762468

@@ -4251,9 +4243,9 @@ Squared absolute value of `x`.
42514243
abs2
42524244

42534245
"""
4254-
write(stream, x)
4246+
write(stream or filename, x)
42554247
4256-
Write the canonical binary representation of a value to the given stream. Returns the number
4248+
Write the canonical binary representation of a value to the given stream or file. Returns the number
42574249
of bytes written into the stream.
42584250
42594251
You can write multiple values with the same :func:`write` call. i.e. the following are
@@ -6445,7 +6437,7 @@ Read at most `nb` bytes from the stream into `b`, returning the number of bytes
64456437
64466438
See `read` for a description of the `all` option.
64476439
"""
6448-
read!
6440+
readbytes!
64496441

64506442
"""
64516443
basename(path::AbstractString) -> AbstractString
@@ -7423,10 +7415,10 @@ Return the supertype of DataType `T`.
74237415
supertype
74247416

74257417
"""
7426-
readline(stream=STDIN)
7418+
readline(stream=STDIN or filename)
74277419
74287420
Read a single line of text, including a trailing newline character (if one is reached before
7429-
the end of the input), from the given `stream` (defaults to `STDIN`),
7421+
the end of the input), from the given stream or file (defaults to `STDIN`),
74307422
"""
74317423
readline
74327424

base/pkg/dir.jl

+1-1
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ end
6767

6868
function getmetabranch()
6969
try
70-
readline(joinpath(path(),"META_BRANCH"))
70+
chomp(readline(joinpath(path(),"META_BRANCH")))
7171
catch err
7272
META_BRANCH
7373
end

base/stream.jl

+1-1
Original file line numberDiff line numberDiff line change
@@ -273,7 +273,7 @@ disassociate_julia_struct(handle::Ptr{Void}) =
273273
function init_stdio(handle::Ptr{Void})
274274
t = ccall(:jl_uv_handle_type, Int32, (Ptr{Void},), handle)
275275
if t == UV_FILE
276-
return File(RawFD(ccall(:jl_uv_file_handle,Int32,(Ptr{Void},),handle)))
276+
return File(RawFD(ccall(:jl_uv_file_handle,Int32,(Ptr{Void},),handle)))
277277
else
278278
if t == UV_TTY
279279
ret = TTY(handle)

contrib/BBEditTextWrangler-julia.plist

+1-2
Original file line numberDiff line numberDiff line change
@@ -843,10 +843,9 @@
843843
<string>rationalize</string>
844844
<string>read</string>
845845
<string>read!</string>
846-
<string>readall</string>
846+
<string>readstring</string>
847847
<string>readandwrite</string>
848848
<string>readavailable</string>
849-
<string>readbytes</string>
850849
<string>readbytes!</string>
851850
<string>readchomp</string>
852851
<string>readcsv</string>

doc/manual/networking-and-streams.rst

+3-3
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ For example, to read a simple byte array, we could do::
5353
However, since this is slightly cumbersome, there are several convenience methods provided. For example, we could have written the
5454
above as::
5555

56-
julia> readbytes(STDIN,4)
56+
julia> read(STDIN,4)
5757
abcd
5858
4-element Array{UInt8,1}:
5959
0x61
@@ -142,7 +142,7 @@ as its first argument and filename as its second, opens the file, calls the func
142142
an argument, and then closes it again. For example, given a function::
143143

144144
function read_and_capitalize(f::IOStream)
145-
return uppercase(readall(f))
145+
return uppercase(readstring(f))
146146
end
147147

148148
You can call::
@@ -156,7 +156,7 @@ To avoid even having to define a named function, you can use the ``do`` syntax,
156156
function on the fly::
157157

158158
julia> open("hello.txt") do f
159-
uppercase(readall(f))
159+
uppercase(readstring(f))
160160
end
161161
"HELLO AGAIN."
162162

doc/manual/running-external-programs.rst

+4-4
Original file line numberDiff line numberDiff line change
@@ -42,12 +42,12 @@ The ``hello`` is the output of the ``echo`` command, sent to :const:`STDOUT`.
4242
The run method itself returns ``nothing``, and throws an :exc:`ErrorException`
4343
if the external command fails to run successfully.
4444

45-
If you want to read the output of the external command, :func:`readall`
45+
If you want to read the output of the external command, :func:`readstring`
4646
can be used instead:
4747

4848
.. doctest::
4949

50-
julia> a=readall(`echo hello`)
50+
julia> a=readstring(`echo hello`)
5151
"hello\n"
5252

5353
julia> (chomp(a)) == "hello"
@@ -314,7 +314,7 @@ When reading and writing to both ends of a pipeline from a single process,
314314
it is important to avoid forcing the kernel to buffer all of the data.
315315

316316
For example, when reading all of the output from a command,
317-
call ``readall(out)``, not ``wait(process)``, since the former
317+
call ``read(out)``, not ``wait(process)``, since the former
318318
will actively consume all of the data written by the process,
319319
whereas the latter will attempt to store the data in the kernel's
320320
buffers while waiting for a reader to be connected.
@@ -323,7 +323,7 @@ Another common solution is to separate the reader and writer
323323
of the pipeline into separate Tasks::
324324

325325
writer = @async writeall(process, "data")
326-
reader = @async do_compute(readall(process))
326+
reader = @async do_compute(read(process))
327327
wait(process)
328328
fetch(reader)
329329

doc/stdlib/io-network.rst

+15-21
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ General I/O
6565
6666
Apply the function ``f`` to the result of ``open(args...)`` and close the resulting file descriptor upon completion.
6767

68-
**Example**: ``open(readall, "file.txt")``
68+
**Example**: ``open(readstring, "file.txt")``
6969

7070
.. function:: IOBuffer() -> IOBuffer
7171

@@ -121,11 +121,11 @@ General I/O
121121
122122
Close an I/O stream. Performs a ``flush`` first.
123123

124-
.. function:: write(stream, x)
124+
.. function:: write(stream or filename, x)
125125

126126
.. Docstring generated from Julia source
127127
128-
Write the canonical binary representation of a value to the given stream. Returns the number of bytes written into the stream.
128+
Write the canonical binary representation of a value to the given stream or file. Returns the number of bytes written into the stream.
129129

130130
You can write multiple values with the same :func:``write`` call. i.e. the following are equivalent:
131131

@@ -146,7 +146,7 @@ General I/O
146146
147147
Read a series of values of the given type from a stream, in canonical binary representation. ``dims`` is either a tuple or a series of integer arguments specifying the size of ``Array`` to return.
148148

149-
.. function:: read!(stream, array::Array)
149+
.. function:: read!(stream or filename, array::Array)
150150

151151
.. Docstring generated from Julia source
152152
@@ -158,9 +158,9 @@ General I/O
158158
159159
Read at most ``nb`` bytes from the stream into ``b``\ , returning the number of bytes read (increasing the size of ``b`` as needed).
160160

161-
See ``readbytes`` for a description of the ``all`` option.
161+
See ``read`` for a description of the ``all`` option.
162162

163-
.. function:: readbytes(stream, nb=typemax(Int); all=true)
163+
.. function:: read(stream, nb=typemax(Int); all=true)
164164

165165
.. Docstring generated from Julia source
166166
@@ -330,7 +330,7 @@ General I/O
330330

331331
.. Docstring generated from Julia source
332332
333-
Read the entirety of ``x`` as a string but remove trailing newlines. Equivalent to ``chomp(readall(x))``\ .
333+
Read the entirety of ``x`` as a string but remove trailing newlines. Equivalent to ``chomp(readstring(x))``\ .
334334

335335
.. function:: truncate(file,n)
336336

@@ -493,41 +493,35 @@ Text I/O
493493
494494
Show all structure of a value, including all fields of objects.
495495

496-
.. function:: readall(stream::IO)
496+
.. function:: readstring(stream or filename)
497497

498498
.. Docstring generated from Julia source
499499
500-
Read the entire contents of an I/O stream as a string.
500+
Read the entire contents of an I/O stream or a file as a string.
501501

502-
.. function:: readall(filename::AbstractString)
502+
.. function:: readline(stream=STDIN or filename)
503503

504504
.. Docstring generated from Julia source
505505
506-
Open ``filename``\ , read the entire contents as a string, then close the file. Equivalent to ``open(readall, filename)``\ .
506+
Read a single line of text, including a trailing newline character (if one is reached before the end of the input), from the given stream or file (defaults to ``STDIN``\ ),
507507

508-
.. function:: readline(stream=STDIN)
509-
510-
.. Docstring generated from Julia source
511-
512-
Read a single line of text, including a trailing newline character (if one is reached before the end of the input), from the given ``stream`` (defaults to ``STDIN``\ ),
513-
514-
.. function:: readuntil(stream, delim)
508+
.. function:: readuntil(stream or filename, delim)
515509

516510
.. Docstring generated from Julia source
517511
518512
Read a string, up to and including the given delimiter byte.
519513

520-
.. function:: readlines(stream)
514+
.. function:: readlines(stream or filename)
521515

522516
.. Docstring generated from Julia source
523517
524518
Read all lines as an array.
525519

526-
.. function:: eachline(stream)
520+
.. function:: eachline(stream or filename)
527521

528522
.. Docstring generated from Julia source
529523
530-
Create an iterable object that will yield each line from a stream.
524+
Create an iterable object that will yield each line.
531525

532526
.. function:: readdlm(source, delim::Char, T::Type, eol::Char; header=false, skipstart=0, skipblanks=true, use_mmap, ignore_invalid_chars=false, quotes=true, dims, comments=true, comment_char='#')
533527

0 commit comments

Comments
 (0)