diff --git a/base/deprecated.jl b/base/deprecated.jl index 26ed3243c4ee05..d1a3d05b7820ee 100644 --- a/base/deprecated.jl +++ b/base/deprecated.jl @@ -225,6 +225,7 @@ for f in (:sin, :sinh, :sind, :asin, :asinh, :asind, :cot, :coth, :cotd, :acot, :acotd, :sec, :sech, :secd, :asech, :csc, :csch, :cscd, :acsch) + @eval import .Math: $f @eval @deprecate $f(A::SparseMatrixCSC) $f.(A) end @@ -259,6 +260,7 @@ for f in ( # base/complex.jl :cis, ) + @eval import .Math: $f @eval @dep_vectorize_1arg Number $f end # base/fastmath.jl @@ -267,13 +269,15 @@ for f in ( :acos_fast, :acosh_fast, :angle_fast, :asin_fast, :asinh_fast, :cosh_fast, :exp10_fast, :exp2_fast, :exp_fast, :expm1_fast, :lgamma_fast, :log10_fast, :log1p_fast, :log2_fast, :log_fast, :sin_fast, :sinh_fast, :sqrt_fast, :tan_fast, :tanh_fast ) - @eval FastMath Base.@dep_vectorize_1arg Number $f + @eval import .FastMath: $f + @eval @dep_vectorize_1arg Number $f end for f in ( :trunc, :floor, :ceil, :round, # base/floatfuncs.jl :rad2deg, :deg2rad, :exponent, :significand, # base/math.jl :sind, :cosd, :tand, :asind, :acosd, :atand, :asecd, :acscd, :acotd, # base/special/trig.jl ) + @eval import .Math: $f @eval @dep_vectorize_1arg Real $f end # base/complex.jl @@ -312,11 +316,13 @@ for f in ( # base/math.jl :log, :hypot, :atan2, ) + @eval import .Math: $f @eval @dep_vectorize_2arg Number $f end # base/fastmath.jl for f in (:pow_fast, :atan2_fast, :hypot_fast, :max_fast, :min_fast, :minmax_fast) - @eval FastMath Base.@dep_vectorize_2arg Number $f + @eval import .FastMath: $f + @eval @dep_vectorize_2arg Number $f end for f in ( :max, :min, # base/math.jl @@ -737,6 +743,7 @@ end for f in (:sec, :sech, :secd, :asec, :asech, :csc, :csch, :cscd, :acsc, :acsch, :cot, :coth, :cotd, :acot, :acoth) + @eval import .Math: $f @eval @deprecate $f(A::AbstractArray{<:Number}) $f.(A) end @@ -746,6 +753,7 @@ end @deprecate complex(A::AbstractArray, B::AbstractArray) complex.(A, B) # Deprecate manually vectorized clamp methods in favor of compact broadcast syntax +import .Math: clamp @deprecate clamp(A::AbstractArray, lo, hi) clamp.(A, lo, hi) # Deprecate manually vectorized round methods in favor of compact broadcast syntax @@ -845,7 +853,7 @@ end @deprecate ~(A::AbstractArray) .~A @deprecate ~(B::BitArray) .~B -function frexp(A::Array{<:AbstractFloat}) +function Math.frexp(A::Array{<:AbstractFloat}) depwarn(string("`frexp(x::Array)` is discontinued. Though not a direct replacement, ", "consider using dot-syntax to `broadcast` scalar `frexp` over `Array`s ", "instead, for example `frexp.(rand(4))`."), :frexp) @@ -1235,6 +1243,7 @@ end for name in ("alnum", "alpha", "cntrl", "digit", "number", "graph", "lower", "print", "punct", "space", "upper", "xdigit") f = Symbol("is",name) + @eval import .UTF8proc: $f @eval @deprecate ($f)(s::AbstractString) all($f, s) end @@ -1296,9 +1305,11 @@ next(p::Union{Process, ProcessChain}, i::Int) = (getindex(p, i), i + 1) return i == 1 ? getfield(p, p.openstream) : p end +import .LinAlg: cond @deprecate cond(F::LinAlg.LU, p::Integer) cond(full(F), p) # PR #21359 +import .Random: srand @deprecate srand(r::MersenneTwister, filename::AbstractString, n::Integer=4) srand(r, read!(filename, Array{UInt32}(Int(n)))) @deprecate srand(filename::AbstractString, n::Integer=4) srand(read!(filename, Array{UInt32}(Int(n)))) @deprecate MersenneTwister(filename::AbstractString) srand(MersenneTwister(0), read!(filename, Array{UInt32}(Int(4)))) @@ -1308,6 +1319,7 @@ end @deprecate versioninfo(io::IO, verbose::Bool) versioninfo(io, verbose=verbose) # PR #22188 +import .LinAlg: cholfact, cholfact! @deprecate cholfact!(A::StridedMatrix, uplo::Symbol, ::Type{Val{false}}) cholfact!(Hermitian(A, uplo), Val(false)) @deprecate cholfact!(A::StridedMatrix, uplo::Symbol) cholfact!(Hermitian(A, uplo)) @deprecate cholfact(A::StridedMatrix, uplo::Symbol, ::Type{Val{false}}) cholfact(Hermitian(A, uplo), Val(false)) @@ -1316,6 +1328,7 @@ end @deprecate cholfact(A::StridedMatrix, uplo::Symbol, ::Type{Val{true}}; tol = 0.0) cholfact(Hermitian(A, uplo), Val(true), tol = tol) # PR #22245 +import .LinAlg: isposdef, isposdef! @deprecate isposdef(A::AbstractMatrix, UL::Symbol) isposdef(Hermitian(A, UL)) @deprecate isposdef!(A::StridedMatrix, UL::Symbol) isposdef!(Hermitian(A, UL)) @@ -1425,6 +1438,7 @@ export conv, conv2, deconv, filt, filt!, xcorr @deprecate cov(X::AbstractVecOrMat, Y::AbstractVecOrMat, vardim::Int, corrected::Bool) cov(X, Y, vardim, corrected=corrected) # bkfact +import .LinAlg: bkfact, bkfact! function bkfact(A::StridedMatrix, uplo::Symbol, symmetric::Bool = issymmetric(A), rook::Bool = false) depwarn("bkfact with uplo and symmetric arguments deprecated. Please use bkfact($(symmetric ? "Symmetric(" : "Hermitian(")A, :$uplo))", :bkfact) @@ -1458,6 +1472,7 @@ end @deprecate literal_pow(a, b, ::Type{Val{N}}) where {N} literal_pow(a, b, Val(N)) false @eval IteratorsMD @deprecate split(t, V::Type{Val{n}}) where {n} split(t, Val(n)) false @deprecate sqrtm(A::UpperTriangular{T},::Type{Val{realmatrix}}) where {T,realmatrix} sqrtm(A, Val(realmatrix)) +import .LinAlg: lufact, lufact!, qrfact, qrfact!, cholfact, cholfact! @deprecate lufact(A::AbstractMatrix, ::Type{Val{false}}) lufact(A, Val(false)) @deprecate lufact(A::AbstractMatrix, ::Type{Val{true}}) lufact(A, Val(true)) @deprecate lufact!(A::AbstractMatrix, ::Type{Val{false}}) lufact!(A, Val(false)) @@ -1688,6 +1703,7 @@ export hex2num @deprecate cfunction(f, r, a::Tuple) cfunction(f, r, Tuple{a...}) # PR 23341 +import .LinAlg: diagm @deprecate diagm(A::SparseMatrixCSC) spdiagm(sparsevec(A)) # PR #23373 diff --git a/base/pkg/entry.jl b/base/pkg/entry.jl index 6dc47473cd17b1..b480645e41f649 100644 --- a/base/pkg/entry.jl +++ b/base/pkg/entry.jl @@ -4,8 +4,7 @@ module Entry import Base: thispatch, nextpatch, nextminor, nextmajor, check_new_version import ..Reqs, ..Read, ..Query, ..Resolve, ..Cache, ..Write, ..Dir -import ...LibGit2 -importall ...LibGit2 +using ...LibGit2 import ...Pkg.PkgError using ..Types diff --git a/base/pkg/write.jl b/base/pkg/write.jl index ffc2c6f84fb508..bf5078a05c0ea4 100644 --- a/base/pkg/write.jl +++ b/base/pkg/write.jl @@ -2,8 +2,8 @@ module Write -import ...LibGit2, ..Cache, ..Read, ...Pkg.PkgError -importall ...LibGit2 +import ..Cache, ..Read, ...Pkg.PkgError +using ...LibGit2 function prefetch(pkg::AbstractString, sha1::AbstractString) isempty(Cache.prefetch(pkg, Read.url(pkg), sha1)) && return diff --git a/base/sharedarray.jl b/base/sharedarray.jl index 479eee1bcc898f..366a0d59eb9fbe 100644 --- a/base/sharedarray.jl +++ b/base/sharedarray.jl @@ -1,7 +1,7 @@ # This file is a part of Julia. License is MIT: https://julialang.org/license import .Serializer: serialize_cycle_header, serialize_type, writetag, UNDEFREF_TAG -import .Distributed: RRID +import .Distributed: RRID, procs mutable struct SharedArray{T,N} <: DenseArray{T,N} id::RRID diff --git a/base/sparse/cholmod.jl b/base/sparse/cholmod.jl index 062144d3b2be7f..4d5e7188eb5ae0 100644 --- a/base/sparse/cholmod.jl +++ b/base/sparse/cholmod.jl @@ -9,14 +9,15 @@ import Base.LinAlg: (\), A_mul_Bc, A_mul_Bt, Ac_ldiv_B, Ac_mul_B, At_ldiv_B, At_ cholfact, cholfact!, det, diag, ishermitian, isposdef, issuccess, issymmetric, ldltfact, ldltfact!, logdet -importall ..SparseArrays +using ..SparseArrays export Dense, Factor, Sparse -import ..SparseArrays: AbstractSparseMatrix, SparseMatrixCSC, increment, indtype +import ..SparseArrays: AbstractSparseMatrix, SparseMatrixCSC, increment, indtype, sparse, speye, + spzeros, nnz ######### # Setup # diff --git a/base/sparse/umfpack.jl b/base/sparse/umfpack.jl index 61cc9bf79baa5c..7f7177c55c37c7 100644 --- a/base/sparse/umfpack.jl +++ b/base/sparse/umfpack.jl @@ -7,7 +7,7 @@ export UmfpackLU import Base: (\), Ac_ldiv_B, At_ldiv_B, findnz, getindex, show, size import Base.LinAlg: A_ldiv_B!, Ac_ldiv_B!, At_ldiv_B!, Factorization, det, lufact -importall ..SparseArrays +using ..SparseArrays import ..SparseArrays: increment, increment!, decrement, decrement!, nnz include("umfpack_h.jl") diff --git a/base/strings/strings.jl b/base/strings/strings.jl index bc1f302b7a6ad6..0acad00f79ca76 100644 --- a/base/strings/strings.jl +++ b/base/strings/strings.jl @@ -7,4 +7,4 @@ include("strings/search.jl") include("strings/util.jl") include("strings/io.jl") include("strings/utf8proc.jl") -importall .UTF8proc +using .UTF8proc diff --git a/base/sysimg.jl b/base/sysimg.jl index 676fb70a6ee53a..6c6a3213ba60c5 100644 --- a/base/sysimg.jl +++ b/base/sysimg.jl @@ -95,7 +95,7 @@ include("operators.jl") include("pointer.jl") include("refpointer.jl") include("checked.jl") -importall .Checked +using .Checked # buggy handling of ispure in type-inference means this should be # after re-defining the basic operations that they might try to call @@ -132,7 +132,7 @@ Matrix(m::Integer, n::Integer) = Matrix{Any}(Int(m), Int(n)) # numeric operations include("hashing.jl") include("rounding.jl") -importall .Rounding +using .Rounding include("float.jl") include("twiceprecision.jl") include("complex.jl") @@ -153,7 +153,7 @@ include("strings/string.jl") # SIMD loops include("simdloop.jl") -importall .SimdLoop +using .SimdLoop # map-reduce operators include("reduce.jl") @@ -219,7 +219,7 @@ using .PermutedDimsArrays include("nullable.jl") include("broadcast.jl") -importall .Broadcast +using .Broadcast # define the real ntuple functions @generated function ntuple(f::F, ::Val{N}) where {F,N} @@ -242,7 +242,7 @@ end # base64 conversions (need broadcast) include("base64.jl") -importall .Base64 +using .Base64 # version include("version.jl") @@ -267,10 +267,10 @@ include("weakkeydict.jl") include("stream.jl") include("socket.jl") include("filesystem.jl") -importall .Filesystem +using .Filesystem include("process.jl") include("multimedia.jl") -importall .Multimedia +using .Multimedia include("grisu/grisu.jl") import .Grisu.print_shortest include("methodshow.jl") @@ -278,7 +278,8 @@ include("methodshow.jl") # core math functions include("floatfuncs.jl") include("math.jl") -importall .Math +using .Math +import .Math: gamma const (√)=sqrt const (∛)=cbrt @@ -289,21 +290,21 @@ include("reducedim.jl") # macros in this file relies on string.jl # basic data structures include("ordering.jl") -importall .Order +using .Order # Combinatorics include("sort.jl") -importall .Sort +using .Sort # Fast math include("fastmath.jl") -importall .FastMath +using .FastMath function deepcopy_internal end # BigInts and BigFloats include("gmp.jl") -importall .GMP +using .GMP for T in [Signed, Integer, BigInt, Float32, Float64, Real, Complex, Rational] @eval flipsign(x::$T, ::Unsigned) = +x @@ -311,7 +312,7 @@ for T in [Signed, Integer, BigInt, Float32, Float64, Real, Complex, Rational] end include("mpfr.jl") -importall .MPFR +using .MPFR big(n::Integer) = convert(BigInt,n) big(x::AbstractFloat) = convert(BigFloat,x) big(q::Rational) = big(numerator(q))//big(denominator(q)) @@ -329,22 +330,24 @@ using .MathConstants: ℯ, π, pi # random number generation include("random/dSFMT.jl") include("random/random.jl") -importall .Random +using .Random +import .Random: rand, rand! # (s)printf macros include("printf.jl") -importall .Printf +using .Printf # metaprogramming include("meta.jl") # enums include("Enums.jl") -importall .Enums +using .Enums # concurrency and parallelism include("serialize.jl") -importall .Serializer +using .Serializer +import .Serializer: serialize, deserialize include("channels.jl") # memory-mapped and shared arrays @@ -353,7 +356,7 @@ import .Mmap # utilities - timing, help, edit include("datafmt.jl") -importall .DataFmt +using .DataFmt include("deepcopy.jl") include("interactiveutil.jl") include("summarysize.jl") @@ -372,14 +375,14 @@ include("client.jl") # Stack frames and traces include("stacktraces.jl") -importall .StackTraces +using .StackTraces # misc useful functions & macros include("util.jl") # dense linear algebra include("linalg/linalg.jl") -importall .LinAlg +using .LinAlg const ⋅ = dot const × = cross @@ -394,7 +397,7 @@ include("pkg/pkg.jl") # profiler include("profile.jl") -importall .Profile +using .Profile # dates include("dates/Dates.jl") @@ -402,12 +405,12 @@ import .Dates: Date, DateTime, DateFormat, @dateformat_str, now # sparse matrices, vectors, and sparse linear algebra include("sparse/sparse.jl") -importall .SparseArrays +using .SparseArrays include("asyncmap.jl") include("distributed/Distributed.jl") -importall .Distributed +using .Distributed include("sharedarray.jl") # code loading