Skip to content

Commit dbd935f

Browse files
bramtaylJeffBezanson
authored andcommitted
keywords unlocked
1 parent 23ea201 commit dbd935f

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

60 files changed

+270
-244
lines changed

base/deprecated.jl

Lines changed: 25 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -290,7 +290,7 @@ module DFT
290290
export FFTW
291291
end
292292
using .DFT
293-
for f in filter(s -> isexported(DFT, s), names(DFT, true))
293+
for f in filter(s -> isexported(DFT, s), names(DFT, all = true))
294294
@eval export $f
295295
end
296296
module DSP
@@ -495,14 +495,14 @@ end
495495

496496
# PR #22088
497497
function hex2num(s::AbstractString)
498-
depwarn("`hex2num(s)` is deprecated. Use `reinterpret(Float64, parse(UInt64, s, 16))` instead.", :hex2num)
498+
depwarn("`hex2num(s)` is deprecated. Use `reinterpret(Float64, parse(UInt64, s, base = 16))` instead.", :hex2num)
499499
if length(s) <= 4
500-
return reinterpret(Float16, parse(UInt16, s, 16))
500+
return reinterpret(Float16, parse(UInt16, s, base = 16))
501501
end
502502
if length(s) <= 8
503-
return reinterpret(Float32, parse(UInt32, s, 16))
503+
return reinterpret(Float32, parse(UInt32, s, base = 16))
504504
end
505-
return reinterpret(Float64, parse(UInt64, s, 16))
505+
return reinterpret(Float64, parse(UInt64, s, base = 16))
506506
end
507507
export hex2num
508508

@@ -1581,7 +1581,8 @@ end
15811581
@deprecate catch_stacktrace(c_funcs::Bool) stacktrace(catch_backtrace(), c_funcs)
15821582
@deprecate catch_stacktrace() stacktrace(catch_backtrace())
15831583

1584-
@deprecate method_exists hasmethod
1584+
@deprecate method_exists(f, t) hasmethod(f, t)
1585+
@deprecate method_exists(f, t, world) hasmethod(f, t, world = world)
15851586

15861587
@deprecate object_id objectid
15871588

@@ -1626,6 +1627,24 @@ export readandwrite
16261627
# PR #25196
16271628
@deprecate_binding ObjectIdDict IdDict{Any,Any}
16281629

1630+
@deprecate Timer(timeout, repeat) Timer(timeout, interval = repeat)
1631+
@deprecate Timer(callback, delay, repeat) Time(callback, delay, interval = repeat)
1632+
@deprecate names(m, all) names(m, all = all)
1633+
@deprecate names(m, all, imported) names(m, all = all, imported = imported)
1634+
@deprecate code_native(io, f, types, syntax) code_native(io, f, types, syntax = syntax)
1635+
@deprecate code_native(f, types, syntax) code_native(f, types, syntax = syntax)
1636+
@deprecate eachmatch(re, str, overlap) eachmatch(re, str, overlap = overlap)
1637+
@deprecate matchall(re, str, overlap) matchall(re, str, overlap = overlap)
1638+
@deprecate chop(s, head) chop(s, head = head)
1639+
@deprecate chop(s, head, tail) chop(s, head = head, tail = tail)
1640+
@deprecate tryparse(T::Type{<:Integer}, s, base) tryparse(T, s, base = base)
1641+
@deprecate parse(T::Type{<:Integer}, s, base) parse(T, s, base = base)
1642+
@eval Filesystem @deprecate mkdir(path, mode) mkdir(path, mode = mode)
1643+
@eval Filesystem @deprecate mkpath(path, mode) mkpath(path, mode = mode)
1644+
@deprecate countlines(x, eol) countlines(x, eol = eol)
1645+
@deprecate PipeBuffer(data, maxsize) PipeBuffer(data, maxsize = maxsize)
1646+
@deprecate unsafe_wrap(T, pointer, dims, own) unsafe_wrap(T, pointer, dims, own = own)
1647+
16291648
# END 0.7 deprecations
16301649

16311650
# BEGIN 1.0 deprecations

base/docs/utils.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -351,7 +351,7 @@ moduleusings(mod) = ccall(:jl_module_usings, Any, (Any,), mod)
351351
filtervalid(names) = filter(x->!contains(x, r"#"), map(string, names))
352352

353353
accessible(mod::Module) =
354-
[filter!(s -> !Base.isdeprecated(mod, s), names(mod, true, true));
354+
[filter!(s -> !Base.isdeprecated(mod, s), names(mod, all = true, imported = true));
355355
map(names, moduleusings(mod))...;
356356
builtins] |> unique |> filtervalid
357357

base/errorshow.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -234,7 +234,7 @@ function showerror(io::IO, ex::MethodError)
234234
end
235235
end
236236
if (ex.world != typemax(UInt) && hasmethod(ex.f, arg_types) &&
237-
!hasmethod(ex.f, arg_types, ex.world))
237+
!hasmethod(ex.f, arg_types, world = ex.world))
238238
curworld = ccall(:jl_get_world_counter, UInt, ())
239239
println(io)
240240
print(io, "The applicable method may be too new: running in world age $(ex.world), while current world is $(curworld).")

base/event.jl

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -341,12 +341,12 @@ end
341341
## timer-based notifications
342342

343343
"""
344-
Timer(delay, repeat=0)
344+
Timer(delay; interval = 0)
345345
346346
Create a timer that wakes up tasks waiting for it (by calling [`wait`](@ref) on the timer object).
347347
348348
Waiting tasks are woken after an intial delay of `delay` seconds, and then repeating with the given
349-
`repeat` interval in seconds. If `repeat` is equal to `0`, the timer is only triggered once. When
349+
`interval` in seconds. If `interval` is equal to `0`, the timer is only triggered once. When
350350
the timer is closed (by [`close`](@ref) waiting tasks are woken with an error. Use [`isopen`](@ref)
351351
to check whether a timer is still active.
352352
"""
@@ -355,9 +355,9 @@ mutable struct Timer
355355
cond::Condition
356356
isopen::Bool
357357

358-
function Timer(timeout::Real, repeat::Real=0.0)
358+
function Timer(timeout::Real; interval::Real = 0.0)
359359
timeout 0 || throw(ArgumentError("timer cannot have negative timeout of $timeout seconds"))
360-
repeat 0 || throw(ArgumentError("timer cannot have negative repeat interval of $repeat seconds"))
360+
interval 0 || throw(ArgumentError("timer cannot have negative repeat interval of $interval seconds"))
361361

362362
this = new(Libc.malloc(_sizeof_uv_timer), Condition(), true)
363363
err = ccall(:uv_timer_init, Cint, (Ptr{Cvoid}, Ptr{Cvoid}), eventloop(), this)
@@ -374,7 +374,7 @@ mutable struct Timer
374374
ccall(:uv_update_time, Cvoid, (Ptr{Cvoid},), eventloop())
375375
ccall(:uv_timer_start, Cint, (Ptr{Cvoid}, Ptr{Cvoid}, UInt64, UInt64),
376376
this, uv_jl_timercb::Ptr{Cvoid},
377-
UInt64(round(timeout * 1000)) + 1, UInt64(round(repeat * 1000)))
377+
UInt64(round(timeout * 1000)) + 1, UInt64(round(interval * 1000)))
378378
return this
379379
end
380380
end
@@ -444,13 +444,13 @@ end
444444

445445
# timer with repeated callback
446446
"""
447-
Timer(callback::Function, delay, repeat=0)
447+
Timer(callback::Function, delay; interval = 0)
448448
449449
Create a timer that wakes up tasks waiting for it (by calling [`wait`](@ref) on the timer object) and
450450
calls the function `callback`.
451451
452452
Waiting tasks are woken and the function `callback` is called after an intial delay of `delay` seconds,
453-
and then repeating with the given `repeat` interval in seconds. If `repeat` is equal to `0`, the timer
453+
and then repeating with the given `interval` in seconds. If `interval` is equal to `0`, the timer
454454
is only triggered once. The function `callback` is called with a single argument, the timer itself.
455455
When the timer is closed (by [`close`](@ref) waiting tasks are woken with an error. Use [`isopen`](@ref)
456456
to check whether a timer is still active.
@@ -463,7 +463,7 @@ Here the first number is printed after a delay of two seconds, then the followin
463463
julia> begin
464464
i = 0
465465
cb(timer) = (global i += 1; println(i))
466-
t = Timer(cb, 2, 0.2)
466+
t = Timer(cb, 2, interval = 0.2)
467467
wait(t)
468468
sleep(0.5)
469469
close(t)
@@ -473,8 +473,8 @@ julia> begin
473473
3
474474
```
475475
"""
476-
function Timer(cb::Function, timeout::Real, repeat::Real=0.0)
477-
t = Timer(timeout, repeat)
476+
function Timer(cb::Function, timeout::Real; interval::Real = 0.0)
477+
t = Timer(timeout, interval = interval)
478478
waiter = Task(function()
479479
while isopen(t)
480480
success = try

base/file.jl

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -81,37 +81,44 @@ Temporarily changes the current working directory and applies function `f` befor
8181
"""
8282
cd(f::Function) = cd(f, homedir())
8383

84+
function checkmode(mode::Integer)
85+
if !(0 <= mode <= 511)
86+
throw(ArgumentError("Mode must be between 0 and 511 = 0o777"))
87+
end
88+
mode
89+
end
90+
8491
"""
85-
mkdir(path::AbstractString, mode::Unsigned=0o777)
92+
mkdir(path::AbstractString; mode::Unsigned = 0o777)
8693
8794
Make a new directory with name `path` and permissions `mode`. `mode` defaults to `0o777`,
8895
modified by the current file creation mask. This function never creates more than one
8996
directory. If the directory already exists, or some intermediate directories do not exist,
9097
this function throws an error. See [`mkpath`](@ref) for a function which creates all
9198
required intermediate directories.
9299
"""
93-
function mkdir(path::AbstractString, mode::Unsigned=0o777)
100+
function mkdir(path::AbstractString; mode::Integer = 0o777)
94101
@static if Sys.iswindows()
95102
ret = ccall(:_wmkdir, Int32, (Cwstring,), path)
96103
else
97-
ret = ccall(:mkdir, Int32, (Cstring, UInt32), path, mode)
104+
ret = ccall(:mkdir, Int32, (Cstring, UInt32), path, checkmode(mode))
98105
end
99106
systemerror(:mkdir, ret != 0; extrainfo=path)
100107
end
101108

102109
"""
103-
mkpath(path::AbstractString, mode::Unsigned=0o777)
110+
mkpath(path::AbstractString; mode::Unsigned = 0o777)
104111
105112
Create all directories in the given `path`, with permissions `mode`. `mode` defaults to
106113
`0o777`, modified by the current file creation mask.
107114
"""
108-
function mkpath(path::AbstractString, mode::Unsigned=0o777)
115+
function mkpath(path::AbstractString; mode::Integer = 0o777)
109116
isdirpath(path) && (path = dirname(path))
110117
dir = dirname(path)
111118
(path == dir || isdir(path)) && return
112-
mkpath(dir, mode)
119+
mkpath(dir, mode = checkmode(mode))
113120
try
114-
mkdir(path, mode)
121+
mkdir(path, mode = mode)
115122
# If there is a problem with making the directory, but the directory
116123
# does in fact exist, then ignore the error. Else re-throw it.
117124
catch err
@@ -123,9 +130,6 @@ function mkpath(path::AbstractString, mode::Unsigned=0o777)
123130
end
124131
end
125132

126-
mkdir(path::AbstractString, mode::Signed) = throw(ArgumentError("mode must be an unsigned integer; try 0o$mode"))
127-
mkpath(path::AbstractString, mode::Signed) = throw(ArgumentError("mode must be an unsigned integer; try 0o$mode"))
128-
129133
"""
130134
rm(path::AbstractString; force::Bool=false, recursive::Bool=false)
131135

base/intfuncs.jl

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -747,27 +747,27 @@ bitstring(x::Union{Int64,UInt64,Float64}) = bin(reinterpret(UInt64,x),64)
747747
bitstring(x::Union{Int128,UInt128}) = bin(reinterpret(UInt128,x),128)
748748

749749
"""
750-
digits([T<:Integer], n::Integer, base::T=10, pad::Integer=1)
750+
digits([T<:Integer], n::Integer; base::T = 10, pad::Integer = 1)
751751
752752
Return an array with element type `T` (default `Int`) of the digits of `n` in the given
753753
base, optionally padded with zeros to a specified size. More significant digits are at
754754
higher indices, such that `n == sum([digits[k]*base^(k-1) for k=1:length(digits)])`.
755755
756756
# Examples
757757
```jldoctest
758-
julia> digits(10, 10)
758+
julia> digits(10, base = 10)
759759
2-element Array{Int64,1}:
760760
0
761761
1
762762
763-
julia> digits(10, 2)
763+
julia> digits(10, base = 2)
764764
4-element Array{Int64,1}:
765765
0
766766
1
767767
0
768768
1
769769
770-
julia> digits(10, 2, 6)
770+
julia> digits(10, base = 2, pad = 6)
771771
6-element Array{Int64,1}:
772772
0
773773
1
@@ -777,10 +777,11 @@ julia> digits(10, 2, 6)
777777
0
778778
```
779779
"""
780-
digits(n::Integer, base::T=10, pad::Integer=1) where {T<:Integer} = digits(T, n, base, pad)
780+
digits(n::Integer; base = base::Integer = 10, pad = pad::Integer = 1) =
781+
digits(typeof(base), n, base = base, pad = pad)
781782

782-
function digits(T::Type{<:Integer}, n::Integer, base::Integer=10, pad::Integer=1)
783-
digits!(zeros(T, ndigits(n, base, pad)), n, base)
783+
function digits(T::Type{<:Integer}, n::Integer; base::Integer = 10, pad::Integer = 1)
784+
digits!(zeros(T, ndigits(n, base, pad)), n, base = base)
784785
end
785786

786787
"""
@@ -792,22 +793,22 @@ hastypemax(::Base.BitIntegerType) = true
792793
hastypemax(::Type{T}) where {T} = applicable(typemax, T)
793794

794795
"""
795-
digits!(array, n::Integer, base::Integer=10)
796+
digits!(array, n::Integer; base::Integer = 10)
796797
797798
Fills an array of the digits of `n` in the given base. More significant digits are at higher
798799
indices. If the array length is insufficient, the least significant digits are filled up to
799800
the array length. If the array length is excessive, the excess portion is filled with zeros.
800801
801802
# Examples
802803
```jldoctest
803-
julia> digits!([2,2,2,2], 10, 2)
804+
julia> digits!([2,2,2,2], 10, base = 2)
804805
4-element Array{Int64,1}:
805806
0
806807
1
807808
0
808809
1
809810
810-
julia> digits!([2,2,2,2,2,2], 10, 2)
811+
julia> digits!([2,2,2,2,2,2], 10, base = 2)
811812
6-element Array{Int64,1}:
812813
0
813814
1
@@ -817,8 +818,8 @@ julia> digits!([2,2,2,2,2,2], 10, 2)
817818
0
818819
```
819820
"""
820-
function digits!(a::AbstractVector{T}, n::Integer, base::Integer=10) where T<:Integer
821-
base < 0 && isa(n, Unsigned) && return digits!(a, convert(Signed, n), base)
821+
function digits!(a::AbstractVector{T}, n::Integer; base::Integer = 10) where T<:Integer
822+
base < 0 && isa(n, Unsigned) && return digits!(a, convert(Signed, n), base = base)
822823
2 <= abs(base) || throw(ArgumentError("base must be ≥ 2 or ≤ -2, got $base"))
823824
hastypemax(T) && abs(base) - 1 > typemax(T) &&
824825
throw(ArgumentError("type $T too small for base $base"))

base/io.jl

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -944,7 +944,7 @@ function skipchars(predicate, io::IO; linecomment=nothing)
944944
end
945945

946946
"""
947-
countlines(io::IO, eol::Char='\\n')
947+
countlines(io::IO; eol::Char = '\\n')
948948
949949
Read `io` until the end of the stream/file and count the number of lines. To specify a file
950950
pass the filename as the first argument. EOL markers other than `'\\n'` are supported by
@@ -962,11 +962,11 @@ julia> io = IOBuffer("JuliaLang is a GitHub organization.");
962962
julia> countlines(io)
963963
0
964964
965-
julia> countlines(io, '.')
965+
julia> countlines(io, eol = '.')
966966
1
967967
```
968968
"""
969-
function countlines(io::IO, eol::Char='\n')
969+
function countlines(io::IO; eol::Char='\n')
970970
isascii(eol) || throw(ArgumentError("only ASCII line terminators are supported"))
971971
aeol = UInt8(eol)
972972
a = Vector{UInt8}(uninitialized, 8192)
@@ -980,4 +980,4 @@ function countlines(io::IO, eol::Char='\n')
980980
nl
981981
end
982982

983-
countlines(f::AbstractString, eol::Char='\n') = open(io->countlines(io,eol), f)::Int
983+
countlines(f::AbstractString; eol::Char = '\n') = open(io->countlines(io, eol = eol), f)::Int

base/iobuffer.jl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -115,17 +115,17 @@ IOBuffer(maxsize::Integer) = (x=IOBuffer(StringVector(maxsize), true, true, maxs
115115
# PipeBuffers behave like Unix Pipes. They are typically readable and writable, they act appendable, and are not seekable.
116116

117117
"""
118-
PipeBuffer(data::Vector{UInt8}=UInt8[],[maxsize::Integer=typemax(Int)])
118+
PipeBuffer(data::Vector{UInt8}=UInt8[]; maxsize::Integer = typemax(Int))
119119
120120
An [`IOBuffer`](@ref) that allows reading and performs writes by appending.
121121
Seeking and truncating are not supported.
122122
See [`IOBuffer`](@ref) for the available constructors.
123123
If `data` is given, creates a `PipeBuffer` to operate on a data vector,
124124
optionally specifying a size beyond which the underlying `Array` may not be grown.
125125
"""
126-
PipeBuffer(data::Vector{UInt8}=UInt8[], maxsize::Int=typemax(Int)) =
126+
PipeBuffer(data::Vector{UInt8}=UInt8[]; maxsize::Int = typemax(Int)) =
127127
GenericIOBuffer(data,true,true,false,true,maxsize)
128-
PipeBuffer(maxsize::Integer) = (x = PipeBuffer(StringVector(maxsize),maxsize); x.size=0; x)
128+
PipeBuffer(maxsize::Integer) = (x = PipeBuffer(StringVector(maxsize), maxsize = maxsize); x.size=0; x)
129129

130130
function copy(b::GenericIOBuffer)
131131
ret = typeof(b)(b.writable ? copy(b.data) : b.data,

base/libgit2/blob.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ is binary and not valid Unicode.
1919
"""
2020
function rawcontent(blob::GitBlob)
2121
ptr = ccall((:git_blob_rawcontent, :libgit2), Ptr{UInt8}, (Ptr{Cvoid},), blob.ptr)
22-
copy(unsafe_wrap(Array, ptr, (length(blob),), false))
22+
copy(unsafe_wrap(Array, ptr, (length(blob),), own = false))
2323
end
2424

2525
"""

base/loading.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1104,7 +1104,7 @@ function create_expr_cache(input::String, output::String, concrete_deps::typeof(
11041104
close(in)
11051105
catch ex
11061106
close(in)
1107-
process_running(io) && Timer(t -> kill(io), 5.0) # wait a short time before killing the process to give it a chance to clean up on its own first
1107+
process_running(io) && Timer(t -> kill(io), interval = 5.0) # wait a short time before killing the process to give it a chance to clean up on its own first
11081108
rethrow(ex)
11091109
end
11101110
return io

0 commit comments

Comments
 (0)