Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix #17070, move docs out of HelpDB too. #17763

Merged
merged 2 commits into from
Aug 4, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 0 additions & 12 deletions base/docs/helpdb/Base.jl
Original file line number Diff line number Diff line change
Expand Up @@ -8761,18 +8761,6 @@ Letter: Lowercase.
"""
islower

"""
read(stream::IO, nb=typemax(Int); all=true)

Read at most `nb` bytes from `stream`, returning a `Vector{UInt8}` of the bytes read.

If `all` is `true` (the default), this function will block repeatedly trying to read all
requested bytes, until an error or end-of-file occurs. If `all` is `false`, at most one
`read` call is performed, and the amount of data returned is device-dependent. Note that not
all stream types support the `all` option.
"""
read

"""
eig(A,[irange,][vl,][vu,][permute=true,][scale=true]) -> D, V

Expand Down
6 changes: 5 additions & 1 deletion base/io.jl
Original file line number Diff line number Diff line change
Expand Up @@ -342,7 +342,11 @@ function readbytes!(s::IO, b::AbstractArray{UInt8}, nb=length(b))
return nr
end

# read up to nb bytes from s, returning a Vector{UInt8} of bytes read.
"""
read(s::IO, nb=typemax(Int))

Read at most `nb` bytes from `s`, returning a `Vector{UInt8}` of the bytes read.
"""
function read(s::IO, nb=typemax(Int))
# Let readbytes! grow the array progressively by default
# instead of taking of risk of over-allocating
Expand Down
10 changes: 10 additions & 0 deletions base/iostream.jl
Original file line number Diff line number Diff line change
Expand Up @@ -246,6 +246,16 @@ function read(s::IOStream)
resize!(b, nr)
end

"""
read(s::IOStream, nb::Integer; all=true)

Read at most `nb` bytes from `s`, returning a `Vector{UInt8}` of the bytes read.

If `all` is `true` (the default), this function will block repeatedly trying to read all
requested bytes, until an error or end-of-file occurs. If `all` is `false`, at most one
`read` call is performed, and the amount of data returned is device-dependent. Note that not
all stream types support the `all` option.
Copy link
Contributor

@tkelman tkelman Aug 4, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

needs another make docs run no it doesn't i misread the diff below

"""
function read(s::IOStream, nb::Integer; all::Bool=true)
b = Array{UInt8}(nb)
nr = readbytes!(s, b, nb, all=all)
Expand Down
10 changes: 8 additions & 2 deletions doc/stdlib/io-network.rst
Original file line number Diff line number Diff line change
Expand Up @@ -168,11 +168,17 @@ General I/O

See ``read`` for a description of the ``all`` option.

.. function:: read(stream::IO, nb=typemax(Int); all=true)
.. function:: read(s::IO, nb=typemax(Int))

.. Docstring generated from Julia source

Read at most ``nb`` bytes from ``stream``\ , returning a ``Vector{UInt8}`` of the bytes read.
Read at most ``nb`` bytes from ``s``\ , returning a ``Vector{UInt8}`` of the bytes read.

.. function:: read(s::IOStream, nb::Integer; all=true)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

later in base/io.jl there is

# read up to nb bytes from s, returning a Vector{UInt8} of bytes read.
function read(s::IO, nb=typemax(Int))

that still has the default value of nb

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It doesn't have the all kwarg though. You can't do read(s; all=false), can you?

Copy link
Contributor

@tkelman tkelman Aug 3, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you can't, so maybe the signature with (s::IO, nb=typemax(Int)) default value but no kwarg should be a separate docstring?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree, will add.


.. Docstring generated from Julia source

Read at most ``nb`` bytes from ``s``\ , returning a ``Vector{UInt8}`` of the bytes read.

If ``all`` is ``true`` (the default), this function will block repeatedly trying to read all requested bytes, until an error or end-of-file occurs. If ``all`` is ``false``\ , at most one ``read`` call is performed, and the amount of data returned is device-dependent. Note that not all stream types support the ``all`` option.

Expand Down