diff --git a/Compiler/src/abstractlattice.jl b/Compiler/src/abstractlattice.jl index 7a9cff8918175..f1514c6c9eed6 100644 --- a/Compiler/src/abstractlattice.jl +++ b/Compiler/src/abstractlattice.jl @@ -153,7 +153,7 @@ function ⊑ end @nospecializeinfer ⊑(::JLTypeLattice, @nospecialize(a::Type), @nospecialize(b::Type)) = a <: b """ - ⊏(𝕃::AbstractLattice, a, b) -> Bool + ⊏(𝕃::AbstractLattice, a, b)::Bool The strict partial order over the type inference lattice. This is defined as the irreflexive kernel of `⊑`. @@ -161,7 +161,7 @@ This is defined as the irreflexive kernel of `⊑`. @nospecializeinfer ⊏(𝕃::AbstractLattice, @nospecialize(a), @nospecialize(b)) = ⊑(𝕃, a, b) && !⊑(𝕃, b, a) """ - ⋤(𝕃::AbstractLattice, a, b) -> Bool + ⋤(𝕃::AbstractLattice, a, b)::Bool This order could be used as a slightly more efficient version of the strict order `⊏`, where we can safely assume `a ⊑ b` holds. @@ -169,7 +169,7 @@ where we can safely assume `a ⊑ b` holds. @nospecializeinfer ⋤(𝕃::AbstractLattice, @nospecialize(a), @nospecialize(b)) = !⊑(𝕃, b, a) """ - is_lattice_equal(𝕃::AbstractLattice, a, b) -> Bool + is_lattice_equal(𝕃::AbstractLattice, a, b)::Bool Check if two lattice elements are partial order equivalent. This is basically `a ⊑ b && b ⊑ a` in the lattice of `𝕃` @@ -181,7 +181,7 @@ but (optionally) with extra performance optimizations. end """ - has_nontrivial_extended_info(𝕃::AbstractLattice, t) -> Bool + has_nontrivial_extended_info(𝕃::AbstractLattice, t)::Bool Determines whether the given lattice element `t` of `𝕃` has non-trivial extended lattice information that would not be available from the type itself. @@ -204,7 +204,7 @@ end @nospecializeinfer has_nontrivial_extended_info(::JLTypeLattice, @nospecialize(t)) = false """ - is_const_prop_profitable_arg(𝕃::AbstractLattice, t) -> Bool + is_const_prop_profitable_arg(𝕃::AbstractLattice, t)::Bool Determines whether the given lattice element `t` of `𝕃` has new extended lattice information that should be forwarded along with constant propagation. diff --git a/Compiler/src/ssair/domtree.jl b/Compiler/src/ssair/domtree.jl index f6a30cdee4f17..38a07da5fb075 100644 --- a/Compiler/src/ssair/domtree.jl +++ b/Compiler/src/ssair/domtree.jl @@ -595,7 +595,7 @@ function rename_nodes!(D::DFSTree, rename_bb::Vector{BBNumber}) end """ - dominates(domtree::DomTree, bb1::Int, bb2::Int) -> Bool + dominates(domtree::DomTree, bb1::Int, bb2::Int)::Bool Checks if `bb1` dominates `bb2`. `bb1` and `bb2` are indexes into the `CFG` blocks. @@ -606,7 +606,7 @@ dominates(domtree::DomTree, bb1::BBNumber, bb2::BBNumber) = _dominates(domtree, bb1, bb2) """ - postdominates(domtree::PostDomTree, bb1::Int, bb2::Int) -> Bool + postdominates(domtree::PostDomTree, bb1::Int, bb2::Int)::Bool Checks if `bb1` post-dominates `bb2`. `bb1` and `bb2` are indexes into the `CFG` blocks. diff --git a/Compiler/src/tfuncs.jl b/Compiler/src/tfuncs.jl index f0c793a4ae3b7..3a5ba998b78c0 100644 --- a/Compiler/src/tfuncs.jl +++ b/Compiler/src/tfuncs.jl @@ -2517,7 +2517,7 @@ function getfield_effects(𝕃::AbstractLattice, argtypes::Vector{Any}, @nospeci end """ - builtin_effects(𝕃::AbstractLattice, f::Builtin, argtypes::Vector{Any}, rt) -> Effects + builtin_effects(𝕃::AbstractLattice, f::Builtin, argtypes::Vector{Any}, rt)::Effects Compute the effects of a builtin function call. `argtypes` should not include `f` itself. """ @@ -2660,7 +2660,7 @@ current_scope_tfunc(interp::AbstractInterpreter, sv) = Any hasvarargtype(argtypes::Vector{Any}) = !isempty(argtypes) && isvarargtype(argtypes[end]) """ - builtin_nothrow(𝕃::AbstractLattice, f::Builtin, argtypes::Vector{Any}, rt) -> Bool + builtin_nothrow(𝕃::AbstractLattice, f::Builtin, argtypes::Vector{Any}, rt)::Bool Compute throw-ness of a builtin function call. `argtypes` should not include `f` itself. """ diff --git a/Compiler/src/types.jl b/Compiler/src/types.jl index 6ffb5402682f3..050ae9abcc1df 100644 --- a/Compiler/src/types.jl +++ b/Compiler/src/types.jl @@ -421,7 +421,7 @@ may_compress(::AbstractInterpreter) = true may_discard_trees(::AbstractInterpreter) = true """ - method_table(interp::AbstractInterpreter) -> MethodTableView + method_table(interp::AbstractInterpreter)::MethodTableView Returns a method table this `interp` uses for method lookup. External `AbstractInterpreter` can optionally return `OverlayMethodTable` here @@ -486,7 +486,7 @@ add_edges_impl(::Vector{Any}, ::CallInfo) = error(""" All `CallInfo` is required to implement `add_edges_impl(::Vector{Any}, ::CallInfo)`""") nsplit_impl(::CallInfo) = nothing getsplit_impl(::CallInfo, ::Int) = error(""" - A `info::CallInfo` that implements `nsplit_impl(info::CallInfo) -> Int` must implement `getsplit_impl(info::CallInfo, idx::Int) -> MethodLookupResult` + A `info::CallInfo` that implements `nsplit_impl(info::CallInfo)::Int` must implement `getsplit_impl(info::CallInfo, idx::Int)::MethodLookupResult` in order to correctly opt in to inlining""") getresult_impl(::CallInfo, ::Int) = nothing diff --git a/Compiler/src/typeutils.jl b/Compiler/src/typeutils.jl index 4af8fed0e40c3..e6dc9c1c93017 100644 --- a/Compiler/src/typeutils.jl +++ b/Compiler/src/typeutils.jl @@ -24,7 +24,7 @@ function hasuniquerep(@nospecialize t) end """ - isTypeDataType(@nospecialize t) -> Bool + isTypeDataType(@nospecialize t)::Bool For a type `t` test whether ∀S s.t. `isa(S, rewrap_unionall(Type{t}, ...))`, we have `isa(S, DataType)`. In particular, if a statement is typed as `Type{t}` @@ -335,7 +335,7 @@ end const unwraptv = unwraptv_ub """ - is_identity_free_argtype(argtype) -> Bool + is_identity_free_argtype(argtype)::Bool Return `true` if the `argtype` object is identity free in the sense that this type or any reachable through its fields has non-content-based identity (see `Base.isidentityfree`). @@ -348,7 +348,7 @@ is_identity_free_argtype(@nospecialize ty) = is_identity_free_type(widenconst(ig is_identity_free_type(@nospecialize ty) = isidentityfree(ty) """ - is_immutable_argtype(argtype) -> Bool + is_immutable_argtype(argtype)::Bool Return `true` if the `argtype` object is known to be immutable. This query is specifically designed for `getfield_effects` and `isdefined_effects`, allowing @@ -366,7 +366,7 @@ function _is_immutable_type(@nospecialize ty) end """ - is_mutation_free_argtype(argtype) -> Bool + is_mutation_free_argtype(argtype)::Bool Return `true` if `argtype` object is mutation free in the sense that no mutable memory is reachable from this type (either in the type itself) or through any fields diff --git a/Compiler/src/utilities.jl b/Compiler/src/utilities.jl index c322d1062cea1..d49d56f85c32b 100644 --- a/Compiler/src/utilities.jl +++ b/Compiler/src/utilities.jl @@ -155,14 +155,14 @@ isa_compileable_sig(m::ABIOverride) = false has_typevar(@nospecialize(t), v::TypeVar) = ccall(:jl_has_typevar, Cint, (Any, Any), t, v) != 0 """ - is_declared_inline(method::Method) -> Bool + is_declared_inline(method::Method)::Bool Check if `method` is declared as `@inline`. """ is_declared_inline(method::Method) = _is_declared_inline(method, true) """ - is_declared_noinline(method::Method) -> Bool + is_declared_noinline(method::Method)::Bool Check if `method` is declared as `@noinline`. """ @@ -176,14 +176,14 @@ function _is_declared_inline(method::Method, inline::Bool) end """ - is_aggressive_constprop(method::Union{Method,CodeInfo}) -> Bool + is_aggressive_constprop(method::Union{Method,CodeInfo})::Bool Check if `method` is declared as `Base.@constprop :aggressive`. """ is_aggressive_constprop(method::Union{Method,CodeInfo}) = method.constprop == 0x01 """ - is_no_constprop(method::Union{Method,CodeInfo}) -> Bool + is_no_constprop(method::Union{Method,CodeInfo})::Bool Check if `method` is declared as `Base.@constprop :none`. """ diff --git a/base/Base_compiler.jl b/base/Base_compiler.jl index db3ebb0232e38..7b04a3b5f46de 100644 --- a/base/Base_compiler.jl +++ b/base/Base_compiler.jl @@ -156,7 +156,7 @@ if false end """ - time_ns() -> UInt64 + time_ns()::UInt64 Get the time in nanoseconds relative to some arbitrary time in the past. The primary use is for measuring the elapsed time between two moments in time. diff --git a/base/abstractarray.jl b/base/abstractarray.jl index a370b79976ab0..cc3560cccacea 100644 --- a/base/abstractarray.jl +++ b/base/abstractarray.jl @@ -257,7 +257,7 @@ julia> Base.elsize(rand(Float32, 10)) elsize(A::AbstractArray) = elsize(typeof(A)) """ - ndims(A::AbstractArray) -> Integer + ndims(A::AbstractArray)::Integer Return the number of dimensions of `A`. @@ -276,7 +276,7 @@ ndims(::Type{<:AbstractArray{<:Any,N}}) where {N} = N::Int ndims(::Type{Union{}}, slurp...) = throw(ArgumentError("Union{} does not have elements")) """ - length(collection) -> Integer + length(collection)::Integer Return the number of elements in the collection. @@ -404,8 +404,8 @@ _all_match_first(f::F, inds) where F<:Function = true keys(s::IndexStyle, A::AbstractArray, B::AbstractArray...) = eachindex(s, A, B...) """ - lastindex(collection) -> Integer - lastindex(collection, d) -> Integer + lastindex(collection)::Integer + lastindex(collection, d)::Integer Return the last index of `collection`. If `d` is given, return the last index of `collection` along dimension `d`. @@ -427,8 +427,8 @@ lastindex(a::AbstractArray) = (@inline; last(eachindex(IndexLinear(), a))) lastindex(a, d) = (@inline; last(axes(a, d))) """ - firstindex(collection) -> Integer - firstindex(collection, d) -> Integer + firstindex(collection)::Integer + firstindex(collection, d)::Integer Return the first index of `collection`. If `d` is given, return the first index of `collection` along dimension `d`. @@ -3196,7 +3196,7 @@ end ## iteration utilities ## """ - foreach(f, c...) -> Nothing + foreach(f, c...) -> nothing Call function `f` on each element of iterable `c`. For multiple iterable arguments, `f` is called elementwise, and iteration stops when diff --git a/base/abstractarraymath.jl b/base/abstractarraymath.jl index 54b6d75cee2dc..66c75cf977c56 100644 --- a/base/abstractarraymath.jl +++ b/base/abstractarraymath.jl @@ -9,7 +9,7 @@ isreal(x::AbstractArray{<:Real}) = true ## Constructors ## """ - vec(a::AbstractArray) -> AbstractVector + vec(a::AbstractArray)::AbstractVector Reshape the array `a` as a one-dimensional column vector. Return `a` if it is already an `AbstractVector`. The resulting array diff --git a/base/abstractset.jl b/base/abstractset.jl index b38cb2799740b..3bb1041e22ee9 100644 --- a/base/abstractset.jl +++ b/base/abstractset.jl @@ -302,9 +302,9 @@ end const ⊆ = issubset function ⊇ end """ - issubset(a, b) -> Bool - ⊆(a, b) -> Bool - ⊇(b, a) -> Bool + issubset(a, b)::Bool + ⊆(a, b)::Bool + ⊇(b, a)::Bool Determine whether every element of `a` is also in `b`, using [`in`](@ref). @@ -394,8 +394,8 @@ used to implement specialized methods. function ⊊ end function ⊋ end """ - ⊊(a, b) -> Bool - ⊋(b, a) -> Bool + ⊊(a, b)::Bool + ⊋(b, a)::Bool Determines if `a` is a subset of, but not equal to, `b`. @@ -446,8 +446,8 @@ used to implement specialized methods. function ⊈ end function ⊉ end """ - ⊈(a, b) -> Bool - ⊉(b, a) -> Bool + ⊈(a, b)::Bool + ⊉(b, a)::Bool Negation of `⊆` and `⊇`, i.e. checks that `a` is not a subset of `b`. @@ -496,7 +496,7 @@ used to implement specialized methods. ## set equality comparison """ - issetequal(a, b) -> Bool + issetequal(a, b)::Bool Determine whether `a` and `b` have the same elements. Equivalent to `a ⊆ b && b ⊆ a` but more efficient when possible. @@ -544,7 +544,7 @@ issetequal(a) = Fix2(issetequal, a) ## set disjoint comparison """ - isdisjoint(a, b) -> Bool + isdisjoint(a, b)::Bool Determine whether the collections `a` and `b` are disjoint. Equivalent to `isempty(a ∩ b)` but more efficient when possible. diff --git a/base/anyall.jl b/base/anyall.jl index e51515bb3187d..b7f53395a8d3b 100644 --- a/base/anyall.jl +++ b/base/anyall.jl @@ -3,7 +3,7 @@ ## all & any """ - any(itr) -> Bool + any(itr)::Bool Test whether any elements of a boolean collection are `true`, returning `true` as soon as the first `true` value in `itr` is encountered (short-circuiting). To @@ -41,7 +41,7 @@ missing any(itr) = any(identity, itr) """ - all(itr) -> Bool + all(itr)::Bool Test whether all elements of a boolean collection are `true`, returning `false` as soon as the first `false` value in `itr` is encountered (short-circuiting). To @@ -80,7 +80,7 @@ missing all(itr) = all(identity, itr) """ - any(p, itr) -> Bool + any(p, itr)::Bool Determine whether predicate `p` returns `true` for any elements of `itr`, returning `true` as soon as the first item in `itr` for which `p` returns `true` is encountered @@ -154,7 +154,7 @@ end @inline _any_tuple(f, anymissing) = anymissing ? missing : false """ - all(p, itr) -> Bool + all(p, itr)::Bool Determine whether predicate `p` returns `true` for all elements of `itr`, returning `false` as soon as the first item in `itr` for which `p` returns `false` is encountered diff --git a/base/array.jl b/base/array.jl index aafcfc182124b..ca5e778671dc3 100644 --- a/base/array.jl +++ b/base/array.jl @@ -1443,7 +1443,7 @@ function _prepend!(a::Vector, ::IteratorSize, iter) end """ - resize!(a::Vector, n::Integer) -> Vector + resize!(a::Vector, n::Integer) -> a Resize `a` to contain `n` elements. If `n` is smaller than the current collection length, the first `n` elements will be retained. If `n` is larger, the new elements are not diff --git a/base/bitarray.jl b/base/bitarray.jl index 93fa48c56e379..d95354db61ce7 100644 --- a/base/bitarray.jl +++ b/base/bitarray.jl @@ -1338,7 +1338,7 @@ function (>>>)(B::BitVector, i::UInt) end """ - >>(B::BitVector, n) -> BitVector + >>(B::BitVector, n)::BitVector Right bit shift operator, `B >> n`. For `n >= 0`, the result is `B` with elements shifted `n` positions forward, filling with `false` @@ -1376,7 +1376,7 @@ julia> B >> -1 # signed integer version of shift operators with handling of negative values """ - <<(B::BitVector, n) -> BitVector + <<(B::BitVector, n)::BitVector Left bit shift operator, `B << n`. For `n >= 0`, the result is `B` with elements shifted `n` positions backwards, filling with `false` @@ -1413,7 +1413,7 @@ julia> B << -1 (<<)(B::BitVector, i::Int) = (i >=0 ? B << unsigned(i) : B >> unsigned(-i)) """ - >>>(B::BitVector, n) -> BitVector + >>>(B::BitVector, n)::BitVector Unsigned right bitshift operator, `B >>> n`. Equivalent to `B >> n`. See [`>>`](@ref) for details and examples. diff --git a/base/broadcast.jl b/base/broadcast.jl index 512b397352040..2a16cd11c1d5c 100644 --- a/base/broadcast.jl +++ b/base/broadcast.jl @@ -374,7 +374,7 @@ cat_nested_args(t::Tuple) = (cat_nested(t[1])..., cat_nested_args(tail(t))...) cat_nested(a) = (a,) """ - make_makeargs(t::Tuple) -> Tuple{Vararg{Function}} + make_makeargs(t::Tuple)::Tuple{Vararg{Function}} Each element of `t` is one (consecutive) node in a broadcast tree. The returned `Tuple` are functions which take in the (whole) flattened @@ -414,7 +414,7 @@ prepare_args(::Tuple{}, ::Tuple) = () ## logic for deciding the BroadcastStyle """ - combine_styles(cs...) -> BroadcastStyle + combine_styles(cs...)::BroadcastStyle Decides which `BroadcastStyle` to use for any number of value arguments. Uses [`BroadcastStyle`](@ref) to get the style for each argument, and uses @@ -439,7 +439,7 @@ combine_styles(c1, c2) = result_style(combine_styles(c1), combine_styles(c2)) @inline combine_styles(c1, c2, cs...) = result_style(combine_styles(c1), combine_styles(c2, cs...)) """ - result_style(s1::BroadcastStyle[, s2::BroadcastStyle]) -> BroadcastStyle + result_style(s1::BroadcastStyle[, s2::BroadcastStyle])::BroadcastStyle Takes one or two `BroadcastStyle`s and combines them using [`BroadcastStyle`](@ref) to determine a common `BroadcastStyle`. @@ -488,7 +488,7 @@ end # Indices utilities """ - combine_axes(As...) -> Tuple + combine_axes(As...)::Tuple Determine the result axes for broadcasting across all values in `As`. @@ -505,7 +505,7 @@ julia> Broadcast.combine_axes(1, 1, 1) combine_axes(A) = axes(A) """ - broadcast_shape(As...) -> Tuple + broadcast_shape(As...)::Tuple Determine the result axes for broadcasting across all axes (size Tuples) in `As`. diff --git a/base/char.jl b/base/char.jl index 2e8410f6903e2..6caa5a26eaf34 100644 --- a/base/char.jl +++ b/base/char.jl @@ -52,7 +52,7 @@ Char (::Type{T})(x::T) where {T<:AbstractChar} = x """ - ncodeunits(c::Char) -> Int + ncodeunits(c::Char)::Int Return the number of code units required to encode a character as UTF-8. This is the number of bytes which will be printed if the character is written @@ -72,7 +72,7 @@ function ncodeunits(c::Char) end """ - codepoint(c::AbstractChar) -> Integer + codepoint(c::AbstractChar)::Integer Return the Unicode codepoint (an unsigned integer) corresponding to the character `c` (or throw an exception if `c` does not represent @@ -112,7 +112,7 @@ end # not to support malformed or overlong encodings. """ - ismalformed(c::AbstractChar) -> Bool + ismalformed(c::AbstractChar)::Bool Return `true` if `c` represents malformed (non-Unicode) data according to the encoding used by `c`. Defaults to `false` for non-`Char` types. @@ -122,7 +122,7 @@ See also [`show_invalid`](@ref). ismalformed(c::AbstractChar) = false """ - isoverlong(c::AbstractChar) -> Bool + isoverlong(c::AbstractChar)::Bool Return `true` if `c` represents an overlong UTF-8 sequence. Defaults to `false` for non-`Char` types. @@ -147,7 +147,7 @@ isoverlong(c::AbstractChar) = false end """ - decode_overlong(c::AbstractChar) -> Integer + decode_overlong(c::AbstractChar)::Integer When [`isoverlong(c)`](@ref) is `true`, `decode_overlong(c)` returns the Unicode codepoint value of `c`. `AbstractChar` implementations diff --git a/base/cmem.jl b/base/cmem.jl index dd4cbc30585f2..531fac434d097 100644 --- a/base/cmem.jl +++ b/base/cmem.jl @@ -1,7 +1,7 @@ # This file is a part of Julia. License is MIT: https://julialang.org/license """ - memcpy(dst::Ptr, src::Ptr, n::Integer) -> Ptr{Cvoid} + memcpy(dst::Ptr, src::Ptr, n::Integer)::Ptr{Cvoid} Call `memcpy` from the C standard library. @@ -15,7 +15,7 @@ function memcpy(dst::Ptr, src::Ptr, n::Integer) end """ - memmove(dst::Ptr, src::Ptr, n::Integer) -> Ptr{Cvoid} + memmove(dst::Ptr, src::Ptr, n::Integer)::Ptr{Cvoid} Call `memmove` from the C standard library. @@ -29,7 +29,7 @@ function memmove(dst::Ptr, src::Ptr, n::Integer) end """ - memset(dst::Ptr, val, n::Integer) -> Ptr{Cvoid} + memset(dst::Ptr, val, n::Integer)::Ptr{Cvoid} Call `memset` from the C standard library. @@ -43,7 +43,7 @@ function memset(p::Ptr, val, n::Integer) end """ - memcmp(a::Ptr, b::Ptr, n::Integer) -> Int + memcmp(a::Ptr, b::Ptr, n::Integer)::Int Call `memcmp` from the C standard library. diff --git a/base/combinatorics.jl b/base/combinatorics.jl index 3672a19e19998..dac217cd4fb41 100644 --- a/base/combinatorics.jl +++ b/base/combinatorics.jl @@ -60,7 +60,7 @@ end end """ - isperm(v) -> Bool + isperm(v)::Bool Return `true` if `v` is a valid permutation. diff --git a/base/complex.jl b/base/complex.jl index 095c842795d38..40334d2cdee3e 100644 --- a/base/complex.jl +++ b/base/complex.jl @@ -123,7 +123,7 @@ real(C::Type{<:Complex}) = fieldtype(C, 1) real(::Type{Union{}}, slurp...) = Union{}(im) """ - isreal(x) -> Bool + isreal(x)::Bool Test whether `x` or all its elements are numerically equal to some real number including infinities and NaNs. `isreal(x)` is true if `isequal(x, real(x))` diff --git a/base/dict.jl b/base/dict.jl index 4a63ed364b64d..8d64276551374 100644 --- a/base/dict.jl +++ b/base/dict.jl @@ -527,7 +527,7 @@ function get(default::Callable, h::Dict{K,V}, key) where V where K end """ - haskey(collection, key) -> Bool + haskey(collection, key)::Bool Determine whether a collection has a mapping for a given `key`. diff --git a/base/docs/basedocs.jl b/base/docs/basedocs.jl index 88ed34de02b64..30390ca1369a8 100644 --- a/base/docs/basedocs.jl +++ b/base/docs/basedocs.jl @@ -1905,7 +1905,7 @@ recurses infinitely. StackOverflowError """ - nfields(x) -> Int + nfields(x)::Int Get the number of fields in the given object. @@ -2007,7 +2007,7 @@ to let `InterruptException` be thrown by CTRL+C during the execution. InterruptException """ - applicable(f, args...) -> Bool + applicable(f, args...)::Bool Determine whether the given generic function has a method applicable to the given arguments. @@ -2105,7 +2105,7 @@ Integer invoke """ - isa(x, type) -> Bool + isa(x, type)::Bool Determine whether `x` is of the given `type`. Can also be used as an infix operator, e.g. `x isa type`. @@ -2398,7 +2398,7 @@ iteration over characters. Symbol """ - Symbol(x...) -> Symbol + Symbol(x...)::Symbol Create a [`Symbol`](@ref) by concatenating the string representations of the arguments together. @@ -2511,8 +2511,8 @@ Atomically perform the operations to simultaneously get and set a field: swapfield! """ - modifyfield!(value, name::Symbol, op, x, [order::Symbol]) -> Pair - modifyfield!(value, i::Int, op, x, [order::Symbol]) -> Pair + modifyfield!(value, name::Symbol, op, x, [order::Symbol])::Pair + modifyfield!(value, i::Int, op, x, [order::Symbol])::Pair Atomically perform the operations to get and set a field after applying the function `op`. @@ -2678,7 +2678,7 @@ See also [`swapproperty!`](@ref Base.swapproperty!) and [`setglobal!`](@ref). swapglobal! """ - modifyglobal!(module::Module, name::Symbol, op, x, [order::Symbol=:monotonic]) -> Pair + modifyglobal!(module::Module, name::Symbol, op, x, [order::Symbol=:monotonic])::Pair Atomically perform the operations to get and set a global after applying the function `op`. diff --git a/base/docs/intrinsicsdocs.jl b/base/docs/intrinsicsdocs.jl index c9538ea74ab26..3e7b982e85377 100644 --- a/base/docs/intrinsicsdocs.jl +++ b/base/docs/intrinsicsdocs.jl @@ -90,7 +90,7 @@ See also [`swapproperty!`](@ref Base.swapproperty!) and [`Core.memoryrefset!`](@ Core.memoryrefswap! """ - Core.memoryrefmodify!(::GenericMemoryRef, op, value, ordering::Symbol, boundscheck::Bool) -> Pair + Core.memoryrefmodify!(::GenericMemoryRef, op, value, ordering::Symbol, boundscheck::Bool)::Pair Atomically perform the operations to get and set a `MemoryRef` value after applying the function `op`. diff --git a/base/env.jl b/base/env.jl index 6248f1933d1ec..5472456e22885 100644 --- a/base/env.jl +++ b/base/env.jl @@ -74,7 +74,7 @@ end # os test ## ENV: hash interface ## """ - EnvDict() -> EnvDict + EnvDict()::EnvDict A singleton of this type provides a hash table interface to environment variables. """ diff --git a/base/essentials.jl b/base/essentials.jl index fa5cf79192f56..3d7b21dbaf196 100644 --- a/base/essentials.jl +++ b/base/essentials.jl @@ -147,7 +147,7 @@ macro specialize(vars...) end """ - @isdefined s -> Bool + @isdefined s::Bool Tests whether variable `s` is defined in the current scope. @@ -387,7 +387,7 @@ getindex(A::GenericMemory, i::Int) = (@_noub_if_noinbounds_meta; getindex(A::GenericMemoryRef) = memoryrefget(A, default_access_order(A), @_boundscheck) """ - nameof(m::Module) -> Symbol + nameof(m::Module)::Symbol Get the name of a `Module` as a [`Symbol`](@ref). @@ -961,7 +961,7 @@ getindex(v::SimpleVector, I::AbstractArray) = Core.svec(Any[ v[i] for i in I ].. unsafe_convert(::Type{Ptr{Any}}, sv::SimpleVector) = convert(Ptr{Any},pointer_from_objref(sv)) + sizeof(Ptr) """ - isassigned(array, i) -> Bool + isassigned(array, i)::Bool Test whether the given array has a value associated with index `i`. Return `false` if the index is out of bounds, or has an undefined reference. @@ -1102,7 +1102,7 @@ See [`Base.compilerbarrier`](@ref) for more info. inferencebarrier(@nospecialize(x)) = compilerbarrier(:type, x) """ - isempty(collection) -> Bool + isempty(collection)::Bool Determine whether a collection is empty (has no elements). @@ -1221,7 +1221,7 @@ end # Iteration """ - isdone(itr, [state]) -> Union{Bool, Missing} + isdone(itr, [state])::Union{Bool, Missing} This function provides a fast-path hint for iterator completion. This is useful for stateful iterators that want to avoid having elements @@ -1240,7 +1240,7 @@ See also [`iterate`](@ref), [`isempty`](@ref) isdone(itr, state...) = missing """ - iterate(iter [, state]) -> Union{Nothing, Tuple{Any, Any}} + iterate(iter [, state])::Union{Nothing, Tuple{Any, Any}} Advance the iterator to obtain the next element. If no elements remain, `nothing` should be returned. Otherwise, a 2-tuple of the @@ -1249,7 +1249,7 @@ next element and the new iteration state should be returned. function iterate end """ - isiterable(T) -> Bool + isiterable(T)::Bool Test if type `T` is an iterable collection type or not, that is whether it has an `iterate` method or not. diff --git a/base/experimental.jl b/base/experimental.jl index 17871b4f346d6..97247a3a463a7 100644 --- a/base/experimental.jl +++ b/base/experimental.jl @@ -526,7 +526,7 @@ function task_metrics(b::Bool) end """ - Base.Experimental.task_running_time_ns(t::Task) -> Union{UInt64, Nothing} + Base.Experimental.task_running_time_ns(t::Task)::Union{UInt64, Nothing} Return the total nanoseconds that the task `t` has spent running. This metric is only updated when `t` yields or completes unless `t` is the current task, in @@ -555,7 +555,7 @@ function task_running_time_ns(t::Task=current_task()) end """ - Base.Experimental.task_wall_time_ns(t::Task) -> Union{UInt64, Nothing} + Base.Experimental.task_wall_time_ns(t::Task)::Union{UInt64, Nothing} Return the total nanoseconds that the task `t` was runnable. This is the time since the task first entered the run queue until the time at which it diff --git a/base/file.jl b/base/file.jl index 66e8114aba4ba..7fbb08c4b6fe6 100644 --- a/base/file.jl +++ b/base/file.jl @@ -32,7 +32,7 @@ export # get and set current directory """ - pwd() -> String + pwd()::String Get the current working directory. @@ -758,7 +758,7 @@ end # os-test """ - tempname(parent=tempdir(); cleanup=true, suffix="") -> String + tempname(parent=tempdir(); cleanup=true, suffix="")::String Generate a temporary file path. This function only returns a path; no file is created. The path is likely to be unique, but this cannot be guaranteed due to @@ -921,7 +921,7 @@ end readdir(dir::AbstractString=pwd(); join::Bool = false, sort::Bool = true, - ) -> Vector{String} + )::Vector{String} Return the names in the directory `dir` or the current working directory if not given. When `join` is false, `readdir` returns just the names in the directory @@ -1043,7 +1043,7 @@ isblockdev(obj::DirEntry) = (isunknown(obj) || islink(obj)) ? isblockdev(obj.pat realpath(obj::DirEntry) = realpath(obj.path) """ - _readdirx(dir::AbstractString=pwd(); sort::Bool = true) -> Vector{DirEntry} + _readdirx(dir::AbstractString=pwd(); sort::Bool = true)::Vector{DirEntry} Return a vector of [`DirEntry`](@ref) objects representing the contents of the directory `dir`, or the current working directory if not given. If `sort` is true, the returned vector is @@ -1354,7 +1354,7 @@ function symlink(target::AbstractString, link::AbstractString; end """ - readlink(path::AbstractString) -> String + readlink(path::AbstractString)::String Return the target location a symbolic link `path` points to. """ diff --git a/base/float.jl b/base/float.jl index faded5cd5978c..6d1fc8573ee57 100644 --- a/base/float.jl +++ b/base/float.jl @@ -693,7 +693,7 @@ end abs(x::IEEEFloat) = abs_float(x) """ - isnan(f) -> Bool + isnan(f)::Bool Test whether a number value is a NaN, an indeterminate value which is neither an infinity nor a finite number ("not a number"). @@ -708,7 +708,7 @@ isfinite(x::Real) = decompose(x)[3] != 0 isfinite(x::Integer) = true """ - isinf(f) -> Bool + isinf(f)::Bool Test whether a number is infinite. @@ -1001,7 +1001,7 @@ for Ti in (Int8, Int16, Int32, Int64, Int128, UInt8, UInt16, UInt32, UInt64, UIn end """ - issubnormal(f) -> Bool + issubnormal(f)::Bool Test whether a floating point number is subnormal. diff --git a/base/generator.jl b/base/generator.jl index 1f981de8dc788..eb1465d7e1e11 100644 --- a/base/generator.jl +++ b/base/generator.jl @@ -66,7 +66,7 @@ struct HasShape{N} <: IteratorSize end struct IsInfinite <: IteratorSize end """ - IteratorSize(itertype::Type) -> IteratorSize + IteratorSize(itertype::Type)::IteratorSize Given the type of an iterator, return one of the following values: @@ -107,7 +107,7 @@ struct EltypeUnknown <: IteratorEltype end struct HasEltype <: IteratorEltype end """ - IteratorEltype(itertype::Type) -> IteratorEltype + IteratorEltype(itertype::Type)::IteratorEltype Given the type of an iterator, return one of the following values: diff --git a/base/hashing.jl b/base/hashing.jl index d4a6217de6edb..23e48d9ccf58e 100644 --- a/base/hashing.jl +++ b/base/hashing.jl @@ -3,7 +3,7 @@ ## hashing a single value ## """ - hash(x[, h::UInt]) -> UInt + hash(x[, h::UInt])::UInt Compute an integer hash code such that `isequal(x,y)` implies `hash(x)==hash(y)`. The optional second argument `h` is another hash code to be mixed with the result. diff --git a/base/initdefs.jl b/base/initdefs.jl index f7693813239c6..ef1b40796f1ad 100644 --- a/base/initdefs.jl +++ b/base/initdefs.jl @@ -33,7 +33,7 @@ const roottask = current_task() is_interactive::Bool = false """ - isinteractive() -> Bool + isinteractive()::Bool Determine whether Julia is running an interactive session. """ diff --git a/base/int.jl b/base/int.jl index 8a80f90f7e2c1..89c80666e7fe3 100644 --- a/base/int.jl +++ b/base/int.jl @@ -97,7 +97,7 @@ inv(x::Integer) = float(one(x)) / float(x) (/)(x::BitInteger, y::BitInteger) = float(x) / float(y) """ - isodd(x::Number) -> Bool + isodd(x::Number)::Bool Return `true` if `x` is an odd integer (that is, an integer not divisible by 2), and `false` otherwise. @@ -117,7 +117,7 @@ isodd(n::Number) = isreal(n) && isodd(real(n)) isodd(n::Real) = isinteger(n) && !iszero(rem(Integer(n), 2)) """ - iseven(x::Number) -> Bool + iseven(x::Number)::Bool Return `true` if `x` is an even integer (that is, an integer divisible by 2), and `false` otherwise. @@ -399,7 +399,7 @@ bswap(x::Union{Int16, UInt16, Int32, UInt32, Int64, UInt64, Int128, UInt128}) = bswap_int(x) """ - count_ones(x::Integer) -> Integer + count_ones(x::Integer)::Integer Number of ones in the binary representation of `x`. @@ -415,7 +415,7 @@ julia> count_ones(Int32(-1)) count_ones(x::BitInteger) = (ctpop_int(x) % Int)::Int """ - leading_zeros(x::Integer) -> Integer + leading_zeros(x::Integer)::Integer Number of zeros leading the binary representation of `x`. @@ -428,7 +428,7 @@ julia> leading_zeros(Int32(1)) leading_zeros(x::BitInteger) = (ctlz_int(x) % Int)::Int """ - trailing_zeros(x::Integer) -> Integer + trailing_zeros(x::Integer)::Integer Number of zeros trailing the binary representation of `x`. @@ -441,7 +441,7 @@ julia> trailing_zeros(2) trailing_zeros(x::BitInteger) = (cttz_int(x) % Int)::Int """ - count_zeros(x::Integer) -> Integer + count_zeros(x::Integer)::Integer Number of zeros in the binary representation of `x`. @@ -457,7 +457,7 @@ julia> count_zeros(-1) count_zeros(x::Integer) = count_ones(~x) """ - leading_ones(x::Integer) -> Integer + leading_ones(x::Integer)::Integer Number of ones leading the binary representation of `x`. @@ -470,7 +470,7 @@ julia> leading_ones(UInt32(2 ^ 32 - 2)) leading_ones(x::Integer) = leading_zeros(~x) """ - trailing_ones(x::Integer) -> Integer + trailing_ones(x::Integer)::Integer Number of ones trailing the binary representation of `x`. @@ -483,7 +483,7 @@ julia> trailing_ones(3) trailing_ones(x::Integer) = trailing_zeros(~x) """ - top_set_bit(x::Integer) -> Integer + top_set_bit(x::Integer)::Integer The number of bits in `x`'s binary representation, excluding leading zeros. @@ -589,9 +589,9 @@ bitrotate(x::T, k::Integer) where {T <: BitInteger} = for fname in (:mod, :rem) @eval @doc """ - rem(x::Integer, T::Type{<:Integer}) -> T - mod(x::Integer, T::Type{<:Integer}) -> T - %(x::Integer, T::Type{<:Integer}) -> T + rem(x::Integer, T::Type{<:Integer})::T + mod(x::Integer, T::Type{<:Integer})::T + %(x::Integer, T::Type{<:Integer})::T Find `y::T` such that `x` ≡ `y` (mod n), where n is the number of integers representable in `T`, and `y` is an integer in `[typemin(T),typemax(T)]`. diff --git a/base/intfuncs.jl b/base/intfuncs.jl index dc81f2bd3e489..f6fca0aa8b939 100644 --- a/base/intfuncs.jl +++ b/base/intfuncs.jl @@ -502,7 +502,7 @@ _prevpow2(x::Unsigned) = one(x) << unsigned(top_set_bit(x)-1) _prevpow2(x::Integer) = reinterpret(typeof(x),x < 0 ? -_prevpow2(unsigned(-x)) : _prevpow2(unsigned(x))) """ - ispow2(n::Number) -> Bool + ispow2(n::Number)::Bool Test whether `n` is an integer power of two. @@ -1059,7 +1059,7 @@ function digits(T::Type{<:Integer}, n::Integer; base::Integer = 10, pad::Integer end """ - hastypemax(T::Type) -> Bool + hastypemax(T::Type)::Bool Return `true` if and only if the extrema `typemax(T)` and `typemin(T)` are defined. """ diff --git a/base/io.jl b/base/io.jl index 46aec6ca393b7..2fb8ce0c95f06 100644 --- a/base/io.jl +++ b/base/io.jl @@ -39,7 +39,7 @@ const SZ_UNBUFFERED_IO = 65536 buffer_writes(x::IO, bufsize=SZ_UNBUFFERED_IO) = x """ - isopen(object) -> Bool + isopen(object)::Bool Determine whether an object - such as a stream or timer -- is not yet closed. Once an object is closed, it will never produce a new event. @@ -134,7 +134,7 @@ function readavailable end function isexecutable end """ - isreadable(io) -> Bool + isreadable(io)::Bool Return `false` if the specified IO object is not readable. @@ -157,7 +157,7 @@ julia> rm("myfile.txt") isreadable(io::IO) = isopen(io) """ - iswritable(io) -> Bool + iswritable(io)::Bool Return `false` if the specified IO object is not writable. @@ -180,7 +180,7 @@ julia> rm("myfile.txt") iswritable(io::IO) = isopen(io) """ - eof(stream) -> Bool + eof(stream)::Bool Test whether an I/O stream is at end-of-file. If the stream is not yet exhausted, this function will block to wait for more data if necessary, and then return `false`. Therefore @@ -351,7 +351,7 @@ peek(s) = peek(s, UInt8)::UInt8 # Generic `open` methods """ - open_flags(; keywords...) -> NamedTuple + open_flags(; keywords...)::NamedTuple Compute the `read`, `write`, `create`, `truncate`, `append` flag value for a given set of keyword arguments to [`open`](@ref) a [`NamedTuple`](@ref). @@ -768,7 +768,7 @@ htol(x) """ - isreadonly(io) -> Bool + isreadonly(io)::Bool Determine whether a stream is read-only. diff --git a/base/iobuffer.jl b/base/iobuffer.jl index 7e309b9ad586c..a532cb8d5e788 100644 --- a/base/iobuffer.jl +++ b/base/iobuffer.jl @@ -47,7 +47,7 @@ StringVector(n::Integer) = wrap(Array, StringMemory(n)) # IOBuffers behave like Files. They are typically readable and writable. They are seekable. (They can be appendable). """ - IOBuffer([data::AbstractVector{UInt8}]; keywords...) -> IOBuffer + IOBuffer([data::AbstractVector{UInt8}]; keywords...)::IOBuffer Create an in-memory I/O stream, which may optionally operate on a pre-existing array. diff --git a/base/iostream.jl b/base/iostream.jl index d91330960d59a..7a06e7d1e237b 100644 --- a/base/iostream.jl +++ b/base/iostream.jl @@ -47,7 +47,7 @@ macro _lock_ios(s, expr) end """ - fd(x) -> RawFD + fd(x)::RawFD Return the file descriptor backing the stream, file, or socket. @@ -257,7 +257,7 @@ eof(s::IOStream) = @_lock_ios s _eof_nolock(s) # "own" means the descriptor will be closed with the IOStream """ - fdio([name::AbstractString, ]fd::Integer[, own::Bool=false]) -> IOStream + fdio([name::AbstractString, ]fd::Integer[, own::Bool=false])::IOStream Create an [`IOStream`](@ref) object from an integer file descriptor. If `own` is `true`, closing this object will close the underlying descriptor. By default, an `IOStream` is closed when @@ -272,7 +272,7 @@ end fdio(fd::Integer, own::Bool=false) = fdio(string(""), fd, own) """ - open(filename::AbstractString; lock = true, keywords...) -> IOStream + open(filename::AbstractString; lock = true, keywords...)::IOStream Open a file in a mode specified by five boolean keyword arguments: @@ -326,7 +326,7 @@ end open(fname::AbstractString; kwargs...) = open(convert(String, fname)::String; kwargs...) """ - open(filename::AbstractString, [mode::AbstractString]; lock = true) -> IOStream + open(filename::AbstractString, [mode::AbstractString]; lock = true)::IOStream Alternate syntax for open, where a string-based mode specifier is used instead of the five booleans. The values of `mode` correspond to those from `fopen(3)` or Perl `open`, and are diff --git a/base/libc.jl b/base/libc.jl index 7364f6e6677fe..29a288b03d837 100644 --- a/base/libc.jl +++ b/base/libc.jl @@ -278,14 +278,14 @@ end # system date in seconds """ - time(t::TmStruct) -> Float64 + time(t::TmStruct)::Float64 Converts a `TmStruct` struct to a number of seconds since the epoch. """ time(tm::TmStruct) = Float64(ccall(:mktime, Int, (Ref{TmStruct},), tm)) """ - time() -> Float64 + time()::Float64 Get the system time in seconds since the epoch, with fairly high (typically, microsecond) resolution. """ @@ -294,7 +294,7 @@ time() = ccall(:jl_clock_now, Float64, ()) ## process-related functions ## """ - getpid() -> Int32 + getpid()::Int32 Get Julia's process ID. """ @@ -303,7 +303,7 @@ getpid() = ccall(:uv_os_getpid, Int32, ()) ## network functions ## """ - gethostname() -> String + gethostname()::String Get the local machine's host name. """ @@ -392,14 +392,14 @@ free(p::Cstring) = free(convert(Ptr{UInt8}, p)) free(p::Cwstring) = free(convert(Ptr{Cwchar_t}, p)) """ - malloc(size::Integer) -> Ptr{Cvoid} + malloc(size::Integer)::Ptr{Cvoid} Call `malloc` from the C standard library. """ malloc(size::Integer) = ccall(:malloc, Ptr{Cvoid}, (Csize_t,), size) """ - realloc(addr::Ptr, size::Integer) -> Ptr{Cvoid} + realloc(addr::Ptr, size::Integer)::Ptr{Cvoid} Call `realloc` from the C standard library. @@ -409,7 +409,7 @@ obtained from [`malloc`](@ref). realloc(p::Ptr, size::Integer) = ccall(:realloc, Ptr{Cvoid}, (Ptr{Cvoid}, Csize_t), p, size) """ - calloc(num::Integer, size::Integer) -> Ptr{Cvoid} + calloc(num::Integer, size::Integer)::Ptr{Cvoid} Call `calloc` from the C standard library. """ diff --git a/base/math.jl b/base/math.jl index 16a8a547e8de1..f0a26265d0f5b 100644 --- a/base/math.jl +++ b/base/math.jl @@ -933,7 +933,7 @@ end ldexp(x::Float16, q::Integer) = Float16(ldexp(Float32(x), q)) """ - exponent(x::Real) -> Int + exponent(x::Real)::Int Return the largest integer `y` such that `2^y ≤ abs(x)`. For a normalized floating-point number `x`, this corresponds to the exponent of `x`. diff --git a/base/multimedia.jl b/base/multimedia.jl index e634a19b7d6aa..883e4831a39fb 100644 --- a/base/multimedia.jl +++ b/base/multimedia.jl @@ -229,8 +229,8 @@ display(d::AbstractDisplay, mime::AbstractString, @nospecialize x) = display(d, display(mime::AbstractString, @nospecialize x) = display(MIME(mime), x) """ - displayable(mime) -> Bool - displayable(d::AbstractDisplay, mime) -> Bool + displayable(mime)::Bool + displayable(d::AbstractDisplay, mime)::Bool Return a boolean value indicating whether the given `mime` type (string) is displayable by any of the displays in the current display stack, or specifically by the display `d` in the diff --git a/base/number.jl b/base/number.jl index 72df50a9c3134..7c9ea1db19cac 100644 --- a/base/number.jl +++ b/base/number.jl @@ -7,7 +7,7 @@ convert(::Type{T}, x::T) where {T<:Number} = x convert(::Type{T}, x::Number) where {T<:Number} = T(x)::T """ - isinteger(x) -> Bool + isinteger(x)::Bool Test whether `x` is numerically equal to some integer. @@ -62,7 +62,7 @@ true isone(x) = x == one(x) # fallback method """ - isfinite(f) -> Bool + isfinite(f)::Bool Test whether a number is finite. diff --git a/base/operators.jl b/base/operators.jl index d01902e302359..065bee799278f 100644 --- a/base/operators.jl +++ b/base/operators.jl @@ -124,7 +124,7 @@ also implement [`<`](@ref) to ensure consistency of comparisons. == """ - isequal(x, y) -> Bool + isequal(x, y)::Bool Similar to [`==`](@ref), except for the treatment of floating point numbers and of missing values. `isequal` treats all floating-point `NaN` values as equal @@ -322,8 +322,8 @@ false const ≠ = != """ - ===(x,y) -> Bool - ≡(x,y) -> Bool + ===(x,y)::Bool + ≡(x,y)::Bool Determine whether `x` and `y` are identical, in the sense that no program could distinguish them. First the types of `x` and `y` are compared. If those are identical, mutable objects @@ -1398,7 +1398,7 @@ const ∈ = in ∉(itr) = Fix2(∉, itr) """ - ∋(collection, item) -> Bool + ∋(collection, item)::Bool Like [`in`](@ref), but with arguments in reverse order. Avoid adding methods to this function; define `in` instead. @@ -1420,8 +1420,8 @@ a function equivalent to `y -> item in y`. ∌(x) = Fix2(∌, x) """ - in(item, collection) -> Bool - ∈(item, collection) -> Bool + in(item, collection)::Bool + ∈(item, collection)::Bool Determine whether an item is in the given collection, in the sense that it is [`==`](@ref) to one of the values generated by iterating over the collection. @@ -1493,8 +1493,8 @@ julia> [1, 2] .∈ ([2, 3],) in """ - ∉(item, collection) -> Bool - ∌(collection, item) -> Bool + ∉(item, collection)::Bool + ∌(collection, item)::Bool Negation of `∈` and `∋`, i.e. checks that `item` is not in `collection`. diff --git a/base/ordering.jl b/base/ordering.jl index 585824bbeadfe..19e8a1cf18109 100644 --- a/base/ordering.jl +++ b/base/ordering.jl @@ -111,7 +111,7 @@ ReverseOrdering(by::By) = By(by.by, ReverseOrdering(by.order)) ReverseOrdering(perm::Perm) = Perm(ReverseOrdering(perm.order), perm.data) """ - lt(o::Ordering, a, b) -> Bool + lt(o::Ordering, a, b)::Bool Test whether `a` is less than `b` according to the ordering `o`. """ diff --git a/base/path.jl b/base/path.jl index 69c8d22c63c54..0e67dc4e95db6 100644 --- a/base/path.jl +++ b/base/path.jl @@ -61,7 +61,7 @@ end """ - splitdrive(path::AbstractString) -> (AbstractString, AbstractString) + splitdrive(path::AbstractString) -> (drive::AbstractString, path::AbstractString) On Windows, split a path into the drive letter part and the path part. On Unix systems, the first component is always the empty string. @@ -69,7 +69,7 @@ first component is always the empty string. splitdrive(path::AbstractString) """ - homedir() -> String + homedir()::String Return the current user's home directory. @@ -104,7 +104,7 @@ else end """ - isabspath(path::AbstractString) -> Bool + isabspath(path::AbstractString)::Bool Determine whether a path is absolute (begins at the root directory). @@ -120,7 +120,7 @@ false isabspath(path::AbstractString) """ - isdirpath(path::AbstractString) -> Bool + isdirpath(path::AbstractString)::Bool Determine whether a path refers to a directory (for example, ends with a path separator). @@ -136,7 +136,7 @@ true isdirpath(path::String) = occursin(path_directory_re, splitdrive(path)[2]) """ - splitdir(path::AbstractString) -> (AbstractString, AbstractString) + splitdir(path::AbstractString) -> (dir::AbstractString, file::AbstractString) Split a path into a tuple of the directory name and file name. @@ -164,7 +164,7 @@ function _splitdir_nodrive(a::String, b::String) end """ - dirname(path::AbstractString) -> String + dirname(path::AbstractString)::String Get the directory part of a path. Trailing characters ('/' or '\\') in the path are counted as part of the path. @@ -183,7 +183,7 @@ See also [`basename`](@ref). dirname(path::AbstractString) = splitdir(path)[1] """ - basename(path::AbstractString) -> String + basename(path::AbstractString)::String Get the file name part of a path. @@ -205,7 +205,7 @@ See also [`dirname`](@ref). basename(path::AbstractString) = splitdir(path)[2] """ - splitext(path::AbstractString) -> (String, String) + splitext(path::AbstractString) -> (path_without_extension::String, extension::String) If the last component of a path contains one or more dots, split the path into everything before the last dot and everything including and after the dot. Otherwise, return a tuple of the argument @@ -234,7 +234,7 @@ end pathsep() = path_separator """ - splitpath(path::AbstractString) -> Vector{String} + splitpath(path::AbstractString)::Vector{String} Split a file path into all its path components. This is the opposite of `joinpath`. Returns an array of substrings, one for each directory or file in @@ -346,9 +346,9 @@ end # os-test joinpath(paths::AbstractString...)::String = joinpath(paths) """ - joinpath(parts::AbstractString...) -> String - joinpath(parts::Vector{AbstractString}) -> String - joinpath(parts::Tuple{AbstractString}) -> String + joinpath(parts::AbstractString...)::String + joinpath(parts::Vector{AbstractString})::String + joinpath(parts::Tuple{AbstractString})::String Join path components into a full path. If some argument is an absolute path or (on Windows) has a drive specification that doesn't match the drive computed for @@ -373,7 +373,7 @@ julia> joinpath(["/home/myuser", "example.jl"]) joinpath """ - normpath(path::AbstractString) -> String + normpath(path::AbstractString)::String Normalize a path, removing "." and ".." entries and changing "/" to the canonical path separator for the system. @@ -422,7 +422,7 @@ function normpath(path::String) end """ - normpath(path::AbstractString, paths::AbstractString...) -> String + normpath(path::AbstractString, paths::AbstractString...)::String Convert a set of paths to a normalized path by joining them together and removing "." and ".." entries. Equivalent to `normpath(joinpath(path, paths...))`. @@ -430,7 +430,7 @@ Convert a set of paths to a normalized path by joining them together and removin normpath(a::AbstractString, b::AbstractString...) = normpath(joinpath(a,b...)) """ - abspath(path::AbstractString) -> String + abspath(path::AbstractString)::String Convert a path to an absolute path by adding the current directory if necessary. Also normalizes the path as in [`normpath`](@ref). @@ -460,7 +460,7 @@ function abspath(a::String)::String end """ - abspath(path::AbstractString, paths::AbstractString...) -> String + abspath(path::AbstractString, paths::AbstractString...)::String Convert a set of paths to an absolute path by joining them together and adding the current directory if necessary. Equivalent to `abspath(joinpath(path, paths...))`. @@ -487,7 +487,7 @@ end # os-test """ - realpath(path::AbstractString) -> String + realpath(path::AbstractString)::String Canonicalize a path by expanding symbolic links and removing "." and ".." entries. On case-insensitive case-preserving filesystems (typically Mac and Windows), the @@ -542,7 +542,7 @@ end """ - expanduser(path::AbstractString) -> AbstractString + expanduser(path::AbstractString)::AbstractString On Unix systems, replace a tilde character at the start of a path with the current user's home directory. @@ -551,7 +551,7 @@ See also: [`contractuser`](@ref). expanduser(path::AbstractString) """ - contractuser(path::AbstractString) -> AbstractString + contractuser(path::AbstractString)::AbstractString On Unix systems, if the path starts with `homedir()`, replace it with a tilde character. @@ -561,7 +561,7 @@ contractuser(path::AbstractString) """ - relpath(path::AbstractString, startpath::AbstractString = ".") -> String + relpath(path::AbstractString, startpath::AbstractString = ".")::String Return a relative filepath to `path` either from the current directory or from an optional start directory. This is a path computation: the filesystem is not accessed to confirm the diff --git a/base/pointer.jl b/base/pointer.jl index de2f413d8f881..fdbcc7bb427b9 100644 --- a/base/pointer.jl +++ b/base/pointer.jl @@ -184,7 +184,7 @@ function unsafe_store!(p::Ptr, x, i::Integer, order::Symbol) end """ - unsafe_modify!(p::Ptr{T}, op, x, [order::Symbol]) -> Pair + unsafe_modify!(p::Ptr{T}, op, x, [order::Symbol])::Pair These atomically perform the operations to get and set a memory address after applying the function `op`. If supported by the hardware (for example, atomic increment), this may be diff --git a/base/process.jl b/base/process.jl index fbc4acfd83e80..66a611b5a6aa7 100644 --- a/base/process.jl +++ b/base/process.jl @@ -635,7 +635,7 @@ kill(ps::Vector{Process}, signum::Integer=SIGTERM) = for p in ps; kill(p, signum kill(ps::ProcessChain, signum::Integer=SIGTERM) = kill(ps.processes, signum) """ - getpid(process) -> Int32 + getpid(process)::Int32 Get the child process ID, if it still exists. diff --git a/base/reduce.jl b/base/reduce.jl index 25466eed4a105..f752bca20f70f 100644 --- a/base/reduce.jl +++ b/base/reduce.jl @@ -1110,7 +1110,7 @@ argmin(itr) = findmin(itr)[2] _bool(f) = x->f(x)::Bool """ - count([f=identity,] itr; init=0) -> Integer + count([f=identity,] itr; init=0)::Integer Count the number of elements in `itr` for which the function `f` returns `true`. If `f` is omitted, count the number of `true` elements in `itr` (which diff --git a/base/reflection.jl b/base/reflection.jl index f9c5dd9765533..4fc09cdc7f521 100644 --- a/base/reflection.jl +++ b/base/reflection.jl @@ -1013,7 +1013,7 @@ end # function reflection """ - nameof(f::Function) -> Symbol + nameof(f::Function)::Symbol Get the name of a generic `Function` as a symbol. For anonymous functions, this is a compiler-generated name. For explicitly-declared subtypes of @@ -1035,7 +1035,7 @@ function nameof(f::Core.IntrinsicFunction) end """ - parentmodule(f::Function) -> Module + parentmodule(f::Function)::Module Determine the module containing the (first) definition of a generic function. @@ -1043,7 +1043,7 @@ function. parentmodule(f::Function) = parentmodule(typeof(f)) """ - parentmodule(f::Function, types) -> Module + parentmodule(f::Function, types)::Module Determine the module containing the first method of a generic function `f` matching the specified `types`. @@ -1057,7 +1057,7 @@ function parentmodule(@nospecialize(f), @nospecialize(types)) end """ - parentmodule(m::Method) -> Module + parentmodule(m::Method)::Module Return the module in which the given method `m` is defined. @@ -1067,7 +1067,7 @@ Return the module in which the given method `m` is defined. parentmodule(m::Method) = m.module """ - hasmethod(f, t::Type{<:Tuple}[, kwnames]; world=get_world_counter()) -> Bool + hasmethod(f, t::Type{<:Tuple}[, kwnames]; world=get_world_counter())::Bool Determine whether the given generic function has a method matching the given `Tuple` of argument types with the upper bound of world age given by `world`. @@ -1178,7 +1178,7 @@ function bodyfunction(basemethod::Method) end """ - Base.isambiguous(m1, m2; ambiguous_bottom=false) -> Bool + Base.isambiguous(m1, m2; ambiguous_bottom=false)::Bool Determine whether two methods `m1` and `m2` may be ambiguous for some call signature. This test is performed in the context of other methods of the same diff --git a/base/refvalue.jl b/base/refvalue.jl index 7a0f2f84e2206..188ab67f26a78 100644 --- a/base/refvalue.jl +++ b/base/refvalue.jl @@ -9,7 +9,7 @@ mutable struct RefValue{T} <: Ref{T} end RefValue(x::T) where {T} = RefValue{T}(x) """ - isassigned(ref::RefValue) -> Bool + isassigned(ref::RefValue)::Bool Test whether the given [`Ref`](@ref) is associated with a value. This is always true for a [`Ref`](@ref) of a bitstype object. diff --git a/base/regex.jl b/base/regex.jl index 9444c9a9fb63e..8d74a361a6137 100644 --- a/base/regex.jl +++ b/base/regex.jl @@ -236,7 +236,7 @@ RegexMatch(match::SubString{S}, captures::Vector{Union{Nothing,SubString{S}}}, RegexMatch{S}(match, captures, offset, offsets, regex) """ - keys(m::RegexMatch) -> Vector + keys(m::RegexMatch)::Vector Return a vector of keys for all capture groups of the underlying regex. A key is included even if the capture group fails to match. @@ -811,8 +811,8 @@ end ## String operations ## """ - *(s::Regex, t::Union{Regex,AbstractString,AbstractChar}) -> Regex - *(s::Union{Regex,AbstractString,AbstractChar}, t::Regex) -> Regex + *(s::Regex, t::Union{Regex,AbstractString,AbstractChar})::Regex + *(s::Union{Regex,AbstractString,AbstractChar}, t::Regex)::Regex Concatenate regexes, strings and/or characters, producing a [`Regex`](@ref). String and character arguments must be matched exactly in the resulting regex, @@ -894,7 +894,7 @@ end """ - ^(s::Regex, n::Integer) -> Regex + ^(s::Regex, n::Integer)::Regex Repeat a regex `n` times. diff --git a/base/reshapedarray.jl b/base/reshapedarray.jl index f65a7d8c9561a..d5292a73052eb 100644 --- a/base/reshapedarray.jl +++ b/base/reshapedarray.jl @@ -64,8 +64,8 @@ end """ - reshape(A, dims...) -> AbstractArray - reshape(A, dims) -> AbstractArray + reshape(A, dims...)::AbstractArray + reshape(A, dims)::AbstractArray Return an array with the same data as `A`, but with different dimension sizes or number of dimensions. The two arrays share the same diff --git a/base/rounding.jl b/base/rounding.jl index 98b4c30822245..4e6af51e333c7 100644 --- a/base/rounding.jl +++ b/base/rounding.jl @@ -285,7 +285,7 @@ end # Default definitions """ - set_zero_subnormals(yes::Bool) -> Bool + set_zero_subnormals(yes::Bool)::Bool If `yes` is `false`, subsequent floating-point operations follow rules for IEEE arithmetic on subnormal values ("denormals"). Otherwise, floating-point operations are permitted (but @@ -302,7 +302,7 @@ break identities such as `(x-y==0) == (x==y)`. set_zero_subnormals(yes::Bool) = ccall(:jl_set_zero_subnormals,Int32,(Int8,),yes)==0 """ - get_zero_subnormals() -> Bool + get_zero_subnormals()::Bool Return `false` if operations on subnormal floating-point values ("denormals") obey rules for IEEE arithmetic, and `true` if they might be converted to zeros. diff --git a/base/runtime_internals.jl b/base/runtime_internals.jl index 67694e533ac47..5f76aed6e9cbf 100644 --- a/base/runtime_internals.jl +++ b/base/runtime_internals.jl @@ -3,7 +3,7 @@ # name and module reflection """ - parentmodule(m::Module) -> Module + parentmodule(m::Module)::Module Get a module's enclosing `Module`. `Main` is its own parent. @@ -23,7 +23,7 @@ parentmodule(m::Module) = (@_total_meta; ccall(:jl_module_parent, Ref{Module}, ( is_root_module(m::Module) = parentmodule(m) === m || m === Compiler || (isdefined(Main, :Base) && m === Main.Base) """ - moduleroot(m::Module) -> Module + moduleroot(m::Module)::Module Find the root module of a given module. This is the first module in the chain of parent modules of `m` which is either a registered root module or which is its @@ -77,7 +77,7 @@ function fullname(m::Module) end """ - moduleloc(m::Module) -> LineNumberNode + moduleloc(m::Module)::LineNumberNode Get the location of the `module` definition. """ @@ -88,7 +88,7 @@ function moduleloc(m::Module) end """ - names(x::Module; all::Bool=false, imported::Bool=false, usings::Bool=false) -> Vector{Symbol} + names(x::Module; all::Bool=false, imported::Bool=false, usings::Bool=false)::Vector{Symbol} Get a vector of the public names of a `Module`, excluding deprecated names. If `all` is true, then the list also includes non-public names defined in the module, @@ -117,7 +117,7 @@ unsorted_names(m::Module; all::Bool=false, imported::Bool=false, usings::Bool=fa ccall(:jl_module_names, Array{Symbol,1}, (Any, Cint, Cint, Cint), m, all, imported, usings) """ - isexported(m::Module, s::Symbol) -> Bool + isexported(m::Module, s::Symbol)::Bool Returns whether a symbol is exported from a module. @@ -143,7 +143,7 @@ false isexported(m::Module, s::Symbol) = ccall(:jl_module_exports_p, Cint, (Any, Any), m, s) != 0 """ - ispublic(m::Module, s::Symbol) -> Bool + ispublic(m::Module, s::Symbol)::Bool Returns whether a symbol is marked as public in a module. @@ -178,7 +178,7 @@ ispublic(m::Module, s::Symbol) = ccall(:jl_module_public_p, Cint, (Any, Any), m, isdeprecated(m::Module, s::Symbol) = ccall(:jl_is_binding_deprecated, Cint, (Any, Any), m, s) != 0 """ - isbindingresolved(m::Module, s::Symbol) -> Bool + isbindingresolved(m::Module, s::Symbol)::Bool Returns whether the binding of a symbol in a module is resolved. @@ -363,7 +363,7 @@ false hasfield(T::Type, name::Symbol) = fieldindex(T, name, false) > 0 """ - nameof(t::DataType) -> Symbol + nameof(t::DataType)::Symbol Get the name of a (potentially `UnionAll`-wrapped) `DataType` (without its parent module) as a symbol. @@ -384,7 +384,7 @@ nameof(t::DataType) = t.name.name nameof(t::UnionAll) = nameof(unwrap_unionall(t))::Symbol """ - parentmodule(t::DataType) -> Module + parentmodule(t::DataType)::Module Determine the module containing the definition of a (potentially `UnionAll`-wrapped) `DataType`. @@ -406,7 +406,7 @@ parentmodule(t::DataType) = t.name.module parentmodule(t::UnionAll) = parentmodule(unwrap_unionall(t)) """ - isconst(m::Module, s::Symbol) -> Bool + isconst(m::Module, s::Symbol)::Bool Determine whether a global is declared `const` in a given module `m`. """ @@ -418,7 +418,7 @@ function isconst(g::GlobalRef) end """ - isconst(t::DataType, s::Union{Int,Symbol}) -> Bool + isconst(t::DataType, s::Union{Int,Symbol})::Bool Determine whether a field `s` is declared `const` in a given type `t`. """ @@ -442,7 +442,7 @@ function isconst(@nospecialize(t::Type), s::Int) end """ - isfieldatomic(t::DataType, s::Union{Int,Symbol}) -> Bool + isfieldatomic(t::DataType, s::Union{Int,Symbol})::Bool Determine whether a field `s` is declared `@atomic` in a given type `t`. """ @@ -522,7 +522,7 @@ struct DataTypeLayout end """ - Base.datatype_alignment(dt::DataType) -> Int + Base.datatype_alignment(dt::DataType)::Int Memory allocation minimum alignment for instances of this type. Can be called on any `isconcretetype`, although for Memory it will give the @@ -565,7 +565,7 @@ gc_alignment(sz::Integer) = Int(ccall(:jl_alignment, Cint, (Csize_t,), sz)) gc_alignment(T::Type) = gc_alignment(Core.sizeof(T)) """ - Base.datatype_haspadding(dt::DataType) -> Bool + Base.datatype_haspadding(dt::DataType)::Bool Return whether the fields of instances of this type are packed in memory, with no intervening padding bits (defined as bits whose value does not impact @@ -580,7 +580,7 @@ function datatype_haspadding(dt::DataType) end """ - Base.datatype_isbitsegal(dt::DataType) -> Bool + Base.datatype_isbitsegal(dt::DataType)::Bool Return whether egality of the (non-padding bits of the) in-memory representation of an instance of this type implies semantic egality of the instance itself. @@ -595,7 +595,7 @@ function datatype_isbitsegal(dt::DataType) end """ - Base.datatype_nfields(dt::DataType) -> UInt32 + Base.datatype_nfields(dt::DataType)::UInt32 Return the number of fields known to this datatype's layout. This may be different from the number of actual fields of the type for opaque types. @@ -608,7 +608,7 @@ function datatype_nfields(dt::DataType) end """ - Base.datatype_npointers(dt::DataType) -> Int + Base.datatype_npointers(dt::DataType)::Int Return the number of pointers in the layout of a datatype. """ @@ -619,7 +619,7 @@ function datatype_npointers(dt::DataType) end """ - Base.datatype_pointerfree(dt::DataType) -> Bool + Base.datatype_pointerfree(dt::DataType)::Bool Return whether instances of this type can contain references to gc-managed memory. Can be called on any `isconcretetype`. @@ -630,7 +630,7 @@ function datatype_pointerfree(dt::DataType) end """ - Base.datatype_fielddesc_type(dt::DataType) -> Int + Base.datatype_fielddesc_type(dt::DataType)::Int Return the size in bytes of each field-description entry in the layout array, located at `(dt.layout + sizeof(DataTypeLayout))`. @@ -646,7 +646,7 @@ function datatype_fielddesc_type(dt::DataType) end """ - Base.datatype_arrayelem(dt::DataType) -> Int + Base.datatype_arrayelem(dt::DataType)::Int Return the behavior of the trailing array types allocations. Can be called on any `isconcretetype`, but only meaningful on `Memory`. @@ -714,7 +714,7 @@ function getindex(dtfd::DataTypeFieldDesc, i::Int) end """ - ismutable(v) -> Bool + ismutable(v)::Bool Return `true` if and only if value `v` is mutable. See [Mutable Composite Types](@ref) for a discussion of immutability. Note that this function works on values, so if you @@ -743,7 +743,7 @@ ismutable(@nospecialize(x)) = (@_total_meta; (typeof(x).name::Core.TypeName).fla # See also https://github.com/JuliaLang/julia/issues/52134 """ - ismutabletype(T) -> Bool + ismutabletype(T)::Bool Determine whether type `T` was declared as a mutable type (i.e. using `mutable struct` keyword). @@ -762,7 +762,7 @@ end ismutabletypename(tn::Core.TypeName) = tn.flags & 0x2 == 0x2 """ - isstructtype(T) -> Bool + isstructtype(T)::Bool Determine whether type `T` was declared as a struct type (i.e. using the `struct` or `mutable struct` keyword). @@ -777,7 +777,7 @@ function isstructtype(@nospecialize t) end """ - isprimitivetype(T) -> Bool + isprimitivetype(T)::Bool Determine whether type `T` was declared as a primitive type (i.e. using the `primitive type` syntax). @@ -825,7 +825,7 @@ Return `true` if `x` is an instance of an [`isbitstype`](@ref) type. isbits(@nospecialize x) = isbitstype(typeof(x)) """ - objectid(x) -> UInt + objectid(x)::UInt Get a hash value for `x` based on object identity. @@ -1221,7 +1221,7 @@ function get_methodtable(m::Method) end """ - has_bottom_parameter(t) -> Bool + has_bottom_parameter(t)::Bool Determine whether `t` is a Type for which one or more of its parameters is `Union{}`. """ @@ -1428,7 +1428,7 @@ const SLOT_USED = 0x8 ast_slotflag(@nospecialize(code), i) = ccall(:jl_ir_slotflag, UInt8, (Any, Csize_t), code, i - 1) """ - may_invoke_generator(method, atype, sparams) -> Bool + may_invoke_generator(method, atype, sparams)::Bool Computes whether or not we may invoke the generator for the given `method` on the given `atype` and `sparams`. For correctness, all generated function are diff --git a/base/set.jl b/base/set.jl index d1f9458039cd4..97cb1d889c482 100644 --- a/base/set.jl +++ b/base/set.jl @@ -92,7 +92,7 @@ length(s::Set) = length(s.dict) in(x, s::Set) = haskey(s.dict, x) """ - in!(x, s::AbstractSet) -> Bool + in!(x, s::AbstractSet)::Bool If `x` is in `s`, return `true`. If not, push `x` into `s` and return `false`. This is equivalent to `in(x, s) ? true : (push!(s, x); false)`, but may have a @@ -478,8 +478,8 @@ function unique!(itr) end """ - allunique(itr) -> Bool - allunique(f, itr) -> Bool + allunique(itr)::Bool + allunique(f, itr)::Bool Return `true` if all values from `itr` are distinct when compared with [`isequal`](@ref). Or if all of `[f(x) for x in itr]` are distinct, for the second method. @@ -602,8 +602,8 @@ function allunique(f::F, t::Tuple) where {F} end """ - allequal(itr) -> Bool - allequal(f, itr) -> Bool + allequal(itr)::Bool + allequal(f, itr)::Bool Return `true` if all values from `itr` are equal when compared with [`isequal`](@ref). Or if all of `[f(x) for x in itr]` are equal, for the second method. diff --git a/base/sort.jl b/base/sort.jl index 8254f56b3f952..e0d77acc25cb1 100644 --- a/base/sort.jl +++ b/base/sort.jl @@ -426,7 +426,7 @@ julia> searchsortedlast([1=>"one", 2=>"two", 4=>"four"], 3=>"three", by=first) # """ searchsortedlast """ - insorted(x, v; by=identity, lt=isless, rev=false) -> Bool + insorted(x, v; by=identity, lt=isless, rev=false)::Bool Determine whether a vector `v` contains any value equivalent to `x`. The vector `v` must be sorted according to the order defined by the keywords. diff --git a/base/stacktraces.jl b/base/stacktraces.jl index 01e8a3cf62e72..a4d938cfd0f35 100644 --- a/base/stacktraces.jl +++ b/base/stacktraces.jl @@ -99,7 +99,7 @@ function hash(frame::StackFrame, h::UInt) end """ - lookup(pointer::Ptr{Cvoid}) -> Vector{StackFrame} + lookup(pointer::Ptr{Cvoid})::Vector{StackFrame} Given a pointer to an execution context (usually generated by a call to `backtrace`), looks up stack frame context information. Returns an array of frame information for all functions @@ -179,7 +179,7 @@ function lookup(ip::Base.InterpreterIP) end """ - stacktrace([trace::Vector{Ptr{Cvoid}},] [c_funcs::Bool=false]) -> StackTrace + stacktrace([trace::Vector{Ptr{Cvoid}},] [c_funcs::Bool=false])::StackTrace Return a stack trace in the form of a vector of `StackFrame`s. (By default stacktrace doesn't return C functions, but this can be enabled.) When called without specifying a @@ -356,7 +356,7 @@ function Base.parentmodule(frame::StackFrame) end """ - from(frame::StackFrame, filter_mod::Module) -> Bool + from(frame::StackFrame, filter_mod::Module)::Bool Return whether the `frame` is from the provided `Module` """ diff --git a/base/stat.jl b/base/stat.jl index fc2ac9a04b0bf..36496db4df415 100644 --- a/base/stat.jl +++ b/base/stat.jl @@ -361,8 +361,8 @@ ctime(st::StatStruct) = st.ctime # mode type predicates """ - ispath(path) -> Bool - ispath(path_elements...) -> Bool + ispath(path)::Bool + ispath(path_elements...)::Bool Return `true` if a valid filesystem entity exists at `path`, otherwise returns `false`. @@ -382,26 +382,26 @@ end ispath(path::AbstractString) = ispath(String(path)) """ - isfifo(path) -> Bool - isfifo(path_elements...) -> Bool - isfifo(stat_struct) -> Bool + isfifo(path)::Bool + isfifo(path_elements...)::Bool + isfifo(stat_struct)::Bool Return `true` if the file at `path` or file descriptor `stat_struct` is FIFO, `false` otherwise. """ isfifo(st::StatStruct) = filemode(st) & 0xf000 == 0x1000 """ - ischardev(path) -> Bool - ischardev(path_elements...) -> Bool - ischardev(stat_struct) -> Bool + ischardev(path)::Bool + ischardev(path_elements...)::Bool + ischardev(stat_struct)::Bool Return `true` if the path `path` or file descriptor `stat_struct` refer to a character device, `false` otherwise. """ ischardev(st::StatStruct) = filemode(st) & 0xf000 == 0x2000 """ - isdir(path) -> Bool - isdir(path_elements...) -> Bool + isdir(path)::Bool + isdir(path_elements...)::Bool Return `true` if `path` points to a directory, `false` otherwise. @@ -419,17 +419,17 @@ See also [`isfile`](@ref) and [`ispath`](@ref). isdir(st::StatStruct) = filemode(st) & 0xf000 == 0x4000 """ - isblockdev(path) -> Bool - isblockdev(path_elements...) -> Bool - isblockdev(stat_struct) -> Bool + isblockdev(path)::Bool + isblockdev(path_elements...)::Bool + isblockdev(stat_struct)::Bool Return `true` if the path `path` or file descriptor `stat_struct` refer to a block device, `false` otherwise. """ isblockdev(st::StatStruct) = filemode(st) & 0xf000 == 0x6000 """ - isfile(path) -> Bool - isfile(path_elements...) -> Bool + isfile(path)::Bool + isfile(path_elements...)::Bool Return `true` if `path` points to a regular file, `false` otherwise. @@ -456,16 +456,16 @@ See also [`isdir`](@ref) and [`ispath`](@ref). isfile(st::StatStruct) = filemode(st) & 0xf000 == 0x8000 """ - islink(path) -> Bool - islink(path_elements...) -> Bool + islink(path)::Bool + islink(path_elements...)::Bool Return `true` if `path` points to a symbolic link, `false` otherwise. """ islink(st::StatStruct) = filemode(st) & 0xf000 == 0xa000 """ - issocket(path) -> Bool - issocket(path_elements...) -> Bool + issocket(path)::Bool + issocket(path_elements...)::Bool Return `true` if `path` points to a socket, `false` otherwise. """ @@ -474,27 +474,27 @@ issocket(st::StatStruct) = filemode(st) & 0xf000 == 0xc000 # mode permission predicates """ - issetuid(path) -> Bool - issetuid(path_elements...) -> Bool - issetuid(stat_struct) -> Bool + issetuid(path)::Bool + issetuid(path_elements...)::Bool + issetuid(stat_struct)::Bool Return `true` if the file at `path` or file descriptor `stat_struct` have the setuid flag set, `false` otherwise. """ issetuid(st::StatStruct) = (filemode(st) & 0o4000) > 0 """ - issetgid(path) -> Bool - issetgid(path_elements...) -> Bool - issetgid(stat_struct) -> Bool + issetgid(path)::Bool + issetgid(path_elements...)::Bool + issetgid(stat_struct)::Bool Return `true` if the file at `path` or file descriptor `stat_struct` have the setgid flag set, `false` otherwise. """ issetgid(st::StatStruct) = (filemode(st) & 0o2000) > 0 """ - issticky(path) -> Bool - issticky(path_elements...) -> Bool - issticky(stat_struct) -> Bool + issticky(path)::Bool + issticky(path_elements...)::Bool + issticky(stat_struct)::Bool Return `true` if the file at `path` or file descriptor `stat_struct` have the sticky bit set, `false` otherwise. """ @@ -601,8 +601,8 @@ Check if the paths `path_a` and `path_b` refer to the same existing file or dire samefile(a::AbstractString, b::AbstractString) = samefile(stat(a), stat(b)) """ - ismount(path) -> Bool - ismount(path_elements...) -> Bool + ismount(path)::Bool + ismount(path_elements...)::Bool Return `true` if `path` is a mount point, `false` otherwise. """ diff --git a/base/stream.jl b/base/stream.jl index e81f65685df72..69d6905d93bd0 100644 --- a/base/stream.jl +++ b/base/stream.jl @@ -316,7 +316,7 @@ function init_stdio(handle::Ptr{Cvoid}) end """ - open(fd::OS_HANDLE) -> IO + open(fd::OS_HANDLE)::IO Take a raw file descriptor wrap it in a Julia-aware IO type, and take ownership of the fd handle. diff --git a/base/strings/annotated.jl b/base/strings/annotated.jl index 814ee2afa9d55..b7b0cb8c23d19 100644 --- a/base/strings/annotated.jl +++ b/base/strings/annotated.jl @@ -410,7 +410,7 @@ annotations(s::SubString{<:AnnotatedString}, pos::UnitRange{<:Integer}) = annotations(s.string, first(pos)+s.offset:last(pos)+s.offset) """ - annotations(chr::AnnotatedChar) -> Vector{$Annotation} + annotations(chr::AnnotatedChar)::Vector{$Annotation} Get all annotations of `chr`, in the form of a vector of annotation pairs. """ diff --git a/base/strings/basic.jl b/base/strings/basic.jl index bf11199143c1e..fc9cc78877c5a 100644 --- a/base/strings/basic.jl +++ b/base/strings/basic.jl @@ -41,7 +41,7 @@ AbstractString ## required string functions ## """ - ncodeunits(s::AbstractString) -> Int + ncodeunits(s::AbstractString)::Int Return the number of code units in a string. Indices that are in bounds to access this string must satisfy `1 ≤ i ≤ ncodeunits(s)`. Not all such indices @@ -66,7 +66,7 @@ See also [`codeunit`](@ref), [`checkbounds`](@ref), [`sizeof`](@ref), ncodeunits(s::AbstractString) """ - codeunit(s::AbstractString) -> Type{<:Union{UInt8, UInt16, UInt32}} + codeunit(s::AbstractString)::Type{<:Union{UInt8, UInt16, UInt32}} Return the code unit type of the given string object. For ASCII, Latin-1, or UTF-8 encoded strings, this would be `UInt8`; for UCS-2 and UTF-16 it would be @@ -82,7 +82,7 @@ codeunit(s::AbstractString) const CodeunitType = Union{Type{UInt8},Type{UInt16},Type{UInt32}} """ - codeunit(s::AbstractString, i::Integer) -> Union{UInt8, UInt16, UInt32} + codeunit(s::AbstractString, i::Integer)::Union{UInt8, UInt16, UInt32} Return the code unit value in the string `s` at index `i`. Note that @@ -106,7 +106,7 @@ See also [`ncodeunits`](@ref), [`checkbounds`](@ref). throw(MethodError(codeunit, (s, i))) : codeunit(s, Int(i)) """ - isvalid(s::AbstractString, i::Integer) -> Bool + isvalid(s::AbstractString, i::Integer)::Bool Predicate indicating whether the given index is the start of the encoding of a character in `s` or not. If `isvalid(s, i)` is true then `s[i]` will return the @@ -142,7 +142,7 @@ Stacktrace: throw(MethodError(isvalid, (s, i))) : isvalid(s, Int(i)) """ - iterate(s::AbstractString, i::Integer) -> Union{Tuple{<:AbstractChar, Int}, Nothing} + iterate(s::AbstractString, i::Integer)::Union{Tuple{<:AbstractChar, Int}, Nothing} Return a tuple of the character in `s` at index `i` with the index of the start of the following character in `s`. This is the key method that allows strings to @@ -240,7 +240,7 @@ end ## string & character concatenation ## """ - *(s::Union{AbstractString, AbstractChar}, t::Union{AbstractString, AbstractChar}...) -> AbstractString + *(s::Union{AbstractString, AbstractChar}, t::Union{AbstractString, AbstractChar}...)::AbstractString Concatenate strings and/or characters, producing a [`String`](@ref) or [`AnnotatedString`](@ref) (as appropriate). This is equivalent to calling the @@ -276,7 +276,7 @@ _isannotated(s) = _isannotated(typeof(s)) ## generic string comparison ## """ - cmp(a::AbstractString, b::AbstractString) -> Int + cmp(a::AbstractString, b::AbstractString)::Int Compare two strings. Return `0` if both strings have the same length and the character at each index is the same in both strings. Return `-1` if `a` is a prefix of `b`, or if @@ -320,7 +320,7 @@ function cmp(a::AbstractString, b::AbstractString) end """ - ==(a::AbstractString, b::AbstractString) -> Bool + ==(a::AbstractString, b::AbstractString)::Bool Test whether two strings are equal character by character (technically, Unicode code point by code point). Should either string be a [`AnnotatedString`](@ref) the @@ -338,7 +338,7 @@ false ==(a::AbstractString, b::AbstractString) = cmp(a, b) == 0 """ - isless(a::AbstractString, b::AbstractString) -> Bool + isless(a::AbstractString, b::AbstractString)::Bool Test whether string `a` comes before string `b` in alphabetical order (technically, in lexicographical order by Unicode code points). @@ -372,8 +372,8 @@ hash(s::AbstractString, h::UInt) = hash(String(s), h) ## character index arithmetic ## """ - length(s::AbstractString) -> Int - length(s::AbstractString, i::Integer, j::Integer) -> Int + length(s::AbstractString)::Int + length(s::AbstractString, i::Integer, j::Integer)::Int Return the number of characters in string `s` from indices `i` through `j`. @@ -418,7 +418,7 @@ end length(s, Int(i), Int(j)) """ - thisind(s::AbstractString, i::Integer) -> Int + thisind(s::AbstractString, i::Integer)::Int If `i` is in bounds in `s` return the index of the start of the character whose encoding code unit `i` is part of. In other words, if `i` is the start of a @@ -462,7 +462,7 @@ function thisind(s::AbstractString, i::Int) end """ - prevind(str::AbstractString, i::Integer, n::Integer=1) -> Int + prevind(str::AbstractString, i::Integer, n::Integer=1)::Int * Case `n == 1` @@ -521,7 +521,7 @@ function prevind(s::AbstractString, i::Int, n::Int) end """ - nextind(str::AbstractString, i::Integer, n::Integer=1) -> Int + nextind(str::AbstractString, i::Integer, n::Integer=1)::Int * Case `n == 1` @@ -593,7 +593,7 @@ iterate(e::EachStringIndex, state=firstindex(e.s)) = state > ncodeunits(e.s) ? n eltype(::Type{<:EachStringIndex}) = Int """ - isascii(c::Union{AbstractChar,AbstractString}) -> Bool + isascii(c::Union{AbstractChar,AbstractString})::Bool Test whether a character belongs to the ASCII character set, or whether this is true for all elements of a string. @@ -644,7 +644,7 @@ end return _isascii(cu,last-chunk_size+1,last) end """ - isascii(cu::AbstractVector{CU}) where {CU <: Integer} -> Bool + isascii(cu::AbstractVector{CU}) where {CU <: Integer}::Bool Test whether all values in the vector belong to the ASCII character set (0x00 to 0x7f). This function is intended to be used by other string implementations that need a fast ASCII check. @@ -763,7 +763,7 @@ julia> repeat("ha", 3) repeat(s::AbstractString, r::Integer) = repeat(String(s), r) """ - ^(s::Union{AbstractString,AbstractChar}, n::Integer) -> AbstractString + ^(s::Union{AbstractString,AbstractChar}, n::Integer)::AbstractString Repeat a string or character `n` times. This can also be written as `repeat(s, n)`. diff --git a/base/strings/io.jl b/base/strings/io.jl index b4a3c7ad3e0c2..842946f8dc655 100644 --- a/base/strings/io.jl +++ b/base/strings/io.jl @@ -622,7 +622,7 @@ julia> println(raw"\\\\x \\\\\\"") macro raw_str(s); s; end """ - escape_raw_string(s::AbstractString, delim='"') -> AbstractString + escape_raw_string(s::AbstractString, delim='"')::AbstractString escape_raw_string(io, s::AbstractString, delim='"') Escape a string in the manner used for parsing raw string literals. @@ -678,7 +678,7 @@ end ## multiline strings ## """ - indentation(str::AbstractString; tabwidth=8) -> (Int, Bool) + indentation(str::AbstractString; tabwidth=8) -> (width::Int, empty::Bool) Calculate the width of leading white space. Return the width and a flag to indicate if the string is empty. diff --git a/base/strings/string.jl b/base/strings/string.jl index 9f3c3d00e4b81..73798499f3ea4 100644 --- a/base/strings/string.jl +++ b/base/strings/string.jl @@ -559,7 +559,7 @@ isascii(s::String) = isascii(codeunits(s)) @assume_effects :foldable repeat(c::Char, r::BitInteger) = @invoke repeat(c::Char, r::Integer) """ - repeat(c::AbstractChar, r::Integer) -> String + repeat(c::AbstractChar, r::Integer)::String Repeat a character `r` times. This can equivalently be accomplished by calling [`c^r`](@ref :^(::Union{AbstractString, AbstractChar}, ::Integer)). diff --git a/base/strings/substring.jl b/base/strings/substring.jl index 50717d3c27e23..148c860705dd3 100644 --- a/base/strings/substring.jl +++ b/base/strings/substring.jl @@ -143,7 +143,7 @@ end _isannotated(::SubString{T}) where {T} = _isannotated(T) """ - reverse(s::AbstractString) -> AbstractString + reverse(s::AbstractString)::AbstractString Reverses a string. Technically, this function reverses the codepoints in a string and its main utility is for reversed-order string processing, especially for reversed diff --git a/base/strings/unicode.jl b/base/strings/unicode.jl index fcb4a371e9898..ddce2ae06cb6d 100644 --- a/base/strings/unicode.jl +++ b/base/strings/unicode.jl @@ -11,7 +11,7 @@ import Base: show, ==, hash, string, Symbol, isless, length, eltype, # whether codepoints are valid Unicode scalar values, i.e. 0-0xd7ff, 0xe000-0x10ffff """ - isvalid(value) -> Bool + isvalid(value)::Bool Return `true` if the given value is valid for its type, which currently can be either `AbstractChar` or `String` or `SubString{String}`. @@ -31,7 +31,7 @@ true isvalid(value) """ - isvalid(T, value) -> Bool + isvalid(T, value)::Bool Return `true` if the given value is valid for that type. Types currently can be either `AbstractChar` or `String`. Values for `AbstractChar` can be of type `AbstractChar` or [`UInt32`](@ref). @@ -376,7 +376,7 @@ isassigned(c) = UTF8PROC_CATEGORY_CN < category_code(c) <= UTF8PROC_CATEGORY_CO ## libc character class predicates ## """ - islowercase(c::AbstractChar) -> Bool + islowercase(c::AbstractChar)::Bool Tests whether a character is a lowercase letter (according to the Unicode standard's `Lowercase` derived property). @@ -401,7 +401,7 @@ islowercase(c::AbstractChar) = ismalformed(c) ? false : # true for Unicode upper and mixed case """ - isuppercase(c::AbstractChar) -> Bool + isuppercase(c::AbstractChar)::Bool Tests whether a character is an uppercase letter (according to the Unicode standard's `Uppercase` derived property). @@ -424,7 +424,7 @@ isuppercase(c::AbstractChar) = ismalformed(c) ? false : Bool(@assume_effects :foldable @ccall utf8proc_isupper(UInt32(c)::UInt32)::Cint) """ - iscased(c::AbstractChar) -> Bool + iscased(c::AbstractChar)::Bool Tests whether a character is cased, i.e. is lower-, upper- or title-cased. @@ -439,7 +439,7 @@ end """ - isdigit(c::AbstractChar) -> Bool + isdigit(c::AbstractChar)::Bool Tests whether a character is an ASCII decimal digit (`0`-`9`). @@ -460,7 +460,7 @@ false isdigit(c::AbstractChar) = (c >= '0') & (c <= '9') """ - isletter(c::AbstractChar) -> Bool + isletter(c::AbstractChar)::Bool Test whether a character is a letter. A character is classified as a letter if it belongs to the Unicode general @@ -483,7 +483,7 @@ false isletter(c::AbstractChar) = UTF8PROC_CATEGORY_LU <= category_code(c) <= UTF8PROC_CATEGORY_LO """ - isnumeric(c::AbstractChar) -> Bool + isnumeric(c::AbstractChar)::Bool Tests whether a character is numeric. A character is classified as numeric if it belongs to the Unicode general category Number, @@ -512,7 +512,7 @@ isnumeric(c::AbstractChar) = UTF8PROC_CATEGORY_ND <= category_code(c) <= UTF8PRO # following C++ only control characters from the Latin-1 subset return true """ - iscntrl(c::AbstractChar) -> Bool + iscntrl(c::AbstractChar)::Bool Tests whether a character is a control character. Control characters are the non-printing characters of the Latin-1 subset of Unicode. @@ -529,7 +529,7 @@ false iscntrl(c::AbstractChar) = c <= '\x1f' || '\x7f' <= c <= '\u9f' """ - ispunct(c::AbstractChar) -> Bool + ispunct(c::AbstractChar)::Bool Tests whether a character belongs to the Unicode general category Punctuation, i.e. a character whose category code begins with 'P'. @@ -557,7 +557,7 @@ ispunct(c::AbstractChar) = UTF8PROC_CATEGORY_PC <= category_code(c) <= UTF8PROC_ # \u85 is the Unicode Next Line (NEL) character """ - isspace(c::AbstractChar) -> Bool + isspace(c::AbstractChar)::Bool Tests whether a character is any whitespace character. Includes ASCII characters '\\t', '\\n', '\\v', '\\f', '\\r', and ' ', Latin-1 character U+0085, and characters in Unicode @@ -583,7 +583,7 @@ true '\ua0' <= c && category_code(c) == UTF8PROC_CATEGORY_ZS """ - isprint(c::AbstractChar) -> Bool + isprint(c::AbstractChar)::Bool Tests whether a character is printable, including spaces, but not a control character. @@ -601,7 +601,7 @@ isprint(c::AbstractChar) = UTF8PROC_CATEGORY_LU <= category_code(c) <= UTF8PROC_ # true in principal if a printer would use ink """ - isxdigit(c::AbstractChar) -> Bool + isxdigit(c::AbstractChar)::Bool Test whether a character is a valid hexadecimal digit. Note that this does not include `x` (as in the standard `0x` prefix). @@ -652,7 +652,7 @@ lowercase(s::AbstractString) = map(lowercase, s) lowercase(s::AnnotatedString) = annotated_chartransform(lowercase, s) """ - titlecase(s::AbstractString; [wordsep::Function], strict::Bool=true) -> String + titlecase(s::AbstractString; [wordsep::Function], strict::Bool=true)::String Capitalize the first character of each word in `s`; if `strict` is true, every other character is @@ -716,7 +716,7 @@ function titlecase(s::AnnotatedString; wordsep::Function = !isletter, strict::Bo end """ - uppercasefirst(s::AbstractString) -> String + uppercasefirst(s::AbstractString)::String Return `s` with the first character converted to uppercase (technically "title case" for Unicode). See also [`titlecase`](@ref) to capitalize the first diff --git a/base/strings/util.jl b/base/strings/util.jl index 87c2abab5344c..184fdf34a2eac 100644 --- a/base/strings/util.jl +++ b/base/strings/util.jl @@ -232,7 +232,7 @@ end # chop(s::AbstractString) = SubString(s, firstindex(s), prevind(s, lastindex(s))) """ - chopprefix(s::AbstractString, prefix::Union{AbstractString,Regex}) -> SubString + chopprefix(s::AbstractString, prefix::Union{AbstractString,Regex})::SubString Remove the prefix `prefix` from `s`. If `s` does not start with `prefix`, a string equal to `s` is returned. @@ -273,7 +273,7 @@ function chopprefix(s::Union{String, SubString{String}}, end """ - chopsuffix(s::AbstractString, suffix::Union{AbstractString,Regex}) -> SubString + chopsuffix(s::AbstractString, suffix::Union{AbstractString,Regex})::SubString Remove the suffix `suffix` from `s`. If `s` does not end with `suffix`, a string equal to `s` is returned. @@ -317,7 +317,7 @@ end """ - chomp(s::AbstractString) -> SubString + chomp(s::AbstractString)::SubString Remove a single trailing newline from a string. @@ -348,8 +348,8 @@ function chomp(s::String) end """ - lstrip([pred=isspace,] str::AbstractString) -> SubString - lstrip(str::AbstractString, chars) -> SubString + lstrip([pred=isspace,] str::AbstractString)::SubString + lstrip(str::AbstractString, chars)::SubString Remove leading characters from `str`, either those specified by `chars` or those for which the function `pred` returns `true`. @@ -383,8 +383,8 @@ lstrip(s::AbstractString, chars::Chars) = lstrip(in(chars), s) lstrip(::AbstractString, ::AbstractString) = throw(ArgumentError("Both arguments are strings. The second argument should be a `Char` or collection of `Char`s")) """ - rstrip([pred=isspace,] str::AbstractString) -> SubString - rstrip(str::AbstractString, chars) -> SubString + rstrip([pred=isspace,] str::AbstractString)::SubString + rstrip(str::AbstractString, chars)::SubString Remove trailing characters from `str`, either those specified by `chars` or those for which the function `pred` returns `true`. @@ -418,8 +418,8 @@ rstrip(::AbstractString, ::AbstractString) = throw(ArgumentError("Both arguments """ - strip([pred=isspace,] str::AbstractString) -> SubString - strip(str::AbstractString, chars) -> SubString + strip([pred=isspace,] str::AbstractString)::SubString + strip(str::AbstractString, chars)::SubString Remove leading and trailing characters from `str`, either those specified by `chars` or those for which the function `pred` returns `true`. @@ -449,7 +449,7 @@ strip(f, s::AbstractString) = lstrip(f, rstrip(f, s)) ## string padding functions ## """ - lpad(s, n::Integer, p::Union{AbstractChar,AbstractString}=' ') -> String + lpad(s, n::Integer, p::Union{AbstractChar,AbstractString}=' ')::String Stringify `s` and pad the resulting string on the left with `p` to make it `n` characters (in [`textwidth`](@ref)) long. If `s` is already `n` characters long, an equal @@ -486,7 +486,7 @@ function lpad( end """ - rpad(s, n::Integer, p::Union{AbstractChar,AbstractString}=' ') -> String + rpad(s, n::Integer, p::Union{AbstractChar,AbstractString}=' ')::String Stringify `s` and pad the resulting string on the right with `p` to make it `n` characters (in [`textwidth`](@ref)) long. If `s` is already `n` characters long, an equal @@ -1191,8 +1191,8 @@ end end """ - bytes2hex(itr) -> String - bytes2hex(io::IO, itr) + bytes2hex(itr)::String + bytes2hex(io::IO, itr)::Nothing Convert an iterator `itr` of bytes to its hexadecimal string representation, either returning a `String` via `bytes2hex(itr)` or writing the string to an `io` stream diff --git a/base/summarysize.jl b/base/summarysize.jl index 4f2646c7641b7..18f5267c8c190 100644 --- a/base/summarysize.jl +++ b/base/summarysize.jl @@ -12,7 +12,7 @@ nth_pointer_isdefined(obj, i::Int) = ccall(:jl_nth_pointer_isdefined, Cint, (Any get_nth_pointer(obj, i::Int) = ccall(:jl_get_nth_pointer, Any, (Any, Csize_t), obj, i-1) """ - Base.summarysize(obj; exclude=Union{...}, chargeall=Union{...}) -> Int + Base.summarysize(obj; exclude=Union{...}, chargeall=Union{...})::Int Compute the amount of memory, in bytes, used by all unique objects reachable from the argument. diff --git a/base/sysinfo.jl b/base/sysinfo.jl index 7dab313cf4f57..33dd03ebd0c2e 100644 --- a/base/sysinfo.jl +++ b/base/sysinfo.jl @@ -639,7 +639,7 @@ end which(program_name::AbstractString) = which(String(program_name)) """ - Sys.username() -> String + Sys.username()::String Return the username for the current user. If the username cannot be determined or is empty, this function throws an error. diff --git a/base/task.jl b/base/task.jl index 951e980ee903c..c6aec03191144 100644 --- a/base/task.jl +++ b/base/task.jl @@ -26,7 +26,7 @@ function showerror(io::IO, ce::CapturedException) end """ - capture_exception(ex, bt) -> Exception + capture_exception(ex, bt)::Exception Returns an exception, possibly incorporating information from a backtrace `bt`. Defaults to returning [`CapturedException(ex, bt)`](@ref). @@ -185,7 +185,7 @@ end end """ - istaskdone(t::Task) -> Bool + istaskdone(t::Task)::Bool Determine whether a task has exited. @@ -209,7 +209,7 @@ true istaskdone(t::Task) = (@atomic :acquire t._state) !== task_state_runnable """ - istaskstarted(t::Task) -> Bool + istaskstarted(t::Task)::Bool Determine whether a task has started executing. @@ -226,7 +226,7 @@ false istaskstarted(t::Task) = ccall(:jl_is_task_started, Cint, (Any,), t) != 0 """ - istaskfailed(t::Task) -> Bool + istaskfailed(t::Task)::Bool Determine whether a task has exited because an exception was thrown. diff --git a/base/threadingconstructs.jl b/base/threadingconstructs.jl index 3d86e203ef72e..a66d35c477a27 100644 --- a/base/threadingconstructs.jl +++ b/base/threadingconstructs.jl @@ -6,7 +6,7 @@ export threadid, nthreads, @threads, @spawn, public Condition, threadpoolsize, ngcthreads """ - Threads.threadid([t::Task]) -> Int + Threads.threadid([t::Task])::Int Get the ID number of the current thread of execution, or the thread of task `t`. The master thread has ID `1`. @@ -37,7 +37,7 @@ threadid() = Int(ccall(:jl_threadid, Int16, ())+1) # lower bound on the largest threadid() """ - Threads.maxthreadid() -> Int + Threads.maxthreadid()::Int Get a lower bound on the number of threads (across all thread pools) available to the Julia process, with atomic-acquire semantics. The result will always be @@ -47,7 +47,7 @@ any task you were able to observe before calling `maxthreadid`. maxthreadid() = Int(Core.Intrinsics.atomic_pointerref(cglobal(:jl_n_threads, Cint), :acquire)) """ - Threads.nthreads(:default | :interactive) -> Int + Threads.nthreads(:default | :interactive)::Int Get the current number of threads within the specified thread pool. The threads in `:interactive` have id numbers `1:nthreads(:interactive)`, and the threads in `:default` have id numbers in @@ -89,7 +89,7 @@ function _sym_to_tpid(tp::Symbol) end """ - Threads.threadpool(tid = threadid()) -> Symbol + Threads.threadpool(tid = threadid())::Symbol Returns the specified thread's threadpool; either `:default`, `:interactive`, or `:foreign`. """ @@ -99,7 +99,7 @@ function threadpool(tid = threadid()) end """ - Threads.threadpooldescription(tid = threadid()) -> String + Threads.threadpooldescription(tid = threadid())::String Returns the specified thread's threadpool name with extended description where appropriate. """ @@ -117,14 +117,14 @@ function threadpooldescription(tid = threadid()) end """ - Threads.nthreadpools() -> Int + Threads.nthreadpools()::Int Returns the number of threadpools currently configured. """ nthreadpools() = Int(unsafe_load(cglobal(:jl_n_threadpools, Cint))) """ - Threads.threadpoolsize(pool::Symbol = :default) -> Int + Threads.threadpoolsize(pool::Symbol = :default)::Int Get the number of threads available to the default thread pool (or to the specified thread pool). @@ -161,7 +161,7 @@ function threadpooltids(pool::Symbol) end """ - Threads.ngcthreads() -> Int + Threads.ngcthreads()::Int Returns the number of GC threads currently configured. This includes both mark threads and concurrent sweep threads. diff --git a/base/util.jl b/base/util.jl index c01ff697e64e3..818200b48f7aa 100644 --- a/base/util.jl +++ b/base/util.jl @@ -271,7 +271,7 @@ function securezero! end unsafe_securezero!(p::Ptr{Cvoid}, len::Integer=1) = Ptr{Cvoid}(unsafe_securezero!(Ptr{UInt8}(p), len)) """ - Base.getpass(message::AbstractString; with_suffix::Bool=true) -> Base.SecretBuffer + Base.getpass(message::AbstractString; with_suffix::Bool=true)::Base.SecretBuffer Display a message and wait for the user to input a secret, returning an `IO` object containing the secret. If `with_suffix` is `true` (the default), the @@ -383,7 +383,7 @@ end getpass(prompt::AbstractString; with_suffix::Bool=true) = getpass(stdin, stdout, prompt; with_suffix) """ - prompt(message; default="") -> Union{String, Nothing} + prompt(message; default="")::Union{String, Nothing} Displays the `message` then waits for user input. Input is terminated when a newline (\\n) is encountered or EOF (^D) character is entered on a blank line. If a `default` is provided diff --git a/stdlib/Dates/src/accessors.jl b/stdlib/Dates/src/accessors.jl index 211b5678c90d8..2a8a24a4d028b 100644 --- a/stdlib/Dates/src/accessors.jl +++ b/stdlib/Dates/src/accessors.jl @@ -79,7 +79,7 @@ for func in (:year, :month, :quarter) name = string(func) @eval begin @doc """ - $($name)(dt::TimeType) -> Int64 + $($name)(dt::TimeType)::Int64 The $($name) of a `Date` or `DateTime` as an [`Int64`](@ref). """ $func(dt::TimeType) @@ -87,7 +87,7 @@ for func in (:year, :month, :quarter) end """ - week(dt::TimeType) -> Int64 + week(dt::TimeType)::Int64 Return the [ISO week date](https://en.wikipedia.org/wiki/ISO_week_date) of a `Date` or `DateTime` as an [`Int64`](@ref). Note that the first week of a year is the week that @@ -113,7 +113,7 @@ for func in (:day, :dayofmonth) name = string(func) @eval begin @doc """ - $($name)(dt::TimeType) -> Int64 + $($name)(dt::TimeType)::Int64 The day of month of a `Date` or `DateTime` as an [`Int64`](@ref). """ $func(dt::TimeType) @@ -121,7 +121,7 @@ for func in (:day, :dayofmonth) end """ - hour(dt::DateTime) -> Int64 + hour(dt::DateTime)::Int64 The hour of day of a `DateTime` as an [`Int64`](@ref). """ @@ -131,7 +131,7 @@ for func in (:minute, :second, :millisecond) name = string(func) @eval begin @doc """ - $($name)(dt::DateTime) -> Int64 + $($name)(dt::DateTime)::Int64 The $($name) of a `DateTime` as an [`Int64`](@ref). """ $func(dt::DateTime) @@ -155,7 +155,7 @@ for func in (:hour, :minute, :second, :millisecond, :microsecond, :nanosecond) name = string(func) @eval begin @doc """ - $($name)(t::Time) -> Int64 + $($name)(t::Time)::Int64 The $($name) of a `Time` as an [`Int64`](@ref). """ $func(t::Time) diff --git a/stdlib/Dates/src/adjusters.jl b/stdlib/Dates/src/adjusters.jl index 0d6cea5dc3e6b..745515b003ce8 100644 --- a/stdlib/Dates/src/adjusters.jl +++ b/stdlib/Dates/src/adjusters.jl @@ -23,7 +23,7 @@ Base.trunc(t::Time, p::Type{Microsecond}) = t - Nanosecond(t) Base.trunc(t::Time, p::Type{Nanosecond}) = t """ - trunc(dt::TimeType, ::Type{Period}) -> TimeType + trunc(dt::TimeType, ::Type{Period})::TimeType Truncates the value of `dt` according to the provided `Period` type. @@ -37,7 +37,7 @@ Dates.trunc(::Dates.TimeType, ::Type{Dates.Period}) # Adjusters """ - firstdayofweek(dt::TimeType) -> TimeType + firstdayofweek(dt::TimeType)::TimeType Adjusts `dt` to the Monday of its week. @@ -53,7 +53,7 @@ firstdayofweek(dt::Date) = Date(UTD(value(dt) - dayofweek(dt) + 1)) firstdayofweek(dt::DateTime) = DateTime(firstdayofweek(Date(dt))) """ - lastdayofweek(dt::TimeType) -> TimeType + lastdayofweek(dt::TimeType)::TimeType Adjusts `dt` to the Sunday of its week. @@ -69,7 +69,7 @@ lastdayofweek(dt::Date) = Date(UTD(value(dt) + (7 - dayofweek(dt)))) lastdayofweek(dt::DateTime) = DateTime(lastdayofweek(Date(dt))) """ - firstdayofmonth(dt::TimeType) -> TimeType + firstdayofmonth(dt::TimeType)::TimeType Adjusts `dt` to the first day of its month. @@ -85,7 +85,7 @@ firstdayofmonth(dt::Date) = Date(UTD(value(dt) - day(dt) + 1)) firstdayofmonth(dt::DateTime) = DateTime(firstdayofmonth(Date(dt))) """ - lastdayofmonth(dt::TimeType) -> TimeType + lastdayofmonth(dt::TimeType)::TimeType Adjusts `dt` to the last day of its month. @@ -104,7 +104,7 @@ end lastdayofmonth(dt::DateTime) = DateTime(lastdayofmonth(Date(dt))) """ - firstdayofyear(dt::TimeType) -> TimeType + firstdayofyear(dt::TimeType)::TimeType Adjusts `dt` to the first day of its year. @@ -120,7 +120,7 @@ firstdayofyear(dt::Date) = Date(UTD(value(dt) - dayofyear(dt) + 1)) firstdayofyear(dt::DateTime) = DateTime(firstdayofyear(Date(dt))) """ - lastdayofyear(dt::TimeType) -> TimeType + lastdayofyear(dt::TimeType)::TimeType Adjusts `dt` to the last day of its year. @@ -139,7 +139,7 @@ end lastdayofyear(dt::DateTime) = DateTime(lastdayofyear(Date(dt))) """ - firstdayofquarter(dt::TimeType) -> TimeType + firstdayofquarter(dt::TimeType)::TimeType Adjusts `dt` to the first day of its quarter. @@ -162,7 +162,7 @@ end firstdayofquarter(dt::DateTime) = DateTime(firstdayofquarter(Date(dt))) """ - lastdayofquarter(dt::TimeType) -> TimeType + lastdayofquarter(dt::TimeType)::TimeType Adjusts `dt` to the last day of its quarter. @@ -205,8 +205,8 @@ function adjust(df::DateFunction, start, step, limit) end """ - adjust(df, start[, step, limit]) -> TimeType - adjust(df, start) -> TimeType + adjust(df, start[, step, limit])::TimeType + adjust(df, start)::TimeType Adjusts the date in `start` until the `f::Function` passed using `df` returns `true`. The optional `step` parameter dictates the change in `start` on every iteration. @@ -246,7 +246,7 @@ end # Constructors using DateFunctions """ - Date(f::Function, y[, m, d]; step=Day(1), limit=10000) -> Date + Date(f::Function, y[, m, d]; step=Day(1), limit=10000)::Date Create a `Date` through the adjuster API. The starting point will be constructed from the provided `y, m, d` arguments, and will be adjusted until `f::Function` returns `true`. @@ -273,7 +273,7 @@ function Date(func::Function, y, m=1, d=1; step::Period=Day(1), limit::Int=10000 end """ - DateTime(f::Function, y[, m, d, h, mi, s]; step=Day(1), limit=10000) -> DateTime + DateTime(f::Function, y[, m, d, h, mi, s]; step=Day(1), limit=10000)::DateTime Create a `DateTime` through the adjuster API. The starting point will be constructed from the provided `y, m, d...` arguments, and will be adjusted until `f::Function` returns @@ -364,7 +364,7 @@ ISDAYOFWEEK = Dict(Mon => DateFunction(ismonday, Date(0)), # "same" indicates whether the current date can be considered or not """ - tonext(dt::TimeType, dow::Int; same::Bool=false) -> TimeType + tonext(dt::TimeType, dow::Int; same::Bool=false)::TimeType Adjusts `dt` to the next day of week corresponding to `dow` with `1 = Monday, 2 = Tuesday, etc`. Setting `same=true` allows the current `dt` to be considered as the next `dow`, @@ -374,7 +374,7 @@ tonext(dt::TimeType, dow::Int; same::Bool=false) = adjust(ISDAYOFWEEK[dow], same # Return the next TimeType where func evals true using step in incrementing """ - tonext(func::Function, dt::TimeType; step=Day(1), limit=10000, same=false) -> TimeType + tonext(func::Function, dt::TimeType; step=Day(1), limit=10000, same=false)::TimeType Adjusts `dt` by iterating at most `limit` iterations by `step` increments until `func` returns `true`. `func` must take a single `TimeType` argument and return a [`Bool`](@ref). @@ -385,7 +385,7 @@ function tonext(func::Function, dt::TimeType; step::Period=Day(1), limit::Int=10 end """ - toprev(dt::TimeType, dow::Int; same::Bool=false) -> TimeType + toprev(dt::TimeType, dow::Int; same::Bool=false)::TimeType Adjusts `dt` to the previous day of week corresponding to `dow` with `1 = Monday, 2 = Tuesday, etc`. Setting `same=true` allows the current `dt` to be considered as the previous @@ -394,7 +394,7 @@ Tuesday, etc`. Setting `same=true` allows the current `dt` to be considered as t toprev(dt::TimeType, dow::Int; same::Bool=false) = adjust(ISDAYOFWEEK[dow], same ? dt : dt + Day(-1), Day(-1), 7) """ - toprev(func::Function, dt::TimeType; step=Day(-1), limit=10000, same=false) -> TimeType + toprev(func::Function, dt::TimeType; step=Day(-1), limit=10000, same=false)::TimeType Adjusts `dt` by iterating at most `limit` iterations by `step` increments until `func` returns `true`. `func` must take a single `TimeType` argument and return a [`Bool`](@ref). @@ -406,7 +406,7 @@ end # Return the first TimeType that falls on dow in the Month or Year """ - tofirst(dt::TimeType, dow::Int; of=Month) -> TimeType + tofirst(dt::TimeType, dow::Int; of=Month)::TimeType Adjusts `dt` to the first `dow` of its month. Alternatively, `of=Year` will adjust to the first `dow` of the year. @@ -418,7 +418,7 @@ end # Return the last TimeType that falls on dow in the Month or Year """ - tolast(dt::TimeType, dow::Int; of=Month) -> TimeType + tolast(dt::TimeType, dow::Int; of=Month)::TimeType Adjusts `dt` to the last `dow` of its month. Alternatively, `of=Year` will adjust to the last `dow` of the year. diff --git a/stdlib/Dates/src/conversions.jl b/stdlib/Dates/src/conversions.jl index 0d413d2cf53a1..70690341d64db 100644 --- a/stdlib/Dates/src/conversions.jl +++ b/stdlib/Dates/src/conversions.jl @@ -3,7 +3,7 @@ # Conversion/Promotion """ - Date(dt::DateTime) -> Date + Date(dt::DateTime)::Date Convert a `DateTime` to a `Date`. The hour, minute, second, and millisecond parts of the `DateTime` are truncated, so only the year, month and day parts are used in @@ -12,7 +12,7 @@ construction. Date(dt::TimeType) = convert(Date, dt) """ - DateTime(dt::Date) -> DateTime + DateTime(dt::Date)::DateTime Convert a `Date` to a `DateTime`. The hour, minute, second, and millisecond parts of the new `DateTime` are assumed to be zero. @@ -20,7 +20,7 @@ the new `DateTime` are assumed to be zero. DateTime(dt::TimeType) = convert(DateTime, dt) """ - Time(dt::DateTime) -> Time + Time(dt::DateTime)::Time Convert a `DateTime` to a `Time`. The hour, minute, second, and millisecond parts of the `DateTime` are used to create the new `Time`. Microsecond and nanoseconds are zero by default. @@ -40,7 +40,7 @@ Base.convert(::Type{Day},dt::Date) = Day(value(dt)) # Converts Date t const UNIXEPOCH = value(DateTime(1970)) #Rata Die milliseconds for 1970-01-01T00:00:00 """ - unix2datetime(x) -> DateTime + unix2datetime(x)::DateTime Take the number of seconds since unix epoch `1970-01-01T00:00:00` and convert to the corresponding `DateTime`. @@ -52,7 +52,7 @@ function unix2datetime(x) end """ - datetime2unix(dt::DateTime) -> Float64 + datetime2unix(dt::DateTime)::Float64 Take the given `DateTime` and return the number of seconds since the unix epoch `1970-01-01T00:00:00` as a [`Float64`](@ref). @@ -60,7 +60,7 @@ since the unix epoch `1970-01-01T00:00:00` as a [`Float64`](@ref). datetime2unix(dt::DateTime) = (value(dt) - UNIXEPOCH) / 1000.0 """ - now() -> DateTime + now()::DateTime Return a `DateTime` corresponding to the user's system time including the system timezone locale. @@ -72,14 +72,14 @@ function now() end """ - today() -> Date + today()::Date Return the date portion of `now()`. """ today() = Date(now()) """ - now(::Type{UTC}) -> DateTime + now(::Type{UTC})::DateTime Return a `DateTime` corresponding to the user's system time as UTC/GMT. For other time zones, see the TimeZones.jl package. @@ -93,7 +93,7 @@ julia> now(UTC) now(::Type{UTC}) = unix2datetime(time()) """ - rata2datetime(days) -> DateTime + rata2datetime(days)::DateTime Take the number of Rata Die days since epoch `0000-12-31T00:00:00` and return the corresponding `DateTime`. @@ -101,7 +101,7 @@ corresponding `DateTime`. rata2datetime(days) = DateTime(yearmonthday(days)...) """ - datetime2rata(dt::TimeType) -> Int64 + datetime2rata(dt::TimeType)::Int64 Return the number of Rata Die days since epoch from the given `Date` or `DateTime`. """ @@ -111,7 +111,7 @@ datetime2rata(dt::TimeType) = days(dt) const JULIANEPOCH = value(DateTime(-4713, 11, 24, 12)) """ - julian2datetime(julian_days) -> DateTime + julian2datetime(julian_days)::DateTime Take the number of Julian calendar days since epoch `-4713-11-24T12:00:00` and return the corresponding `DateTime`. @@ -122,7 +122,7 @@ function julian2datetime(f) end """ - datetime2julian(dt::DateTime) -> Float64 + datetime2julian(dt::DateTime)::Float64 Take the given `DateTime` and return the number of Julian calendar days since the julian epoch `-4713-11-24T12:00:00` as a [`Float64`](@ref). diff --git a/stdlib/Dates/src/io.jl b/stdlib/Dates/src/io.jl index aa7019566093c..cbb4e777671ba 100644 --- a/stdlib/Dates/src/io.jl +++ b/stdlib/Dates/src/io.jl @@ -368,7 +368,7 @@ const DATEFORMAT_REGEX_HASH = Ref(hash(keys(CONVERSION_SPECIFIERS))) const DATEFORMAT_REGEX_CACHE = Ref(compute_dateformat_regex(CONVERSION_SPECIFIERS)) """ - DateFormat(format::AbstractString, locale="english") -> DateFormat + DateFormat(format::AbstractString, locale="english")::DateFormat Construct a date formatting object that can be used for parsing date strings or formatting a date object as a string. The following character codes can be used to construct the `format` @@ -546,7 +546,7 @@ const RFC1123Format = DateFormat("e, dd u yyyy HH:MM:SS") const Locale = Union{DateLocale, String} """ - DateTime(dt::AbstractString, format::AbstractString; locale="english") -> DateTime + DateTime(dt::AbstractString, format::AbstractString; locale="english")::DateTime Construct a `DateTime` by parsing the `dt` date time string following the pattern given in the `format` string (see [`DateFormat`](@ref) for syntax). @@ -574,7 +574,7 @@ function DateTime(dt::AbstractString, format::AbstractString; locale::Locale=ENG end """ - DateTime(dt::AbstractString, df::DateFormat=ISODateTimeFormat) -> DateTime + DateTime(dt::AbstractString, df::DateFormat=ISODateTimeFormat)::DateTime Construct a `DateTime` by parsing the `dt` date time string following the pattern given in the [`DateFormat`](@ref) object, or $ISODateTimeFormat if omitted. @@ -586,7 +586,7 @@ repeatedly parsing similarly formatted date time strings with a pre-created DateTime(dt::AbstractString, df::DateFormat=ISODateTimeFormat) = parse(DateTime, dt, df) """ - Date(d::AbstractString, format::AbstractString; locale="english") -> Date + Date(d::AbstractString, format::AbstractString; locale="english")::Date Construct a `Date` by parsing the `d` date string following the pattern given in the `format` string (see [`DateFormat`](@ref) for syntax). @@ -614,7 +614,7 @@ function Date(d::AbstractString, format::AbstractString; locale::Locale=ENGLISH) end """ - Date(d::AbstractString, df::DateFormat=ISODateFormat) -> Date + Date(d::AbstractString, df::DateFormat=ISODateFormat)::Date Construct a `Date` by parsing the `d` date string following the pattern given in the [`DateFormat`](@ref) object, or $ISODateFormat if omitted. @@ -626,7 +626,7 @@ repeatedly parsing similarly formatted date strings with a pre-created Date(d::AbstractString, df::DateFormat=ISODateFormat) = parse(Date, d, df) """ - Time(t::AbstractString, format::AbstractString; locale="english") -> Time + Time(t::AbstractString, format::AbstractString; locale="english")::Time Construct a `Time` by parsing the `t` time string following the pattern given in the `format` string (see [`DateFormat`](@ref) for syntax). @@ -654,7 +654,7 @@ function Time(t::AbstractString, format::AbstractString; locale::Locale=ENGLISH) end """ - Time(t::AbstractString, df::DateFormat=ISOTimeFormat) -> Time + Time(t::AbstractString, df::DateFormat=ISOTimeFormat)::Time Construct a `Time` by parsing the `t` date time string following the pattern given in the [`DateFormat`](@ref) object, or $ISOTimeFormat if omitted. @@ -683,7 +683,7 @@ end """ - format(dt::TimeType, format::AbstractString; locale="english") -> AbstractString + format(dt::TimeType, format::AbstractString; locale="english")::AbstractString Construct a string by using a `TimeType` object and applying the provided `format`. The following character codes can be used to construct the `format` string: diff --git a/stdlib/Dates/src/parse.jl b/stdlib/Dates/src/parse.jl index e8624cf9243c5..3730e8877339e 100644 --- a/stdlib/Dates/src/parse.jl +++ b/stdlib/Dates/src/parse.jl @@ -321,7 +321,7 @@ function Base.tryparse(::Type{T}, str::AbstractString, df::DateFormat=default_fo end """ - parse_components(str::AbstractString, df::DateFormat) -> Array{Any} + parse_components(str::AbstractString, df::DateFormat)::Array{Any} Parse the string into its components according to the directives in the `DateFormat`. Each component will be a distinct type, typically a subtype of Period. The order of the diff --git a/stdlib/Dates/src/periods.jl b/stdlib/Dates/src/periods.jl index 8f28f95d4a90e..c6d14a1ba5cba 100644 --- a/stdlib/Dates/src/periods.jl +++ b/stdlib/Dates/src/periods.jl @@ -2,7 +2,7 @@ #Period types """ - Dates.value(x::Period) -> Int64 + Dates.value(x::Period)::Int64 For a given period, return the value associated with that period. For example, `value(Millisecond(10))` returns 10 as an integer. @@ -28,7 +28,7 @@ for period in (:Year, :Quarter, :Month, :Week, :Day, :Hour, :Minute, :Second, :M for typ_str in typs @eval begin @doc """ - $($period_str)(dt::$($typ_str)) -> $($period_str) + $($period_str)(dt::$($typ_str))::$($period_str) The $($accessor_str) part of a $($typ_str) as a `$($period_str)`.$($reference) """ $period(dt::$(Symbol(typ_str))) = $period($(Symbol(accessor_str))(dt)) @@ -56,7 +56,7 @@ Base.isfinite(::Union{Type{P}, P}) where {P<:Period} = true # Default values (as used by TimeTypes) """ - default(p::Period) -> Period + default(p::Period)::Period Return a sensible "default" value for the input Period by returning `T(1)` for Year, Month, and Day, and `T(0)` for Hour, Minute, Second, and Millisecond. @@ -165,7 +165,7 @@ struct CompoundPeriod <: AbstractTime end """ - Dates.periods(::CompoundPeriod) -> Vector{Period} + Dates.periods(::CompoundPeriod)::Vector{Period} Return the `Vector` of `Period`s that comprise the given `CompoundPeriod`. @@ -175,7 +175,7 @@ Return the `Vector` of `Period`s that comprise the given `CompoundPeriod`. periods(x::CompoundPeriod) = x.periods """ - CompoundPeriod(periods) -> CompoundPeriod + CompoundPeriod(periods)::CompoundPeriod Construct a `CompoundPeriod` from a `Vector` of `Period`s. All `Period`s of the same type will be added together. @@ -204,7 +204,7 @@ CompoundPeriod(p::Period...) = CompoundPeriod(Period[p...]) """ - canonicalize(::CompoundPeriod) -> CompoundPeriod + canonicalize(::CompoundPeriod)::CompoundPeriod Reduces the `CompoundPeriod` into its canonical form by applying the following rules: diff --git a/stdlib/Dates/src/query.jl b/stdlib/Dates/src/query.jl index 4f3b5a5c4b095..958a4f7c95bc6 100644 --- a/stdlib/Dates/src/query.jl +++ b/stdlib/Dates/src/query.jl @@ -87,7 +87,7 @@ dayofweek(days) = mod1(days, 7) # Number of days in year """ - daysinyear(dt::TimeType) -> Int + daysinyear(dt::TimeType)::Int Return 366 if the year of `dt` is a leap year, otherwise return 365. @@ -108,7 +108,7 @@ dayofyear(y, m, d) = MONTHDAYS[m] + d + (m > 2 && isleapyear(y)) ### Days of the Week """ - dayofweek(dt::TimeType) -> Int64 + dayofweek(dt::TimeType)::Int64 Return the day of the week as an [`Int64`](@ref) with `1 = Monday, 2 = Tuesday, etc.`. @@ -151,8 +151,8 @@ dayname(day::Integer; locale::AbstractString="english") = dayname(day, LOCALES[l dayabbr(day::Integer; locale::AbstractString="english") = dayabbr(day, LOCALES[locale]) """ - dayname(dt::TimeType; locale="english") -> String - dayname(day::Integer; locale="english") -> String + dayname(dt::TimeType; locale="english")::String + dayname(day::Integer; locale="english")::String Return the full day name corresponding to the day of the week of the `Date` or `DateTime` in the given `locale`. Also accepts `Integer`. @@ -171,8 +171,8 @@ function dayname(dt::TimeType;locale::AbstractString="english") end """ - dayabbr(dt::TimeType; locale="english") -> String - dayabbr(day::Integer; locale="english") -> String + dayabbr(dt::TimeType; locale="english")::String + dayabbr(day::Integer; locale="english")::String Return the abbreviated name corresponding to the day of the week of the `Date` or `DateTime` in the given `locale`. Also accepts `Integer`. @@ -201,7 +201,7 @@ issunday(dt::TimeType) = dayofweek(dt) == Sun # i.e. 1st Monday? 2nd Monday? 3rd Wednesday? 5th Sunday? """ - dayofweekofmonth(dt::TimeType) -> Int + dayofweekofmonth(dt::TimeType)::Int For the day of week of `dt`, return which number it is in `dt`'s month. So if the day of the week of `dt` is Monday, then `1 = First Monday of the month, 2 = Second Monday of the @@ -231,7 +231,7 @@ const THIRTY = BitSet([1, 2, 8, 9, 15, 16, 22, 23, 29, 30]) const THIRTYONE = BitSet([1, 2, 3, 8, 9, 10, 15, 16, 17, 22, 23, 24, 29, 30, 31]) """ - daysofweekinmonth(dt::TimeType) -> Int + daysofweekinmonth(dt::TimeType)::Int For the day of week of `dt`, return the total number of that day of the week in `dt`'s month. Returns 4 or 5. Useful in temporal expressions for specifying the last day of a week @@ -561,8 +561,8 @@ monthname(month::Integer; locale::AbstractString="english") = monthname(month, L monthabbr(month::Integer; locale::AbstractString="english") = monthabbr(month, LOCALES[locale]) """ - monthname(dt::TimeType; locale="english") -> String - monthname(month::Integer, locale="english") -> String + monthname(dt::TimeType; locale="english")::String + monthname(month::Integer, locale="english")::String Return the full name of the month of the `Date` or `DateTime` or `Integer` in the given `locale`. @@ -581,8 +581,8 @@ function monthname(dt::TimeType; locale::AbstractString="english") end """ - monthabbr(dt::TimeType; locale="english") -> String - monthabbr(month::Integer, locale="english") -> String + monthabbr(dt::TimeType; locale="english")::String + monthabbr(month::Integer, locale="english")::String Return the abbreviated month name of the `Date` or `DateTime` or `Integer` in the given `locale`. @@ -600,7 +600,7 @@ function monthabbr(dt::TimeType; locale::AbstractString="english") end """ - daysinmonth(dt::TimeType) -> Int + daysinmonth(dt::TimeType)::Int Return the number of days in the month of `dt`. Value will be 28, 29, 30, or 31. @@ -620,7 +620,7 @@ daysinmonth(dt::TimeType) = ((y, m) = yearmonth(dt); return daysinmonth(y, m)) ### Years """ - isleapyear(dt::TimeType) -> Bool + isleapyear(dt::TimeType)::Bool Return `true` if the year of `dt` is a leap year. @@ -636,7 +636,7 @@ false isleapyear(dt::TimeType) = isleapyear(year(dt)) """ - dayofyear(dt::TimeType) -> Int + dayofyear(dt::TimeType)::Int Return the day of the year for `dt` with January 1st being day 1. """ @@ -646,7 +646,7 @@ daysinyear(dt::TimeType) = 365 + isleapyear(dt) ### Quarters """ - quarterofyear(dt::TimeType) -> Int + quarterofyear(dt::TimeType)::Int Return the quarter that `dt` resides in. Range of value is 1:4. """ @@ -655,7 +655,7 @@ quarterofyear(dt::TimeType) = quarter(dt) const QUARTERDAYS = (0, 31, 59, 0, 30, 61, 0, 31, 62, 0, 31, 61) """ - dayofquarter(dt::TimeType) -> Int + dayofquarter(dt::TimeType)::Int Return the day of the current quarter of `dt`. Range of value is 1:92. """ diff --git a/stdlib/Dates/src/rounding.jl b/stdlib/Dates/src/rounding.jl index 08a8218365d2c..30986608d06e2 100644 --- a/stdlib/Dates/src/rounding.jl +++ b/stdlib/Dates/src/rounding.jl @@ -11,7 +11,7 @@ const ConvertiblePeriod = Union{TimePeriod, Week, Day} const TimeTypeOrPeriod = Union{TimeType, ConvertiblePeriod} """ - epochdays2date(days) -> Date + epochdays2date(days)::Date Take the number of days since the rounding epoch (`0000-01-01T00:00:00`) and return the corresponding `Date`. @@ -19,7 +19,7 @@ corresponding `Date`. epochdays2date(i) = Date(UTD(DATEEPOCH + Int64(i))) """ - epochms2datetime(milliseconds) -> DateTime + epochms2datetime(milliseconds)::DateTime Take the number of milliseconds since the rounding epoch (`0000-01-01T00:00:00`) and return the corresponding `DateTime`. @@ -27,7 +27,7 @@ return the corresponding `DateTime`. epochms2datetime(i) = DateTime(UTM(DATETIMEEPOCH + Int64(i))) """ - date2epochdays(dt::Date) -> Int64 + date2epochdays(dt::Date)::Int64 Take the given `Date` and return the number of days since the rounding epoch (`0000-01-01T00:00:00`) as an [`Int64`](@ref). @@ -35,7 +35,7 @@ Take the given `Date` and return the number of days since the rounding epoch date2epochdays(dt::Date) = value(dt) - DATEEPOCH """ - datetime2epochms(dt::DateTime) -> Int64 + datetime2epochms(dt::DateTime)::Int64 Take the given `DateTime` and return the number of milliseconds since the rounding epoch (`0000-01-01T00:00:00`) as an [`Int64`](@ref). @@ -120,7 +120,7 @@ function Base.floor(x::ConvertiblePeriod, precision::T) where T <: ConvertiblePe end """ - floor(dt::TimeType, p::Period) -> TimeType + floor(dt::TimeType, p::Period)::TimeType Return the nearest `Date` or `DateTime` less than or equal to `dt` at resolution `p`. @@ -141,7 +141,7 @@ julia> floor(DateTime(2016, 8, 6, 12, 0, 0), Day) Base.floor(::Dates.TimeType, ::Dates.Period) """ - ceil(dt::TimeType, p::Period) -> TimeType + ceil(dt::TimeType, p::Period)::TimeType Return the nearest `Date` or `DateTime` greater than or equal to `dt` at resolution `p`. diff --git a/stdlib/Dates/src/types.jl b/stdlib/Dates/src/types.jl index 1978864b92554..29b25eef087de 100644 --- a/stdlib/Dates/src/types.jl +++ b/stdlib/Dates/src/types.jl @@ -217,7 +217,7 @@ daysinmonth(y,m) = DAYSINMONTH[m] + (m == 2 && isleapyear(y)) # we can validate arguments in tryparse. """ - validargs(::Type{<:TimeType}, args...) -> Union{ArgumentError, Nothing} + validargs(::Type{<:TimeType}, args...)::Union{ArgumentError, Nothing} Determine whether the given arguments constitute valid inputs for the given type. Returns either an `ArgumentError`, or [`nothing`](@ref) in case of success. @@ -236,7 +236,7 @@ end ### CONSTRUCTORS ### # Core constructors """ - DateTime(y, [m, d, h, mi, s, ms]) -> DateTime + DateTime(y, [m, d, h, mi, s, ms])::DateTime Construct a `DateTime` type by parts. Arguments must be convertible to [`Int64`](@ref). """ @@ -268,7 +268,7 @@ end DateTime(dt::Base.Libc.TmStruct) = DateTime(1900 + dt.year, 1 + dt.month, dt.mday, dt.hour, dt.min, dt.sec) """ - Date(y, [m, d]) -> Date + Date(y, [m, d])::Date Construct a `Date` type by parts. Arguments must be convertible to [`Int64`](@ref). """ @@ -287,7 +287,7 @@ end Date(dt::Base.Libc.TmStruct) = Date(1900 + dt.year, 1 + dt.month, dt.mday) """ - Time(h, [mi, s, ms, us, ns]) -> Time + Time(h, [mi, s, ms, us, ns])::Time Construct a `Time` type by parts. Arguments must be convertible to [`Int64`](@ref). """ @@ -333,7 +333,7 @@ end # To allow any order/combination of Periods """ - DateTime(periods::Period...) -> DateTime + DateTime(periods::Period...)::DateTime Construct a `DateTime` type by `Period` type parts. Arguments may be in any order. DateTime parts not provided will default to the value of `Dates.default(period)`. @@ -354,7 +354,7 @@ function DateTime(period::Period, periods::Period...) end """ - Date(period::Period...) -> Date + Date(period::Period...)::Date Construct a `Date` type by `Period` type parts. Arguments may be in any order. `Date` parts not provided will default to the value of `Dates.default(period)`. @@ -370,7 +370,7 @@ function Date(period::Period, periods::Period...) end """ - Time(period::TimePeriod...) -> Time + Time(period::TimePeriod...)::Time Construct a `Time` type by `Period` type parts. Arguments may be in any order. `Time` parts not provided will default to the value of `Dates.default(period)`. @@ -428,10 +428,10 @@ calendar(dt::DateTime) = ISOCalendar calendar(dt::Date) = ISOCalendar """ - eps(::Type{DateTime}) -> Millisecond - eps(::Type{Date}) -> Day - eps(::Type{Time}) -> Nanosecond - eps(::TimeType) -> Period + eps(::Type{DateTime})::Millisecond + eps(::Type{Date})::Day + eps(::Type{Time})::Nanosecond + eps(::TimeType)::Period Return the smallest unit value supported by the `TimeType`. diff --git a/stdlib/Future/src/Future.jl b/stdlib/Future/src/Future.jl index 746f6e149a47d..65d230afeb720 100644 --- a/stdlib/Future/src/Future.jl +++ b/stdlib/Future/src/Future.jl @@ -28,7 +28,7 @@ copy!(dst::AbstractArray, src::AbstractArray) = Base.copy!(dst, src) ## randjump """ - randjump(r::MersenneTwister, steps::Integer) -> MersenneTwister + randjump(r::MersenneTwister, steps::Integer)::MersenneTwister Create an initialized `MersenneTwister` object, whose state is moved forward (without generating numbers) from `r` by `steps` steps. diff --git a/stdlib/InteractiveUtils/src/clipboard.jl b/stdlib/InteractiveUtils/src/clipboard.jl index 6bcd61584a2b8..1cbdff9f45537 100644 --- a/stdlib/InteractiveUtils/src/clipboard.jl +++ b/stdlib/InteractiveUtils/src/clipboard.jl @@ -154,7 +154,7 @@ Send a printed form of `x` to the operating system clipboard ("copy"). clipboard(x) """ - clipboard() -> String + clipboard()::String Return a string with the contents of the operating system clipboard ("paste"). """ diff --git a/stdlib/LibGit2/src/LibGit2.jl b/stdlib/LibGit2/src/LibGit2.jl index 04435dd577c19..0163da6175509 100644 --- a/stdlib/LibGit2/src/LibGit2.jl +++ b/stdlib/LibGit2/src/LibGit2.jl @@ -56,7 +56,7 @@ struct State end """ - head(pkg::AbstractString) -> String + head(pkg::AbstractString)::String Return current HEAD [`GitHash`](@ref) of the `pkg` repo as a string. @@ -81,7 +81,7 @@ function need_update(repo::GitRepo) end """ - iscommit(id::AbstractString, repo::GitRepo) -> Bool + iscommit(id::AbstractString, repo::GitRepo)::Bool Check if commit `id` (which is a [`GitHash`](@ref) in string form) is in the repository. @@ -114,7 +114,7 @@ function iscommit(id::AbstractString, repo::GitRepo) end """ - LibGit2.isdirty(repo::GitRepo, pathspecs::AbstractString=""; cached::Bool=false) -> Bool + LibGit2.isdirty(repo::GitRepo, pathspecs::AbstractString=""; cached::Bool=false)::Bool Check if there have been any changes to tracked files in the working tree (if `cached=false`) or the index (if `cached=true`). @@ -168,7 +168,7 @@ function isdiff(repo::GitRepo, treeish::AbstractString, paths::AbstractString="" end """ - diff_files(repo::GitRepo, branch1::AbstractString, branch2::AbstractString; kwarg...) -> Vector{AbstractString} + diff_files(repo::GitRepo, branch1::AbstractString, branch2::AbstractString; kwarg...)::Vector{AbstractString} Show which files have changed in the git repository `repo` between branches `branch1` and `branch2`. @@ -224,7 +224,7 @@ function diff_files(repo::GitRepo, branch1::AbstractString, branch2::AbstractStr end """ - is_ancestor_of(a::AbstractString, b::AbstractString, repo::GitRepo) -> Bool + is_ancestor_of(a::AbstractString, b::AbstractString, repo::GitRepo)::Bool Return `true` if `a`, a [`GitHash`](@ref) in string form, is an ancestor of `b`, a [`GitHash`](@ref) in string form. @@ -727,7 +727,7 @@ function revcount(repo::GitRepo, commit1::AbstractString, commit2::AbstractStrin end """ - merge!(repo::GitRepo; kwargs...) -> Bool + merge!(repo::GitRepo; kwargs...)::Bool Perform a git merge on the repository `repo`, merging commits with diverging history into the current branch. Return `true` @@ -898,7 +898,7 @@ end """ - authors(repo::GitRepo) -> Vector{Signature} + authors(repo::GitRepo)::Vector{Signature} Return all authors of commits to the `repo` repository. @@ -931,7 +931,7 @@ function authors(repo::GitRepo) end """ - snapshot(repo::GitRepo) -> State + snapshot(repo::GitRepo)::State Take a snapshot of the current state of the repository `repo`, storing the current HEAD, index, and any uncommitted work. diff --git a/stdlib/LibGit2/src/blob.jl b/stdlib/LibGit2/src/blob.jl index af1a16574b51e..914f8e170fb1c 100644 --- a/stdlib/LibGit2/src/blob.jl +++ b/stdlib/LibGit2/src/blob.jl @@ -6,7 +6,7 @@ function Base.length(blob::GitBlob) end """ - rawcontent(blob::GitBlob) -> Vector{UInt8} + rawcontent(blob::GitBlob)::Vector{UInt8} Fetch the *raw* contents of the [`GitBlob`](@ref) `blob`. This is an `Array` containing the contents of the blob, which may be binary or may be Unicode. @@ -25,7 +25,7 @@ function rawcontent(blob::GitBlob) end """ - content(blob::GitBlob) -> String + content(blob::GitBlob)::String Fetch the contents of the [`GitBlob`](@ref) `blob`. If the `blob` contains binary data (which can be determined using [`isbinary`](@ref)), @@ -39,7 +39,7 @@ function content(blob::GitBlob) end """ - isbinary(blob::GitBlob) -> Bool + isbinary(blob::GitBlob)::Bool Use a heuristic to guess if a file is binary: searching for NULL bytes and looking for a reasonable ratio of printable to non-printable characters among diff --git a/stdlib/LibGit2/src/callbacks.jl b/stdlib/LibGit2/src/callbacks.jl index c4156d4a44c71..2f48278e985a1 100644 --- a/stdlib/LibGit2/src/callbacks.jl +++ b/stdlib/LibGit2/src/callbacks.jl @@ -26,7 +26,7 @@ function mirror_callback(remote::Ptr{Ptr{Cvoid}}, repo_ptr::Ptr{Cvoid}, end """ - LibGit2.is_passphrase_required(private_key) -> Bool + LibGit2.is_passphrase_required(private_key)::Bool Return `true` if the `private_key` file requires a passphrase, `false` otherwise. """ @@ -242,7 +242,7 @@ end """ - credential_callback(...) -> Cint + credential_callback(...)::Cint A LibGit2 credential callback function which provides different credential acquisition functionality w.r.t. a connection protocol. The `payload_ptr` is required to contain a diff --git a/stdlib/LibGit2/src/commit.jl b/stdlib/LibGit2/src/commit.jl index d76a31791e4c4..ceb69d64ad94b 100644 --- a/stdlib/LibGit2/src/commit.jl +++ b/stdlib/LibGit2/src/commit.jl @@ -89,7 +89,7 @@ function commit(repo::GitRepo, end """ - commit(repo::GitRepo, msg::AbstractString; kwargs...) -> GitHash + commit(repo::GitRepo, msg::AbstractString; kwargs...)::GitHash Wrapper around [`git_commit_create`](https://libgit2.org/libgit2/#HEAD/group/commit/git_commit_create). Create a commit in the repository `repo`. `msg` is the commit message. Return the OID of the new commit. diff --git a/stdlib/LibGit2/src/diff.jl b/stdlib/LibGit2/src/diff.jl index a3f2cafe62e96..3162d604acd36 100644 --- a/stdlib/LibGit2/src/diff.jl +++ b/stdlib/LibGit2/src/diff.jl @@ -74,7 +74,7 @@ function GitDiffStats(diff::GitDiff) end """ - files_changed(diff_stat::GitDiffStats) -> Csize_t + files_changed(diff_stat::GitDiffStats)::Csize_t Return how many files were changed (added/modified/deleted) in the [`GitDiff`](@ref) summarized by `diff_stat`. The result may vary depending on the [`DiffOptionsStruct`](@ref) @@ -87,7 +87,7 @@ function files_changed(diff_stat::GitDiffStats) end """ - insertions(diff_stat::GitDiffStats) -> Csize_t + insertions(diff_stat::GitDiffStats)::Csize_t Return the total number of insertions (lines added) in the [`GitDiff`](@ref) summarized by `diff_stat`. The result may vary depending on the [`DiffOptionsStruct`](@ref) @@ -100,7 +100,7 @@ function insertions(diff_stat::GitDiffStats) end """ - deletions(diff_stat::GitDiffStats) -> Csize_t + deletions(diff_stat::GitDiffStats)::Csize_t Return the total number of deletions (lines removed) in the [`GitDiff`](@ref) summarized by `diff_stat`. The result may vary depending on the [`DiffOptionsStruct`](@ref) diff --git a/stdlib/LibGit2/src/gitcredential.jl b/stdlib/LibGit2/src/gitcredential.jl index ea97d87d444ae..2f109faf5eba9 100644 --- a/stdlib/LibGit2/src/gitcredential.jl +++ b/stdlib/LibGit2/src/gitcredential.jl @@ -54,7 +54,7 @@ end """ - ismatch(url, git_cred) -> Bool + ismatch(url, git_cred)::Bool Checks if the `git_cred` is valid for the given `url`. """ @@ -211,7 +211,7 @@ approve(helper::GitCredentialHelper, cred::GitCredential) = run(helper, "store", reject(helper::GitCredentialHelper, cred::GitCredential) = run(helper, "erase", cred) """ - credential_helpers(config, git_cred) -> Vector{GitCredentialHelper} + credential_helpers(config, git_cred)::Vector{GitCredentialHelper} Return all of the `GitCredentialHelper`s found within the provided `config` which are valid for the specified `git_cred`. @@ -239,7 +239,7 @@ function credential_helpers(cfg::GitConfig, cred::GitCredential) end """ - default_username(config, git_cred) -> Union{String, Nothing} + default_username(config, git_cred)::Union{String, Nothing} Return the default username, if any, provided by the `config` which is valid for the specified `git_cred`. diff --git a/stdlib/LibGit2/src/index.jl b/stdlib/LibGit2/src/index.jl index 81e8e75d59585..f84d0424f421f 100644 --- a/stdlib/LibGit2/src/index.jl +++ b/stdlib/LibGit2/src/index.jl @@ -14,7 +14,7 @@ function GitIndex(repo::GitRepo) end """ - read!(idx::GitIndex, force::Bool = false) -> GitIndex + read!(idx::GitIndex, force::Bool = false)::GitIndex Update the contents of `idx` by reading changes made on disk. For example, `idx` might be updated if a file has been added to the repository since it was created. @@ -30,7 +30,7 @@ function read!(idx::GitIndex, force::Bool = false) end """ - write!(idx::GitIndex) -> GitIndex + write!(idx::GitIndex)::GitIndex Write the state of index `idx` to disk using a file lock. """ @@ -41,7 +41,7 @@ function write!(idx::GitIndex) end """ - write_tree!(idx::GitIndex) -> GitHash + write_tree!(idx::GitIndex)::GitHash Write the index `idx` as a [`GitTree`](@ref) on disk. Trees will be recursively created for each subtree in `idx`. The returned [`GitHash`](@ref) can be used to @@ -198,7 +198,7 @@ function Base.findall(path::String, idx::GitIndex) end """ - stage(ie::IndexEntry) -> Cint + stage(ie::IndexEntry)::Cint Get the stage number of `ie`. The stage number `0` represents the current state of the working tree, but other numbers can be used in the case of a merge conflict. diff --git a/stdlib/LibGit2/src/merge.jl b/stdlib/LibGit2/src/merge.jl index 8bd8d1e4b64e9..83d81db4e12e0 100644 --- a/stdlib/LibGit2/src/merge.jl +++ b/stdlib/LibGit2/src/merge.jl @@ -122,7 +122,7 @@ end # Merge changes into current head """ - merge!(repo::GitRepo, anns::Vector{GitAnnotated}; kwargs...) -> Bool + merge!(repo::GitRepo, anns::Vector{GitAnnotated}; kwargs...)::Bool Merge changes from the annotated commits (captured as [`GitAnnotated`](@ref) objects) `anns` into the HEAD of the repository `repo`. The keyword arguments are: @@ -163,7 +163,7 @@ end # Internal implementation of merge. # Returns `true` if merge was successful, otherwise `false` """ - merge!(repo::GitRepo, anns::Vector{GitAnnotated}, fastforward::Bool; kwargs...) -> Bool + merge!(repo::GitRepo, anns::Vector{GitAnnotated}, fastforward::Bool; kwargs...)::Bool Merge changes from the annotated commits (captured as [`GitAnnotated`](@ref) objects) `anns` into the HEAD of the repository `repo`. If `fastforward` is `true`, *only* a @@ -254,7 +254,7 @@ function merge!(repo::GitRepo, anns::Vector{GitAnnotated}, fastforward::Bool; end """ - merge_base(repo::GitRepo, one::AbstractString, two::AbstractString) -> GitHash + merge_base(repo::GitRepo, one::AbstractString, two::AbstractString)::GitHash Find a merge base (a common ancestor) between the commits `one` and `two`. `one` and `two` may both be in string form. Return the `GitHash` of the merge base. diff --git a/stdlib/LibGit2/src/oid.jl b/stdlib/LibGit2/src/oid.jl index fae0d3737a429..48b830384e3ee 100644 --- a/stdlib/LibGit2/src/oid.jl +++ b/stdlib/LibGit2/src/oid.jl @@ -167,7 +167,7 @@ function GitShortHash(obj::GitObject) end """ - raw(id::GitHash) -> Vector{UInt8} + raw(id::GitHash)::Vector{UInt8} Obtain the raw bytes of the [`GitHash`](@ref) as a vector of length $OID_RAWSZ. """ @@ -207,7 +207,7 @@ Base.cmp(id1::GitShortHash, id2::GitHash) = cmp(id1, GitShortHash(id2, OID_HEXSZ Base.isless(id1::AbstractGitHash, id2::AbstractGitHash) = cmp(id1, id2) < 0 """ - iszero(id::GitHash) -> Bool + iszero(id::GitHash)::Bool Determine whether all hexadecimal digits of the given [`GitHash`](@ref) are zero. """ diff --git a/stdlib/LibGit2/src/rebase.jl b/stdlib/LibGit2/src/rebase.jl index e4abf5a85cc92..b9083191246a5 100644 --- a/stdlib/LibGit2/src/rebase.jl +++ b/stdlib/LibGit2/src/rebase.jl @@ -19,7 +19,7 @@ function count(rb::GitRebase) end """ - current(rb::GitRebase) -> Csize_t + current(rb::GitRebase)::Csize_t Return the index of the current [`RebaseOperation`](@ref). If no operation has yet been applied (because the [`GitRebase`](@ref) has been constructed but `next` @@ -90,7 +90,7 @@ function commit(rb::GitRebase, sig::GitSignature) end """ - abort(rb::GitRebase) -> Csize_t + abort(rb::GitRebase)::Csize_t Cancel the in-progress rebase, undoing all changes made so far and returning the parent repository of `rb` and its working directory to their state before @@ -105,7 +105,7 @@ function abort(rb::GitRebase) end """ - finish(rb::GitRebase, sig::GitSignature) -> Csize_t + finish(rb::GitRebase, sig::GitSignature)::Csize_t Complete the rebase described by `rb`. `sig` is a [`GitSignature`](@ref) to specify the identity of the user finishing the rebase. Return `0` if the diff --git a/stdlib/LibGit2/src/reference.jl b/stdlib/LibGit2/src/reference.jl index de6be0dbe9543..4794fce1d496e 100644 --- a/stdlib/LibGit2/src/reference.jl +++ b/stdlib/LibGit2/src/reference.jl @@ -34,7 +34,7 @@ function isorphan(repo::GitRepo) end """ - LibGit2.head(repo::GitRepo) -> GitReference + LibGit2.head(repo::GitRepo)::GitReference Return a `GitReference` to the current HEAD of `repo`. """ @@ -76,7 +76,7 @@ function shortname(ref::GitReference) end """ - LibGit2.reftype(ref::GitReference) -> Cint + LibGit2.reftype(ref::GitReference)::Cint Return a `Cint` corresponding to the type of `ref`: * `0` if the reference is invalid @@ -206,7 +206,7 @@ end peel(ref::GitReference) = peel(GitObject, ref) """ - LibGit2.ref_list(repo::GitRepo) -> Vector{String} + LibGit2.ref_list(repo::GitRepo)::Vector{String} Get a list of all reference names in the `repo` repository. """ @@ -252,7 +252,7 @@ function delete_branch(branch::GitReference) end """ - LibGit2.head!(repo::GitRepo, ref::GitReference) -> GitReference + LibGit2.head!(repo::GitRepo, ref::GitReference)::GitReference Set the HEAD of `repo` to the object pointed to by `ref`. """ @@ -265,7 +265,7 @@ function head!(repo::GitRepo, ref::GitReference) end """ - lookup_branch(repo::GitRepo, branch_name::AbstractString, remote::Bool=false) -> Union{GitReference, Nothing} + lookup_branch(repo::GitRepo, branch_name::AbstractString, remote::Bool=false)::Union{GitReference, Nothing} Determine if the branch specified by `branch_name` exists in the repository `repo`. If `remote` is `true`, `repo` is assumed to be a remote git repository. Otherwise, it @@ -296,7 +296,7 @@ function lookup_branch(repo::GitRepo, end """ - upstream(ref::GitReference) -> Union{GitReference, Nothing} + upstream(ref::GitReference)::Union{GitReference, Nothing} Determine if the branch containing `ref` has a specified upstream branch. diff --git a/stdlib/LibGit2/src/remote.jl b/stdlib/LibGit2/src/remote.jl index 5b815f946fb17..9d4c13c4f4542 100644 --- a/stdlib/LibGit2/src/remote.jl +++ b/stdlib/LibGit2/src/remote.jl @@ -1,7 +1,7 @@ # This file is a part of Julia. License is MIT: https://julialang.org/license """ - GitRemote(repo::GitRepo, rmt_name::AbstractString, rmt_url::AbstractString) -> GitRemote + GitRemote(repo::GitRepo, rmt_name::AbstractString, rmt_url::AbstractString)::GitRemote Look up a remote git repository using its name and URL. Uses the default fetch refspec. @@ -21,7 +21,7 @@ function GitRemote(repo::GitRepo, rmt_name::AbstractString, rmt_url::AbstractStr end """ - GitRemote(repo::GitRepo, rmt_name::AbstractString, rmt_url::AbstractString, fetch_spec::AbstractString) -> GitRemote + GitRemote(repo::GitRepo, rmt_name::AbstractString, rmt_url::AbstractString, fetch_spec::AbstractString)::GitRemote Look up a remote git repository using the repository's name and URL, as well as specifications for how to fetch from the remote @@ -44,7 +44,7 @@ function GitRemote(repo::GitRepo, rmt_name::AbstractString, rmt_url::AbstractStr end """ - GitRemoteAnon(repo::GitRepo, url::AbstractString) -> GitRemote + GitRemoteAnon(repo::GitRepo, url::AbstractString)::GitRemote Look up a remote git repository using only its URL, not its name. @@ -64,7 +64,7 @@ function GitRemoteAnon(repo::GitRepo, url::AbstractString) end """ - GitRemoteDetached(url::AbstractString) -> GitRemote + GitRemoteDetached(url::AbstractString)::GitRemote Create a remote without a connected local repo. """ @@ -77,7 +77,7 @@ function GitRemoteDetached(url::AbstractString) end """ - lookup_remote(repo::GitRepo, remote_name::AbstractString) -> Union{GitRemote, Nothing} + lookup_remote(repo::GitRepo, remote_name::AbstractString)::Union{GitRemote, Nothing} Determine if the `remote_name` specified exists within the `repo`. Return either a [`GitRemote`](@ref) to the remote name if it exists, or [`nothing`](@ref) @@ -195,7 +195,7 @@ function name(rmt::GitRemote) end """ - fetch_refspecs(rmt::GitRemote) -> Vector{String} + fetch_refspecs(rmt::GitRemote)::Vector{String} Get the *fetch* refspecs for the specified `rmt`. These refspecs contain information about which branch(es) to fetch from. @@ -221,7 +221,7 @@ function fetch_refspecs(rmt::GitRemote) end """ - push_refspecs(rmt::GitRemote) -> Vector{String} + push_refspecs(rmt::GitRemote)::Vector{String} Get the *push* refspecs for the specified `rmt`. These refspecs contain information about which branch(es) to push to. @@ -346,7 +346,7 @@ function push(rmt::GitRemote, refspecs::Vector{<:AbstractString}; end """ - remote_delete(repo::GitRepo, remote_name::AbstractString) -> Nothing + remote_delete(repo::GitRepo, remote_name::AbstractString) -> nothing Delete the `remote_name` from the git `repo`. """ @@ -479,7 +479,7 @@ function default_branch(rmt::GitRemote) end """ - ls(rmt::GitRemote) -> Vector{GitRemoteHead} + ls(rmt::GitRemote)::Vector{GitRemoteHead} Get the remote repository's reference advertisement list. diff --git a/stdlib/LibGit2/src/repository.jl b/stdlib/LibGit2/src/repository.jl index 9c8d379578b96..89d94f4426bf0 100644 --- a/stdlib/LibGit2/src/repository.jl +++ b/stdlib/LibGit2/src/repository.jl @@ -37,7 +37,7 @@ function cleanup(r::GitRepo) end """ - LibGit2.init(path::AbstractString, bare::Bool=false) -> GitRepo + LibGit2.init(path::AbstractString, bare::Bool=false)::GitRepo Open a new git repository at `path`. If `bare` is `false`, the working tree will be created in `path/.git`. If `bare` @@ -52,7 +52,7 @@ function init(path::AbstractString, bare::Bool=false) end """ - LibGit2.head_oid(repo::GitRepo) -> GitHash + LibGit2.head_oid(repo::GitRepo)::GitHash Lookup the object id of the current HEAD of git repository `repo`. @@ -85,7 +85,7 @@ function headname(repo::GitRepo) end """ - isbare(repo::GitRepo) -> Bool + isbare(repo::GitRepo)::Bool Determine if `repo` is bare. Suppose the top level directory of `repo` is `DIR`. A non-bare repository is one in which the git directory (see [`gitdir`](@ref)) is @@ -101,7 +101,7 @@ function isbare(repo::GitRepo) end """ - isattached(repo::GitRepo) -> Bool + isattached(repo::GitRepo)::Bool Determine if `repo` is detached - that is, whether its HEAD points to a commit (detached) or whether HEAD points to a branch tip (attached). @@ -330,7 +330,7 @@ function GitDescribeResult(repo::GitRepo; options::DescribeOptions=DescribeOptio end """ - LibGit2.format(result::GitDescribeResult; kwarg...) -> String + LibGit2.format(result::GitDescribeResult; kwarg...)::String Produce a formatted string based on a `GitDescribeResult`. Formatting options are controlled by the keyword argument: @@ -474,7 +474,7 @@ function clone(repo_url::AbstractString, repo_path::AbstractString, end """ - fetchheads(repo::GitRepo) -> Vector{FetchHead} + fetchheads(repo::GitRepo)::Vector{FetchHead} Return the list of all the fetch heads for `repo`, each represented as a [`FetchHead`](@ref), including their names, URLs, and merge statuses. diff --git a/stdlib/LibGit2/src/status.jl b/stdlib/LibGit2/src/status.jl index c048e68c2b2bc..3eb11c391db67 100644 --- a/stdlib/LibGit2/src/status.jl +++ b/stdlib/LibGit2/src/status.jl @@ -39,7 +39,7 @@ function Base.getindex(status::GitStatus, i::Integer) end """ - LibGit2.status(repo::GitRepo, path::String) -> Union{Cuint, Cvoid} + LibGit2.status(repo::GitRepo, path::String)::Union{Cuint, Cvoid} Lookup the status of the file at `path` in the git repository `repo`. For instance, this can be used diff --git a/stdlib/LibGit2/src/tag.jl b/stdlib/LibGit2/src/tag.jl index 73f010590e9c1..d703acbc7c2b7 100644 --- a/stdlib/LibGit2/src/tag.jl +++ b/stdlib/LibGit2/src/tag.jl @@ -1,7 +1,7 @@ # This file is a part of Julia. License is MIT: https://julialang.org/license """ - LibGit2.tag_list(repo::GitRepo) -> Vector{String} + LibGit2.tag_list(repo::GitRepo)::Vector{String} Get a list of all tags in the git repository `repo`. """ diff --git a/stdlib/LibGit2/src/tree.jl b/stdlib/LibGit2/src/tree.jl index 4c507aaba8e48..eccae70de872b 100644 --- a/stdlib/LibGit2/src/tree.jl +++ b/stdlib/LibGit2/src/tree.jl @@ -66,7 +66,7 @@ function filename(te::GitTreeEntry) end """ - filemode(te::GitTreeEntry) -> Cint + filemode(te::GitTreeEntry)::Cint Return the UNIX filemode of the object on disk to which `te` refers as an integer. """ @@ -172,7 +172,7 @@ function _getindex(tree::GitTree, target::AbstractString) end """ - getindex(tree::GitTree, target::AbstractString) -> GitObject + getindex(tree::GitTree, target::AbstractString)::GitObject Look up `target` path in the `tree`, returning a [`GitObject`](@ref) (a [`GitBlob`](@ref) in the case of a file, or another [`GitTree`](@ref) if looking up a directory). diff --git a/stdlib/LibGit2/src/types.jl b/stdlib/LibGit2/src/types.jl index 181baa4991a9b..17f13b68da362 100644 --- a/stdlib/LibGit2/src/types.jl +++ b/stdlib/LibGit2/src/types.jl @@ -953,7 +953,7 @@ end @assert Base.allocatedinline(ConfigBackendEntry) """ - LibGit2.split_cfg_entry(ce::LibGit2.ConfigEntry) -> Tuple{String,String,String,String} + LibGit2.split_cfg_entry(ce::LibGit2.ConfigEntry)::Tuple{String,String,String,String} Break the `ConfigEntry` up to the following pieces: section, subsection, name, and value. @@ -1272,7 +1272,7 @@ end abstract type AbstractCredential end """ - isfilled(cred::AbstractCredential) -> Bool + isfilled(cred::AbstractCredential)::Bool Verifies that a credential is ready for use in authentication. """ @@ -1444,7 +1444,7 @@ function Base.shred!(p::CredentialPayload) end """ - reset!(payload, [config]) -> CredentialPayload + reset!(payload, [config])::CredentialPayload Reset the `payload` state back to the initial values so that it can be used again within the credential callback. If a `config` is provided the configuration will also be updated. @@ -1466,7 +1466,7 @@ function reset!(p::CredentialPayload, config::GitConfig=p.config) end """ - approve(payload::CredentialPayload; shred::Bool=true) -> Nothing + approve(payload::CredentialPayload; shred::Bool=true) -> nothing Store the `payload` credential for re-use in a future authentication. Should only be called when authentication was successful. @@ -1497,7 +1497,7 @@ function approve(p::CredentialPayload; shred::Bool=true) end """ - reject(payload::CredentialPayload; shred::Bool=true) -> Nothing + reject(payload::CredentialPayload; shred::Bool=true) -> nothing Discard the `payload` credential from begin re-used in future authentication. Should only be called when authentication was unsuccessful. diff --git a/stdlib/LibGit2/src/utils.jl b/stdlib/LibGit2/src/utils.jl index f62663a6ea4ca..eb8b878d30484 100644 --- a/stdlib/LibGit2/src/utils.jl +++ b/stdlib/LibGit2/src/utils.jl @@ -29,7 +29,7 @@ $ """x """ - version() -> VersionNumber + version()::VersionNumber Return the version of libgit2 in use, as a [`VersionNumber`](@ref man-version-number-literals). """ @@ -93,7 +93,7 @@ elseif Sys.isunix() end """ - LibGit2.git_url(; kwargs...) -> String + LibGit2.git_url(; kwargs...)::String Create a string based upon the URL components provided. When the `scheme` keyword is not provided the URL produced will use the alternative [scp-like syntax](https://git-scm.com/docs/git-clone#_git_urls_a_id_urls_a). diff --git a/stdlib/Markdown/src/Markdown.jl b/stdlib/Markdown/src/Markdown.jl index 8d79cc93d6171..efab76d91923d 100644 --- a/stdlib/Markdown/src/Markdown.jl +++ b/stdlib/Markdown/src/Markdown.jl @@ -61,7 +61,7 @@ __init__() = foreach(addface!, MARKDOWN_FACES) parse(markdown::String; flavor = julia) = parse(IOBuffer(markdown), flavor = flavor) """ - Markdown.parse(markdown::AbstractString) -> MD + Markdown.parse(markdown::AbstractString)::MD Parse `markdown` as Julia-flavored Markdown text and return the corresponding `MD` object. diff --git a/stdlib/Markdown/src/parse/parse.jl b/stdlib/Markdown/src/parse/parse.jl index dee1e781bfbef..b38cc23b37dc0 100644 --- a/stdlib/Markdown/src/parse/parse.jl +++ b/stdlib/Markdown/src/parse/parse.jl @@ -96,7 +96,7 @@ _parse(stream::IO, block::MD; breaking = false) = _parse(stream, block, config(block), breaking = breaking) """ - parse(stream::IO) -> MD + parse(stream::IO)::MD Parse the content of `stream` as Julia-flavored Markdown text and return the corresponding `MD` object. """ diff --git a/stdlib/Profile/src/Profile.jl b/stdlib/Profile/src/Profile.jl index f59b49d8a4a36..ac1b436e60e43 100644 --- a/stdlib/Profile/src/Profile.jl +++ b/stdlib/Profile/src/Profile.jl @@ -596,7 +596,7 @@ function short_path(spath::Symbol, filenamecache::Dict{Symbol, Tuple{String,Stri end """ - callers(funcname, [data, lidict], [filename=], [linerange=]) -> Vector{Tuple{count, lineinfo}} + callers(funcname, [data, lidict], [filename=], [linerange=])::Vector{Tuple{count, lineinfo}} Given a previous profiling run, determine who called a particular function. Supplying the filename (and optionally, range of line numbers over which the function is defined) allows diff --git a/stdlib/REPL/src/TerminalMenus/AbstractMenu.jl b/stdlib/REPL/src/TerminalMenus/AbstractMenu.jl index ddcfc111cf962..fb546c8185232 100644 --- a/stdlib/REPL/src/TerminalMenus/AbstractMenu.jl +++ b/stdlib/REPL/src/TerminalMenus/AbstractMenu.jl @@ -129,7 +129,7 @@ end ################################################################## """ - header(m::AbstractMenu) -> String + header(m::AbstractMenu)::String Return a header string to be printed above the menu. Defaults to "". @@ -137,7 +137,7 @@ Defaults to "". header(m::AbstractMenu) = "" """ - keypress(m::AbstractMenu, i::UInt32) -> Bool + keypress(m::AbstractMenu, i::UInt32)::Bool Handle any non-standard keypress event. If `true` is returned, [`TerminalMenus.request`](@ref) will exit. @@ -146,7 +146,7 @@ Defaults to `false`. keypress(m::AbstractMenu, i::UInt32) = false """ - numoptions(m::AbstractMenu) -> Int + numoptions(m::AbstractMenu)::Int Return the number of options in menu `m`. Defaults to `length(options(m))`. diff --git a/stdlib/Random/src/RNGs.jl b/stdlib/Random/src/RNGs.jl index 7782de88ba537..0ae479e129b3b 100644 --- a/stdlib/Random/src/RNGs.jl +++ b/stdlib/Random/src/RNGs.jl @@ -337,7 +337,7 @@ end """ - hash_seed(seed) -> AbstractVector{UInt8} + hash_seed(seed)::AbstractVector{UInt8} Return a cryptographic hash of `seed` of size 256 bits (32 bytes). `seed` can currently be of type diff --git a/stdlib/Test/src/Test.jl b/stdlib/Test/src/Test.jl index 79fdb89399d42..82e78d957f1b7 100644 --- a/stdlib/Test/src/Test.jl +++ b/stdlib/Test/src/Test.jl @@ -1116,7 +1116,7 @@ function record(ts::DefaultTestSet, t::Union{Fail, Error}; print_result::Bool=TE end """ - print_verbose(::AbstractTestSet) -> Bool + print_verbose(::AbstractTestSet)::Bool Whether printing involving this `AbstractTestSet` should be verbose or not. @@ -1299,7 +1299,7 @@ function filter_errors(ts::DefaultTestSet) end """ - Test.get_rng(ts::AbstractTestSet) -> Union{Nothing,AbstractRNG} + Test.get_rng(ts::AbstractTestSet)::Union{Nothing,AbstractRNG} Return the global random number generator (RNG) associated to the input testset `ts`. If no RNG is associated to it, return `nothing`. @@ -1307,7 +1307,7 @@ If no RNG is associated to it, return `nothing`. get_rng(::AbstractTestSet) = nothing get_rng(ts::DefaultTestSet) = ts.rng """ - Test.set_rng!(ts::AbstractTestSet, rng::AbstractRNG) -> AbstractRNG + Test.set_rng!(ts::AbstractTestSet, rng::AbstractRNG)::AbstractRNG Set the global random number generator (RNG) associated to the input testset `ts` to `rng`. If no RNG is associated to it, do nothing. @@ -1350,7 +1350,7 @@ struct TestCounts end """" - get_test_counts(::AbstractTestSet) -> TestCounts + get_test_counts(::AbstractTestSet)::TestCounts Recursive function that counts the number of test results of each type directly in the testset, and totals across the child testsets. diff --git a/stdlib/UUIDs/src/UUIDs.jl b/stdlib/UUIDs/src/UUIDs.jl index e3f5f812ef6e2..8043460f4735f 100644 --- a/stdlib/UUIDs/src/UUIDs.jl +++ b/stdlib/UUIDs/src/UUIDs.jl @@ -15,7 +15,7 @@ export UUID, uuid1, uuid4, uuid5, uuid7, uuid_version import Base: UUID """ - uuid_version(u::UUID) -> Int + uuid_version(u::UUID)::Int Inspects the given UUID and returns its version (see [RFC 4122](https://www.ietf.org/rfc/rfc4122)). @@ -36,7 +36,7 @@ const namespace_oid = UUID(0x6ba7b8129dad11d180b400c04fd430c8) # 6ba7b812-9dad- const namespace_x500 = UUID(0x6ba7b8149dad11d180b400c04fd430c8) # 6ba7b814-9dad-11d1-80b4-00c04fd430c8 """ - uuid1([rng::AbstractRNG]) -> UUID + uuid1([rng::AbstractRNG])::UUID Generates a version 1 (time-based) universally unique identifier (UUID), as specified by [RFC 4122](https://www.ietf.org/rfc/rfc4122). Note that the Node ID is randomly generated (does not identify the host) @@ -89,7 +89,7 @@ function _build_uuid1(rng::AbstractRNG, timestamp::UInt64) end """ - uuid4([rng::AbstractRNG]) -> UUID + uuid4([rng::AbstractRNG])::UUID Generates a version 4 (random or pseudo-random) universally unique identifier (UUID), as specified by [RFC 4122](https://www.ietf.org/rfc/rfc4122). @@ -121,7 +121,7 @@ function uuid4(rng::AbstractRNG=Random.RandomDevice()) end """ - uuid5(ns::UUID, name::String) -> UUID + uuid5(ns::UUID, name::String)::UUID Generates a version 5 (namespace and domain-based) universally unique identifier (UUID), as specified by RFC 4122. @@ -162,7 +162,7 @@ function uuid5(ns::UUID, name::String) end """ - uuid7([rng::AbstractRNG]) -> UUID + uuid7([rng::AbstractRNG])::UUID Generates a version 7 (random or pseudo-random) universally unique identifier (UUID), as specified by [RFC 9652](https://www.rfc-editor.org/rfc/rfc9562). diff --git a/stdlib/Unicode/src/Unicode.jl b/stdlib/Unicode/src/Unicode.jl index b9822d0073c73..fee2fea2e6517 100644 --- a/stdlib/Unicode/src/Unicode.jl +++ b/stdlib/Unicode/src/Unicode.jl @@ -122,7 +122,7 @@ normalize(s::AbstractString, nf::Symbol) = Base.Unicode.normalize(s, nf) normalize(s::AbstractString; kwargs...) = Base.Unicode.normalize(s; kwargs...) """ - Unicode.isassigned(c) -> Bool + Unicode.isassigned(c)::Bool Return `true` if the given char or integer is an assigned Unicode code point. @@ -138,7 +138,7 @@ true isassigned(c) = Base.Unicode.isassigned(c) """ - graphemes(s::AbstractString) -> GraphemeIterator + graphemes(s::AbstractString)::GraphemeIterator Return an iterator over substrings of `s` that correspond to the extended graphemes in the string, as defined by Unicode UAX #29. (Roughly, these are what users would perceive as @@ -148,7 +148,7 @@ letter combined with an accent mark is a single grapheme.) graphemes(s::AbstractString) = Base.Unicode.GraphemeIterator{typeof(s)}(s) """ - graphemes(s::AbstractString, m:n) -> SubString + graphemes(s::AbstractString, m:n)::SubString Returns a [`SubString`](@ref) of `s` consisting of the `m`-th through `n`-th graphemes of the string `s`, where the second