From c980fda799c1d66070bf79ea1f464bec71139ab5 Mon Sep 17 00:00:00 2001 From: Martin Holters Date: Tue, 1 Oct 2019 17:13:34 +0200 Subject: [PATCH] Drop compat for `corrected` kw arg to `cov` from #401 --- README.md | 2 -- src/Compat.jl | 29 ----------------------------- test/runtests.jl | 14 -------------- 3 files changed, 45 deletions(-) diff --git a/README.md b/README.md index fc80fbc74..d301c024c 100644 --- a/README.md +++ b/README.md @@ -123,8 +123,6 @@ Currently, the `@compat` macro supports the following syntaxes: * `Base.rtoldefault` how takes a third parameter `atol`. The two argument form is deprecated in favor of the three arguments form with `atol=0`. -* The `corrected` optional argument of `cov` becomes a keyword argument of `Compat.Statistics.cov` ([#21709]). - * `isequal`, `==` and `in` have one argument "curried" forms. For example `isequal(x)` returns a function that compares its arguments to `x` using `isequal` ([#26436]). diff --git a/src/Compat.jl b/src/Compat.jl index 79dc9e219..908509736 100644 --- a/src/Compat.jl +++ b/src/Compat.jl @@ -22,35 +22,6 @@ end include("compatmacro.jl") -if VERSION < v"0.7.0-DEV.755" - # This is a hack to only add keyword signature that won't work on all julia versions. - # However, since we really only need to support a few (0.5, 0.6 and early 0.7) versions - # this should be good enough. - # TODO add deprecation warning to switch to StatsBase - let Tf = typeof(Base.cov), Tkw = Core.Core.kwftype(Tf) - @eval begin - @inline function _get_corrected(kws) - corrected = true - nkw = length(kws) >> 1 - for i in 1:nkw - if kws[i * 2 - 1] !== :corrected - Base.kwerr(kws) - end - corrected = kws[i * 2] - end - return corrected::Bool - end - (::$Tkw)(kws::Vector{Any}, ::$Tf, x::AbstractVector) = Base.cov(x, _get_corrected(kws)) - (::$Tkw)(kws::Vector{Any}, ::$Tf, X::AbstractVector, Y::AbstractVector) = - Base.cov(X, Y, _get_corrected(kws)) - (::$Tkw)(kws::Vector{Any}, ::$Tf, x::AbstractMatrix, vardim::Int) = - Base.cov(x, vardim, _get_corrected(kws)) - (::$Tkw)(kws::Vector{Any}, ::$Tf, X::AbstractVecOrMat, Y::AbstractVecOrMat, - vardim::Int) = Base.cov(X, Y, vardim, _get_corrected(kws)) - end - end -end - # 0.7.0-DEV.1415 @static if !isdefined(Base, :adjoint) const adjoint = ctranspose diff --git a/test/runtests.jl b/test/runtests.jl index b5c4e3c49..d981c2226 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -140,20 +140,6 @@ end @test isa(Base.rtoldefault(Float64, Float64, 0), Float64) @test Base.rtoldefault(Float64, Float64, 1.0) === 0.0 -# 0.7 -if VERSION < v"0.7.0-DEV.5238" - # Test the extended cov if cov is part of Base. In the future, this will be dealt with - # in StatsBase - @test cov([1 2; 3 4], 1, corrected=true) == fill(2.0, 2, 2) - @test cov([1 2; 3 4], 1, corrected=false) == fill(1.0, 2, 2) - @test cov([1 2; 3 4], [0 4; 8 9], 1, corrected=true) == [8.0 5.0; 8.0 5.0] - @test cov([1 2; 3 4], [0 4; 8 9], 1, corrected=false) == [4.0 2.5; 4.0 2.5] - @test cov([1, 2], corrected=true) === 0.5 - @test cov([1, 2], corrected=false) === 0.25 - @test cov([1, 2], [0, 10], corrected=true) === 5.0 - @test cov([1, 2], [0, 10], corrected=false) === 2.5 -end - # 0.7 module Test23876 using Compat