Skip to content

Commit

Permalink
Merge pull request JuliaLang#16585 from tkelman/tk/docfixes
Browse files Browse the repository at this point in the history
Fix some documentation and deprecation issues
  • Loading branch information
JeffBezanson committed May 27, 2016
2 parents f6c1a14 + 60c269d commit f61ea53
Show file tree
Hide file tree
Showing 43 changed files with 111 additions and 278 deletions.
12 changes: 6 additions & 6 deletions base/LineEdit.jl
Original file line number Diff line number Diff line change
Expand Up @@ -909,7 +909,7 @@ function keymap{D<:Dict}(keymaps::Array{D})
end

const escape_defaults = merge!(
AnyDict([Char(i) => nothing for i=vcat(1:26, 28:31)]), # Ignore control characters by default
AnyDict(Char(i) => nothing for i=vcat(1:26, 28:31)), # Ignore control characters by default
AnyDict( # And ignore other escape sequences by default
"\e*" => nothing,
"\e[*" => nothing,
Expand Down Expand Up @@ -941,9 +941,9 @@ const escape_defaults = merge!(
"\eOF" => KeyAlias("\e[F"),
),
# set mode commands
AnyDict(["\e[$(c)h" => nothing for c in 1:20]),
AnyDict("\e[$(c)h" => nothing for c in 1:20),
# reset mode commands
AnyDict(["\e[$(c)l" => nothing for c in 1:20])
AnyDict("\e[$(c)l" => nothing for c in 1:20)
)

function write_response_buffer(s::PromptState, data)
Expand Down Expand Up @@ -1456,11 +1456,11 @@ const prefix_history_keymap = merge!(
"\e[200~" => "*"
),
# VT220 editing commands
AnyDict(["\e[$(n)~" => "*" for n in 1:8]),
AnyDict("\e[$(n)~" => "*" for n in 1:8),
# set mode commands
AnyDict(["\e[$(c)h" => "*" for c in 1:20]),
AnyDict("\e[$(c)h" => "*" for c in 1:20),
# reset mode commands
AnyDict(["\e[$(c)l" => "*" for c in 1:20])
AnyDict("\e[$(c)l" => "*" for c in 1:20)
)

function setup_prefix_keymap(hp, parent_prompt)
Expand Down
2 changes: 2 additions & 0 deletions base/deprecated.jl
Original file line number Diff line number Diff line change
Expand Up @@ -884,6 +884,8 @@ function rem1{T<:Real}(x::T, y::T)
depwarn("`rem1(x,y)` is discontinued, as it cannot be defined consistently for `x==0`. Rewrite the expression using `mod1` instead.", :rem1)
rem(x-1,y)+1
end
rem1(x::Real, y::Real) = rem1(promote(x,y)...)
export rem1

# Filesystem module updates

Expand Down
62 changes: 6 additions & 56 deletions base/docs/helpdb/Base.jl
Original file line number Diff line number Diff line change
Expand Up @@ -2886,7 +2886,7 @@ showcompact
isleaftype(T)
Determine whether `T` is a concrete type that can have instances, meaning its only subtypes
are itself and `None` (but `T` itself is not `None`).
are itself and `Union{}` (but `T` itself is not `Union{}`).
"""
isleaftype

Expand Down Expand Up @@ -3279,7 +3279,7 @@ Redirect I/O to or from the given `command`. Keyword arguments specify which of
command's streams should be redirected. `append` controls whether file output appends to the
file. This is a more general version of the 2-argument `pipeline` function.
`pipeline(from, to)` is equivalent to `pipeline(from, stdout=to)` when `from` is a command,
and to `pipe(to, stdin=from)` when `from` is another kind of data source.
and to `pipeline(to, stdin=from)` when `from` is another kind of data source.
**Examples**:
Expand Down Expand Up @@ -3329,14 +3329,6 @@ The lowest value representable by the given (real) numeric DataType `T`.
"""
typemin

"""
call(x, args...)
If `x` is not a `Function`, then `x(args...)` is equivalent to `call(x, args...)`. This
means that function-like behavior can be added to any type by defining new `call` methods.
"""
call

"""
countfrom(start=1, step=1)
Expand Down Expand Up @@ -3960,7 +3952,7 @@ colon
Base64EncodePipe(ostream)
Returns a new write-only I/O stream, which converts any bytes written to it into
base64-encoded ASCII bytes written to `ostream`. Calling `close` on the `Base64Pipe` stream
base64-encoded ASCII bytes written to `ostream`. Calling `close` on the `Base64EncodePipe` stream
is necessary to complete the encoding (but does not close `ostream`).
"""
Base64EncodePipe
Expand Down Expand Up @@ -4954,13 +4946,6 @@ The distance between `x` and the next larger representable floating-point value
"""
eps(::AbstractFloat)

"""
rem1(x, y)
(Deprecated.) Remainder after division, returning in the range `(0, y]`.
"""
rem1

"""
isalpha(c::Union{Char,AbstractString}) -> Bool
Expand Down Expand Up @@ -6317,13 +6302,6 @@ Compute sine of `x`, where `x` is in degrees.
"""
sind

"""
iseltype(A,T)
Tests whether `A` or its elements are of type `T`.
"""
iseltype

"""
min(x, y, ...)
Expand Down Expand Up @@ -7259,13 +7237,6 @@ lexicographically comparable types, and `lexless` will call `lexcmp` by default.
"""
lexcmp

"""
inf(f)
Returns positive infinity of the floating point type `f` or of the same floating point type as `f`.
"""
inf

"""
isupper(c::Union{Char,AbstractString}) -> Bool
Expand Down Expand Up @@ -7631,13 +7602,6 @@ julia> "Hello " * "world"
"""
Base.:(*)(s::AbstractString, t::AbstractString)

"""
complement!(s)
Mutates [`IntSet`](:obj:`IntSet`) `s` into its set-complement.
"""
complement!

"""
slice(A, inds...)
Expand Down Expand Up @@ -7933,13 +7897,6 @@ Cumulative product of `A` along a dimension, storing the result in `B`. The dime
"""
cumprod!

"""
complement(s)
Returns the set-complement of [`IntSet`](:obj:`IntSet`) `s`.
"""
complement

"""
rethrow([e])
Expand Down Expand Up @@ -8548,8 +8505,8 @@ cos
base64encode(args...)
Given a `write`-like function `writefunc`, which takes an I/O stream as its first argument,
`base64(writefunc, args...)` calls `writefunc` to write `args...` to a base64-encoded
string, and returns the string. `base64(args...)` is equivalent to `base64(write, args...)`:
`base64encode(writefunc, args...)` calls `writefunc` to write `args...` to a base64-encoded
string, and returns the string. `base64encode(args...)` is equivalent to `base64encode(write, args...)`:
it converts its arguments into bytes using the standard `write` functions and returns the
base64-encoded string.
"""
Expand Down Expand Up @@ -9478,7 +9435,7 @@ Matrix trace.
trace

"""
runtests([tests=["all"] [, numcores=iceil(Sys.CPU_CORES / 2) ]])
runtests([tests=["all"] [, numcores=ceil(Integer, Sys.CPU_CORES / 2) ]])
Run the Julia unit tests listed in `tests`, which can be either a string or an array of
strings, using `numcores` processors. (not exported)
Expand Down Expand Up @@ -9587,13 +9544,6 @@ Unicode string.)
"""
reverseind

"""
nan(f)
Returns NaN (not-a-number) of the floating point type `f` or of the same floating point type as `f`
"""
nan

"""
float(x)
Expand Down
2 changes: 0 additions & 2 deletions base/exports.jl
Original file line number Diff line number Diff line change
Expand Up @@ -418,7 +418,6 @@ export
reim,
reinterpret,
rem,
rem1,
round,
sec,
secd,
Expand Down Expand Up @@ -1270,7 +1269,6 @@ export
isblockdev,
ischardev,
isdir,
isexecutable,
isfifo,
isfile,
islink,
Expand Down
10 changes: 5 additions & 5 deletions base/gmp.jl
Original file line number Diff line number Diff line change
Expand Up @@ -201,24 +201,24 @@ function convert{T<:Signed}(::Type{T}, x::BigInt)
end


function call(::Type{Float64}, n::BigInt, ::RoundingMode{:ToZero})
function (::Type{Float64})(n::BigInt, ::RoundingMode{:ToZero})
ccall((:__gmpz_get_d, :libgmp), Float64, (Ptr{BigInt},), &n)
end

function call{T<:Union{Float16,Float32}}(::Type{T}, n::BigInt, ::RoundingMode{:ToZero})
function (::Type{T}){T<:Union{Float16,Float32}}(n::BigInt, ::RoundingMode{:ToZero})
T(Float64(n,RoundToZero),RoundToZero)
end

function call{T<:CdoubleMax}(::Type{T}, n::BigInt, ::RoundingMode{:Down})
function (::Type{T}){T<:CdoubleMax}(n::BigInt, ::RoundingMode{:Down})
x = T(n,RoundToZero)
x > n ? prevfloat(x) : x
end
function call{T<:CdoubleMax}(::Type{T}, n::BigInt, ::RoundingMode{:Up})
function (::Type{T}){T<:CdoubleMax}(n::BigInt, ::RoundingMode{:Up})
x = T(n,RoundToZero)
x < n ? nextfloat(x) : x
end

function call{T<:CdoubleMax}(::Type{T}, n::BigInt, ::RoundingMode{:Nearest})
function (::Type{T}){T<:CdoubleMax}(n::BigInt, ::RoundingMode{:Nearest})
x = T(n,RoundToZero)
if maxintfloat(T) <= abs(x) < T(Inf)
r = n-BigInt(x)
Expand Down
29 changes: 15 additions & 14 deletions base/libgit2/callbacks.jl
Original file line number Diff line number Diff line change
Expand Up @@ -27,27 +27,28 @@ end
"""Credentials callback function
Function provides different credential acquisition functionality w.r.t. a connection protocol.
If payload is provided then `payload_ptr` should contain `LibGit2.AbstractCredentials` object.
If a payload is provided then `payload_ptr` should contain a `LibGit2.AbstractCredentials` object.
For `LibGit2.Consts.CREDTYPE_USERPASS_PLAINTEXT` type, if payload contains fields:
For `LibGit2.Consts.CREDTYPE_USERPASS_PLAINTEXT` type, if the payload contains fields:
`user` & `pass`, they are used to create authentication credentials.
Empty `user` name and `pass`word trigger authentication error.
Empty `user` name and `pass`word trigger an authentication error.
For `LibGit2.Consts.CREDTYPE_SSH_KEY` type, if payload contains fields:
For `LibGit2.Consts.CREDTYPE_SSH_KEY` type, if the payload contains fields:
`user`, `prvkey`, `pubkey` & `pass`, they are used to create authentication credentials.
Empty `user` name triggers authentication error.
Empty `user` name triggers an authentication error.
Order of credential checks (if supported):
- ssh key pair (ssh-agent if specified in payload's `usesshagent` field)
Credentials are checked in the following order (if supported):
- ssh key pair (`ssh-agent` if specified in payload's `usesshagent` field)
- plain text
**Note**: Due to the specifics of `libgit2` authentication procedure, when authentication fails,
this function is called again without any indication whether authentication was successful or not.
To avoid an infinite loop from repeatedly using the same faulty credentials,
`checkused!` function can be called to test if credentials were used if call returns `true` value.
Used credentials trigger user prompt for (re)entering required information.
`UserPasswordCredentials` and `CachedCredentials` are implemented using a call counting strategy
that prevents repeated usage of faulty credentials.
**Note**: Due to the specifics of the `libgit2` authentication procedure, when
authentication fails, this function is called again without any indication whether
authentication was successful or not. To avoid an infinite loop from repeatedly
using the same faulty credentials, the `checkused!` function can be called. This
function returns `true` if the credentials were used.
Using credentials triggers a user prompt for (re)entering required information.
`UserPasswordCredentials` and `CachedCredentials` are implemented using a call
counting strategy that prevents repeated usage of faulty credentials.
"""
function credentials_callback(cred::Ptr{Ptr{Void}}, url_ptr::Cstring,
username_ptr::Cstring,
Expand Down
10 changes: 6 additions & 4 deletions base/libgit2/types.jl
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ function Base.getindex(p::AbstractCredentials, keys...)
end
return nothing
end
"Sets credentials with `key` parameter with value"
"Sets credentials with `key` parameter to a value"
function Base.setindex!(p::AbstractCredentials, val, keys...)
for k in keys
ks = Symbol(k)
Expand All @@ -73,7 +73,7 @@ function Base.setindex!(p::AbstractCredentials, val, keys...)
end
"Checks if credentials were used"
checkused!(p::AbstractCredentials) = true
"Resets credentials for another usage"
"Resets credentials for another use"
reset!(p::AbstractCredentials, cnt::Int=3) = nothing

immutable CheckoutOptions
Expand Down Expand Up @@ -745,7 +745,8 @@ type CachedCredentials <: AbstractCredentials
count::Int # authentication failure protection count
CachedCredentials() = new(Dict{AbstractString,SSHCredentials}(),3)
end
"Returns specific credential parameter value: first index is a credential parameter name, second index is a host name (with schema)"
"Returns specific credential parameter value: first index is a credential
parameter name, second index is a host name (with schema)"
function Base.getindex(p::CachedCredentials, keys...)
length(keys) != 2 && return nothing
key, host = keys
Expand All @@ -758,7 +759,8 @@ function Base.getindex(p::CachedCredentials, keys...)
end
return nothing
end
"Sets specific credential parameter value: first index is a credential parameter name, second index is a host name (with schema)"
"Sets specific credential parameter value: first index is a credential
parameter name, second index is a host name (with schema)"
function Base.setindex!(p::CachedCredentials, val, keys...)
length(keys) != 2 && return nothing
key, host = keys
Expand Down
8 changes: 4 additions & 4 deletions base/mpfr.jl
Original file line number Diff line number Diff line change
Expand Up @@ -177,13 +177,13 @@ convert(::Type{Float32}, x::BigFloat) =
# TODO: avoid double rounding
convert(::Type{Float16}, x::BigFloat) = convert(Float16, convert(Float32, x))

call(::Type{Float64}, x::BigFloat, r::RoundingMode) =
(::Type{Float64})(x::BigFloat, r::RoundingMode) =
ccall((:mpfr_get_d,:libmpfr), Float64, (Ptr{BigFloat},Int32), &x, to_mpfr(r))
call(::Type{Float32}, x::BigFloat, r::RoundingMode) =
(::Type{Float32})(x::BigFloat, r::RoundingMode) =
ccall((:mpfr_get_flt,:libmpfr), Float32, (Ptr{BigFloat},Int32), &x, to_mpfr(r))
# TODO: avoid double rounding
call(::Type{Float16}, x::BigFloat, r::RoundingMode) =
convert(Float16, call(Float32, x, r))
(::Type{Float16})(x::BigFloat, r::RoundingMode) =
convert(Float16, Float32(x, r))

promote_rule{T<:Real}(::Type{BigFloat}, ::Type{T}) = BigFloat
promote_rule{T<:AbstractFloat}(::Type{BigInt},::Type{T}) = BigFloat
Expand Down
2 changes: 1 addition & 1 deletion base/pkg/resolve.jl
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ function sanity_check(deps::Dict{String,Dict{VersionNumber,Available}},

nv = length(vers)

svdict = (Tuple{String,VersionNumber}=>Int)[ vers[i][1:2]=>i for i = 1:nv ]
svdict = Dict{Tuple{String,VersionNumber},Int}(vers[i][1:2]=>i for i = 1:nv)

checked = falses(nv)

Expand Down
2 changes: 1 addition & 1 deletion base/pkg/resolve/interface.jl
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ type Interface
np = length(pkgs)

# generate pdict
pdict = (String=>Int)[ pkgs[i] => i for i = 1:np ]
pdict = Dict{String,Int}(pkgs[i] => i for i = 1:np)

# generate spp and pvers
spp = Array{Int}(np)
Expand Down
1 change: 0 additions & 1 deletion base/promotion.jl
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,6 @@ rem(x::Real, y::Real) = rem(promote(x,y)...)
mod(x::Real, y::Real) = mod(promote(x,y)...)

mod1(x::Real, y::Real) = mod1(promote(x,y)...)
rem1(x::Real, y::Real) = rem1(promote(x,y)...)
fld1(x::Real, y::Real) = fld1(promote(x,y)...)

max(x::Real, y::Real) = max(promote(x,y)...)
Expand Down
2 changes: 1 addition & 1 deletion base/rounding.jl
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ end
# Assumes conversion is performed by rounding to nearest value.

# To avoid ambiguous dispatch with methods in mpfr.jl:
call{T<:AbstractFloat}(::Type{T},x::Real,r::RoundingMode) = _convert_rounding(T,x,r)
(::Type{T}){T<:AbstractFloat}(x::Real,r::RoundingMode) = _convert_rounding(T,x,r)

_convert_rounding{T<:AbstractFloat}(::Type{T},x::Real,r::RoundingMode{:Nearest}) = convert(T,x)
function _convert_rounding{T<:AbstractFloat}(::Type{T},x::Real,r::RoundingMode{:Down})
Expand Down
2 changes: 1 addition & 1 deletion base/strings/types.jl
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# This file is a part of Julia. License is MIT: https://julialang.org/license

# SubString, RevString, RepString, and RopeString types
# SubString, RevString, and RepString types

## substrings reference original strings ##

Expand Down
2 changes: 1 addition & 1 deletion base/sysinfo.jl
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ end
windows_version()
Returns the version number for the Windows NT Kernel as a (major, minor) pair,
or (0, 0) if this is not running on Windows.
or `(0, 0)` if this is not running on Windows.
"""
windows_version

Expand Down
2 changes: 1 addition & 1 deletion base/unicode/utf8proc.jl
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ export isgraphemebreak
# also exported by Base:
export normalize_string, graphemes, is_assigned_char, charwidth, isvalid,
islower, isupper, isalpha, isdigit, isnumber, isalnum,
iscntrl, ispunct, isspace, isprint, isgraph, isblank
iscntrl, ispunct, isspace, isprint, isgraph

# whether codepoints are valid Unicode scalar values, i.e. 0-0xd7ff, 0xe000-0x10ffff
isvalid(::Type{Char}, ch::Unsigned) = !((ch - 0xd800 < 0x800) | (ch > 0x10ffff))
Expand Down
Loading

0 comments on commit f61ea53

Please sign in to comment.