Skip to content

Commit 9021490

Browse files
committed
tweak optional dependencies
1 parent 946a98b commit 9021490

File tree

1 file changed

+9
-11
lines changed

1 file changed

+9
-11
lines changed

src/MLDatasets.jl

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -12,28 +12,28 @@ bytes_to_type(::Type{T}, A::Array{UInt8}) where T<:Number = convert(Array{T}, r
1212
global __images_supported__ = false
1313
global __matfiles_supported__ = false
1414

15-
function _channelview(image::AbstractArray{<:Color})
15+
function _channelview(image::AbstractArray{<:Colorant})
1616
__images_supported__ ||
17-
error("Converting to/from image requires ImageCore package.")
18-
channelview(image)
17+
error("Converting to/from image requires `using ImageCore`")
18+
ImageCore.channelview(image)
1919
end
2020

2121
function _colorview(::Type{T}, array::AbstractArray{<:Number}) where T <: Color
2222
__images_supported__ ||
23-
error("Converting to image requires ImageCore package.")
24-
colorview(T, array)
23+
error("Converting to image requires `using ImageCore`")
24+
ImageCore.colorview(T, array)
2525
end
2626

2727
function _matopen(f::Function, path::AbstractString)
2828
__matfiles_supported__ ||
29-
error("Reading .mat files requires MAT package.")
30-
matopen(f, path)
29+
error("Reading .mat files requires `using MAT`")
30+
MAT.matopen(f, path)
3131
end
3232

3333
function _matread(path::AbstractString)
3434
__matfiles_supported__ ||
35-
error("Reading .mat files requires MAT package.")
36-
matread(path)
35+
error("Reading .mat files requires `using MAT`")
36+
MAT.matread(path)
3737
end
3838

3939

@@ -51,11 +51,9 @@ include("UD_English/UD_English.jl")
5151
function __init__()
5252
# initialize optional dependencies
5353
@require ImageCore="a09fc81d-aa75-5fe9-8630-4744c3626534" begin
54-
using ImageCore
5554
global __images_supported__ = true
5655
end
5756
@require MAT="23992714-dd62-5051-b70f-ba57cb901cac" begin
58-
using MAT
5957
global __matfiles_supported__ = true
6058
end
6159
end

0 commit comments

Comments
 (0)