Skip to content

Commit

Permalink
Deprecate StatsBase (#135)
Browse files Browse the repository at this point in the history
* Deprecate StatsBase

* Mark an inferred test as broken
  • Loading branch information
timholy authored Sep 10, 2020
1 parent 42a9bf7 commit 208bc7e
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 4 deletions.
11 changes: 8 additions & 3 deletions src/ColorVectorSpace.jl
Original file line number Diff line number Diff line change
Expand Up @@ -299,9 +299,6 @@ varm(v::AbstractArray{C}, s::AbstractGray; corrected::Bool=true) where {C<:Abstr
varm(map(gray,v),gray(s); corrected=corrected)
real(::Type{C}) where {C<:AbstractGray} = real(eltype(C))

#histrange for Gray type
histrange(v::AbstractArray{Gray{T}}, n::Integer) where {T} = histrange(convert(Array{Float32}, map(gray, v)), n, :right)

# To help type inference
promote_rule(::Type{T}, ::Type{C}) where {T<:Real,C<:AbstractGray} = promote_type(T, eltype(C))

Expand Down Expand Up @@ -345,4 +342,12 @@ _precompile_()
@deprecate (*)(A::AbstractArray{T}, b::TransparentGray) where {T<:Number} A.*b
@deprecate (*)(b::TransparentGray, A::AbstractArray{T}) where {T<:Number} A.*b

## Deprecations

## From 2020-Sept-9
# Since ImageContrastAdjustment is now doing its own binning, I think this can be safely deprecated and we can eliminate
# the dependency on StatsBase.
import StatsBase: histrange
@deprecate histrange(v::AbstractArray{Gray{T}}, n::Integer) where {T} histrange(convert(Array{Float32}, map(gray, v)), n, :right)

end
6 changes: 5 additions & 1 deletion test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -374,7 +374,11 @@ end

@testset "Colors issue #326" begin
A = rand(RGB{N0f8}, 2, 2)
@test @inferred mean(A) == mean(map(c->mapc(FixedPointNumbers.Treduce, c), A))
if VERSION >= v"1.5"
@test_broken @inferred mean(A) == mean(map(c->mapc(FixedPointNumbers.Treduce, c), A))
else
@test @inferred mean(A) == mean(map(c->mapc(FixedPointNumbers.Treduce, c), A))
end
end
end

Expand Down

0 comments on commit 208bc7e

Please sign in to comment.