Skip to content

Commit

Permalink
Remove many stdlib deprecations (#28450)
Browse files Browse the repository at this point in the history
* Remove Dates deprecations.

* Remove Base64 deprecations.

* Remove CRC32c deprecations.

* Remove DelimitedFiles deprecations.

* Remove FileWatching deprecations.

* Remove InteractiveUtils deprecations.

* Remove Libdl deprecations.

* Remove Markdown deprecations.

* Remove Mmap deprecations.

* Remove Printf deprecations.

* Remove Profile deprecations.

* Remove REPL deprecations.

* Remove Serialization deprecations.

* Remove SharedArrays deprecations.

* Remove Sockets deprecations.

* Remove Statistics deprecations.
  • Loading branch information
fredrikekre authored and KristofferC committed Aug 6, 2018
1 parent f7d9a8b commit cae40f2
Show file tree
Hide file tree
Showing 9 changed files with 2 additions and 218 deletions.
107 changes: 0 additions & 107 deletions base/sysimg.jl
Original file line number Diff line number Diff line change
Expand Up @@ -549,14 +549,9 @@ end

@eval Base begin
@deprecate_binding Test root_module(Base, :Test) true ", run `using Test` instead"
@deprecate_binding Mmap root_module(Base, :Mmap) true ", run `using Mmap` instead"
@deprecate_binding Profile root_module(Base, :Profile) true ", run `using Profile` instead"
@deprecate_binding Dates root_module(Base, :Dates) true ", run `using Dates` instead"
@deprecate_binding Distributed root_module(Base, :Distributed) true ", run `using Distributed` instead"
@deprecate_binding Random root_module(Base, :Random) true ", run `using Random` instead"
@deprecate_binding Serializer root_module(Base, :Serialization) true ", run `using Serialization` instead"
@deprecate_binding Libdl root_module(Base, :Libdl) true ", run `using Libdl` instead"
@deprecate_binding Markdown root_module(Base, :Markdown) true ", run `using Markdown` instead"

# PR #25249
@deprecate_binding SparseArrays root_module(Base, :SparseArrays) true ", run `using SparseArrays` instead"
Expand All @@ -571,44 +566,14 @@ end
@deprecate_binding(SparseVector, root_module(Base, :SparseArrays).SparseVector, true,
", run `using SparseArrays` to load sparse array functionality")

@deprecate_binding(SharedArray, root_module(Base, :SharedArrays).SharedArray, true,
", run `using SharedArrays` to load shared array functionality")

# PR #25571
@deprecate_binding LinAlg root_module(Base, :LinearAlgebra) true ", run `using LinearAlgebra` instead"
@deprecate_binding(I, root_module(Base, :LinearAlgebra).I, true,
", run `using LinearAlgebra` to load linear algebra functionality.")

# PR 25544
@deprecate_binding REPL root_module(Base, :REPL) true ", run `using REPL` instead"
@deprecate_binding LineEdit root_module(Base, :REPL).LineEdit true ", use `REPL.LineEdit` instead"
@deprecate_binding REPLCompletions root_module(Base, :REPL).REPLCompletions true ", use `REPL.REPLCompletions` instead"
@deprecate_binding Terminals root_module(Base, :REPL).Terminals true ", use `REPL.Terminals` instead"

@deprecate_binding Pkg root_module(Base, :Pkg) true ", run `using Pkg` instead"
@deprecate_binding LibGit2 root_module(Base, :LibGit2) true ", run `import LibGit2` instead"

@eval @deprecate_binding $(Symbol("@doc_str")) getfield(root_module(Base, :Markdown), Symbol("@doc_str")) true ", use `Markdown` instead"

@deprecate_stdlib readdlm DelimitedFiles true
@deprecate_stdlib writedlm DelimitedFiles true
@deprecate_stdlib readcsv DelimitedFiles true
@deprecate_stdlib writecsv DelimitedFiles true

@eval @deprecate_stdlib $(Symbol("@profile")) Profile true

@deprecate_stdlib base64encode Base64 true
@deprecate_stdlib base64decode Base64 true
@deprecate_stdlib Base64EncodePipe Base64 true
@deprecate_stdlib Base64DecodePipe Base64 true
@deprecate_stdlib stringmime Base64 true

@deprecate_stdlib poll_fd FileWatching true
@deprecate_stdlib poll_file FileWatching true
@deprecate_stdlib PollingFileWatcher FileWatching true
@deprecate_stdlib watch_file FileWatching true
@deprecate_stdlib FileMonitor FileWatching true

@eval @deprecate_stdlib $(Symbol("@spawn")) Distributed true
@eval @deprecate_stdlib $(Symbol("@spawnat")) Distributed true
@eval @deprecate_stdlib $(Symbol("@fetch")) Distributed true
Expand Down Expand Up @@ -644,16 +609,6 @@ end
@deprecate_stdlib RemoteException Distributed true
@deprecate_stdlib ProcessExitedException Distributed true

@deprecate_stdlib crc32c CRC32c true

@deprecate_stdlib DateTime Dates true
@deprecate_stdlib DateFormat Dates true
@eval @deprecate_stdlib $(Symbol("@dateformat_str")) Dates true
@deprecate_stdlib now Dates true

@eval @deprecate_stdlib $(Symbol("@printf")) Printf true
@eval @deprecate_stdlib $(Symbol("@sprintf")) Printf true

# PR #24874
@deprecate_stdlib rand! Random true
@deprecate_stdlib srand Random true
Expand All @@ -676,11 +631,6 @@ end
@deprecate_stdlib randjump Random true
@deprecate_stdlib GLOBAL_RNG Random false

@deprecate_stdlib serialize Serialization true
@deprecate_stdlib deserialize Serialization true
@deprecate_stdlib AbstractSerializer Serialization true
@deprecate_stdlib SerializationState Serialization true

# PR #25249: SparseArrays to stdlib
## the Base.SparseArrays module itself and exported types are deprecated in base/sysimg.jl
## functions that were re-exported from Base
Expand Down Expand Up @@ -852,63 +802,6 @@ end
@deprecate_stdlib normalize_string Unicode true
@deprecate_stdlib graphemes Unicode true
@deprecate_stdlib is_assigned_char Unicode true

@deprecate_stdlib whos InteractiveUtils true
@deprecate_stdlib subtypes InteractiveUtils true
@deprecate_stdlib apropos InteractiveUtils true
@deprecate_stdlib edit InteractiveUtils true
@deprecate_stdlib less InteractiveUtils true
@deprecate_stdlib code_llvm InteractiveUtils true
@deprecate_stdlib code_native InteractiveUtils true
@deprecate_stdlib code_warntype InteractiveUtils true
@deprecate_stdlib methodswith InteractiveUtils true
@deprecate_stdlib varinfo InteractiveUtils true
@deprecate_stdlib versioninfo InteractiveUtils true
@deprecate_stdlib peakflops InteractiveUtils true
@deprecate_stdlib clipboard InteractiveUtils true
@eval @deprecate_stdlib $(Symbol("@which")) InteractiveUtils true
@eval @deprecate_stdlib $(Symbol("@edit")) InteractiveUtils true
@eval @deprecate_stdlib $(Symbol("@less")) InteractiveUtils true
@eval @deprecate_stdlib $(Symbol("@functionloc")) InteractiveUtils true
@eval @deprecate_stdlib $(Symbol("@code_typed")) InteractiveUtils true
@eval @deprecate_stdlib $(Symbol("@code_warntype")) InteractiveUtils true
@eval @deprecate_stdlib $(Symbol("@code_lowered")) InteractiveUtils true
@eval @deprecate_stdlib $(Symbol("@code_llvm")) InteractiveUtils true
@eval @deprecate_stdlib $(Symbol("@code_native")) InteractiveUtils true

@eval @deprecate_stdlib $(Symbol("@ip_str")) Sockets true
@deprecate_stdlib IPAddr Sockets true
@deprecate_stdlib IPv4 Sockets true
@deprecate_stdlib IPv6 Sockets true
@deprecate_stdlib accept Sockets true
@deprecate_stdlib connect Sockets true
@deprecate_stdlib getaddrinfo Sockets true
@deprecate_stdlib getalladdrinfo Sockets true
@deprecate_stdlib getnameinfo Sockets true
@deprecate_stdlib getipaddr Sockets true
@deprecate_stdlib getpeername Sockets true
@deprecate_stdlib getsockname Sockets true
@deprecate_stdlib listen Sockets true
@deprecate_stdlib listenany Sockets true
@deprecate_stdlib recv Sockets true
@deprecate_stdlib recvfrom Sockets true
@deprecate_stdlib send Sockets true
@deprecate_stdlib TCPSocket Sockets true
@deprecate_stdlib UDPSocket Sockets true

@deprecate_stdlib cor Statistics true
@deprecate_stdlib cov Statistics true
@deprecate_stdlib std Statistics true
@deprecate_stdlib stdm Statistics true
@deprecate_stdlib var Statistics true
@deprecate_stdlib varm Statistics true
@deprecate_stdlib mean! Statistics true
@deprecate_stdlib mean Statistics true
@deprecate_stdlib median! Statistics true
@deprecate_stdlib median Statistics true
@deprecate_stdlib middle Statistics true
@deprecate_stdlib quantile! Statistics true
@deprecate_stdlib quantile Statistics true
end
end

Expand Down
48 changes: 1 addition & 47 deletions stdlib/Dates/src/deprecated.jl
Original file line number Diff line number Diff line change
@@ -1,49 +1,3 @@
# This file is a part of Julia. License is MIT: https://julialang.org/license

# 0.7 deprecations

import Base.(:)
import Base.range

# deprecate remaining vectorized methods from Dates
@deprecate(
DateTime(Y::AbstractArray{<:AbstractString}, f::AbstractString; locale::Locale=ENGLISH),
DateTime.(Y, f; locale=locale) )
@deprecate(
DateTime(Y::AbstractArray{<:AbstractString}, df::DateFormat=ISODateTimeFormat),
DateTime.(Y, df) )
@deprecate(
Date(Y::AbstractArray{<:AbstractString}, f::AbstractString; locale::Locale=ENGLISH),
Date.(Y, f; locale=locale) )
@deprecate(
Date(Y::AbstractArray{<:AbstractString}, df::DateFormat=ISODateFormat),
Date.(Y, df) )
@deprecate(
format(Y::AbstractArray{<:TimeType}, f::AbstractString; locale::Locale=ENGLISH),
format.(Y, f; locale=locale),
false )
@deprecate(
format(Y::AbstractArray{T}, df::DateFormat=default_format(T)) where {T<:TimeType},
format.(Y, df),
false )

@deprecate +(a::GeneralPeriod, b::StridedArray{<:GeneralPeriod}) broadcast(+, a, b) false
@deprecate +(a::StridedArray{<:GeneralPeriod}, b::GeneralPeriod) broadcast(+, a, b) false
@deprecate -(a::GeneralPeriod, b::StridedArray{<:GeneralPeriod}) broadcast(-, a, b) false
@deprecate -(a::StridedArray{<:GeneralPeriod}, b::GeneralPeriod) broadcast(-, a, b) false

# #24258
# Physical units define an equivalence class: there is no such thing as a step of "1" (is
# it one day or one second or one nanosecond?). So require the user to specify the step
# (in physical units).
@deprecate (:)(start::T, stop::T) where {T<:DateTime} start:Day(1):stop false
@deprecate (:)(start::T, stop::T) where {T<:Date} start:Day(1):stop false
@deprecate (:)(start::T, stop::T) where {T<:Time} start:Second(1):stop false

@deprecate range(start::DateTime, len::Integer) range(start, step=Day(1), length=len) false
@deprecate range(start::Date, len::Integer) range(start, step=Day(1), length=len) false

# PR #23724
@deprecate DateTime() DateTime(1)
@deprecate Date() Date(1)
@deprecate Time() Time(0)
# 1.0 deprecations
2 changes: 1 addition & 1 deletion stdlib/Dates/test/conversions.jl
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ end
end
end
@test Dates.Year(3) == Dates.Month(36)
#@test_throws MethodError Int(Dates.Month(36)) # re-enable when deprecation removed
@test_throws MethodError Int(Dates.Month(36))
@test Dates.Year(3) < Dates.Month(37)
@test_throws InexactError convert(Dates.Year, Dates.Month(37))
@test_throws InexactError Dates.Month(Dates.Year(typemax(Int64)))
Expand Down
4 changes: 0 additions & 4 deletions stdlib/DelimitedFiles/src/DelimitedFiles.jl
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,6 @@ import Base: tryparse_internal, show

export readdlm, writedlm

Base.@deprecate readcsv(io; opts...) readdlm(io, ','; opts...)
Base.@deprecate readcsv(io, T::Type; opts...) readdlm(io, ',', T; opts...)
Base.@deprecate writecsv(io, a; opts...) writedlm(io, a, ','; opts...)

invalid_dlm(::Type{Char}) = reinterpret(Char, 0xfffffffe)
invalid_dlm(::Type{UInt8}) = 0xfe
invalid_dlm(::Type{UInt16}) = 0xfffe
Expand Down
14 changes: 0 additions & 14 deletions stdlib/InteractiveUtils/src/InteractiveUtils.jl
Original file line number Diff line number Diff line change
Expand Up @@ -344,18 +344,4 @@ function peakflops(n::Integer=2000; parallel::Bool=false)
end
end

@deprecate methodswith(typ, supertypes) methodswith(typ, supertypes = supertypes)
@deprecate whos(io::IO, m::Module, pat::Regex) show(io, varinfo(m, pat))
@deprecate whos(io::IO, m::Module) show(io, varinfo(m))
@deprecate whos(io::IO) show(io, varinfo())
@deprecate whos(m::Module, pat::Regex) varinfo(m, pat)
@deprecate whos(m::Module) varinfo(m)
@deprecate whos(pat::Regex) varinfo(pat)
@deprecate whos() varinfo()
@deprecate code_native(io, f, types, syntax) code_native(io, f, types, syntax = syntax)
@deprecate code_native(f, types, syntax) code_native(f, types, syntax = syntax)
# PR #21974
@deprecate versioninfo(verbose::Bool) versioninfo(verbose=verbose)
@deprecate versioninfo(io::IO, verbose::Bool) versioninfo(io, verbose=verbose)

end
2 changes: 0 additions & 2 deletions stdlib/Serialization/src/Serialization.jl
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,6 @@ end

Serializer(io::IO) = Serializer{typeof(io)}(io)

@deprecate SerializationState Serializer

## serializing values ##

const n_int_literals = 33
Expand Down
10 changes: 0 additions & 10 deletions stdlib/SharedArrays/src/SharedArrays.jl
Original file line number Diff line number Diff line change
Expand Up @@ -686,14 +686,4 @@ shm_open(shm_seg_name, oflags, permissions) = ccall(:shm_open, Cint,

end # os-test

# 0.7 deprecations

@deprecate SharedArray(::Type{T}, dims::Dims{N}; kwargs...) where {T,N} SharedArray{T}(dims; kwargs...)
@deprecate SharedArray(::Type{T}, dims::Int...; kwargs...) where {T} SharedArray{T}(dims...; kwargs...)
@deprecate(SharedArray(filename::AbstractString, ::Type{T}, dims::NTuple{N,Int}, offset; kwargs...) where {T,N},
SharedArray{T}(filename, dims, offset; kwargs...))
@deprecate(SharedArray(filename::AbstractString, ::Type{T}, dims::NTuple, offset; kwargs...) where {T},
SharedArray{T}(filename, dims, offset; kwargs...))
@deprecate localindexes localindices

end # module
13 changes: 0 additions & 13 deletions stdlib/Sockets/src/Sockets.jl
Original file line number Diff line number Diff line change
Expand Up @@ -652,17 +652,4 @@ function __init__()
global uv_jl_connectcb = @cfunction(uv_connectcb, Cvoid, (Ptr{Cvoid}, Cint))
end

# deprecations

@deprecate convert(dt::Type{<:Integer}, ip::IPAddr) dt(ip)

@noinline function getaddrinfo(callback::Function, host::AbstractString)
Base.depwarn("`getaddrinfo` with a callback function is deprecated, wrap code in `@async` instead for deferred execution.", :getaddrinfo)
@async begin
r = getaddrinfo(host)
callback(r)
end
nothing
end

end
20 changes: 0 additions & 20 deletions stdlib/Statistics/src/Statistics.jl
Original file line number Diff line number Diff line change
Expand Up @@ -1000,24 +1000,4 @@ function centralize_sumabs2!(R::AbstractArray{S}, A::SparseMatrixCSC{Tv,Ti}, mea
return R
end


##### deprecations #####

# PR #21709
@deprecate cov(x::AbstractVector, corrected::Bool) cov(x, corrected=corrected)
@deprecate cov(x::AbstractMatrix, vardim::Int, corrected::Bool) cov(x, dims=vardim, corrected=corrected)
@deprecate cov(X::AbstractVector, Y::AbstractVector, corrected::Bool) cov(X, Y, corrected=corrected)
@deprecate cov(X::AbstractVecOrMat, Y::AbstractVecOrMat, vardim::Int, corrected::Bool) cov(X, Y, dims=vardim, corrected=corrected)

# issue #25501
@deprecate mean(A::AbstractArray, dims) mean(A, dims=dims)
@deprecate varm(A::AbstractArray, m::AbstractArray, dims; kwargs...) varm(A, m; kwargs..., dims=dims)
@deprecate var(A::AbstractArray, dims; kwargs...) var(A; kwargs..., dims=dims)
@deprecate std(A::AbstractArray, dims; kwargs...) std(A; kwargs..., dims=dims)
@deprecate cov(X::AbstractMatrix, dim::Int; kwargs...) cov(X; kwargs..., dims=dim)
@deprecate cov(x::AbstractVecOrMat, y::AbstractVecOrMat, dim::Int; kwargs...) cov(x, y; kwargs..., dims=dim)
@deprecate cor(X::AbstractMatrix, dim::Int) cor(X, dims=dim)
@deprecate cor(x::AbstractVecOrMat, y::AbstractVecOrMat, dim::Int) cor(x, y, dims=dim)
@deprecate median(A::AbstractArray, dims; kwargs...) median(A; kwargs..., dims=dims)

end # module

0 comments on commit cae40f2

Please sign in to comment.