Merge pull request #1634 from mkborregaard/master

replace warn -> @warn
This commit is contained in:
Michael Krabbe Borregaard 2018-08-10 18:16:37 +01:00 committed by GitHub
commit 340cd0a1fe
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
15 changed files with 45 additions and 45 deletions

View File

@ -194,7 +194,7 @@ function hasgrid(arg::Symbol, letter)
if arg in _allGridSyms if arg in _allGridSyms
arg in (:all, :both, :on) || occursin(string(letter), string(arg)) arg in (:all, :both, :on) || occursin(string(letter), string(arg))
else else
warn("Unknown grid argument $arg; $(Symbol(letter, :grid)) was set to `true` instead.") @warn("Unknown grid argument $arg; $(Symbol(letter, :grid)) was set to `true` instead.")
true true
end end
end end
@ -212,7 +212,7 @@ function showaxis(arg::Symbol, letter)
if arg in _allGridSyms if arg in _allGridSyms
arg in (:all, :both, :on, :yes) || occursin(string(letter), string(arg)) arg in (:all, :both, :on, :yes) || occursin(string(letter), string(arg))
else else
warn("Unknown showaxis argument $arg; $(Symbol(letter, :showaxis)) was set to `true` instead.") @warn("Unknown showaxis argument $arg; $(Symbol(letter, :showaxis)) was set to `true` instead.")
true true
end end
end end
@ -704,7 +704,7 @@ function processLineArg(d::KW, arg)
# color # color
elseif !handleColors!(d, arg, :linecolor) elseif !handleColors!(d, arg, :linecolor)
warn("Skipped line arg $arg.") @warn("Skipped line arg $arg.")
end end
end end
@ -740,7 +740,7 @@ function processMarkerArg(d::KW, arg)
# markercolor # markercolor
elseif !handleColors!(d, arg, :markercolor) elseif !handleColors!(d, arg, :markercolor)
warn("Skipped marker arg $arg.") @warn("Skipped marker arg $arg.")
end end
end end
@ -800,7 +800,7 @@ function processGridArg!(d::KW, arg, letter)
# color # color
elseif !handleColors!(d, arg, Symbol(letter, :foreground_color_grid)) elseif !handleColors!(d, arg, Symbol(letter, :foreground_color_grid))
warn("Skipped grid arg $arg.") @warn("Skipped grid arg $arg.")
end end
end end
@ -834,7 +834,7 @@ function processMinorGridArg!(d::KW, arg, letter)
elseif handleColors!(d, arg, Symbol(letter, :foreground_color_minor_grid)) elseif handleColors!(d, arg, Symbol(letter, :foreground_color_minor_grid))
d[Symbol(letter, :minorgrid)] = true d[Symbol(letter, :minorgrid)] = true
else else
warn("Skipped grid arg $arg.") @warn("Skipped grid arg $arg.")
end end
end end
@ -867,7 +867,7 @@ function processFontArg!(d::KW, fontname::Symbol, arg)
elseif typeof(arg) <: Real elseif typeof(arg) <: Real
d[Symbol(fontname, :rotation)] = convert(Float64, arg) d[Symbol(fontname, :rotation)] = convert(Float64, arg)
else else
warn("Skipped font arg: $arg ($(typeof(arg)))") @warn("Skipped font arg: $arg ($(typeof(arg)))")
end end
end end
@ -1050,7 +1050,7 @@ function preprocessArgs!(d::KW)
# warnings for moved recipes # warnings for moved recipes
st = get(d, :seriestype, :path) st = get(d, :seriestype, :path)
if st in (:boxplot, :violin, :density) && !isdefined(Main, :StatPlots) if st in (:boxplot, :violin, :density) && !isdefined(Main, :StatPlots)
warn("seriestype $st has been moved to StatPlots. To use: \`Pkg.add(\"StatPlots\"); using StatPlots\`") @warn("seriestype $st has been moved to StatPlots. To use: \`Pkg.add(\"StatPlots\"); using StatPlots\`")
end end
return return
@ -1070,7 +1070,7 @@ function extractGroupArgs(v::AVec, args...; legendEntry = string)
groupLabels = sort(collect(unique(v))) groupLabels = sort(collect(unique(v)))
n = length(groupLabels) n = length(groupLabels)
if n > 100 if n > 100
warn("You created n=$n groups... Is that intended?") @warn("You created n=$n groups... Is that intended?")
end end
groupIds = Vector{Int}[filter(i -> v[i] == glab, 1:length(v)) for glab in groupLabels] groupIds = Vector{Int}[filter(i -> v[i] == glab, 1:length(v)) for glab in groupLabels]
GroupBy(map(legendEntry, groupLabels), groupIds) GroupBy(map(legendEntry, groupLabels), groupIds)
@ -1142,7 +1142,7 @@ function warnOnUnsupported_args(pkg::AbstractBackend, d::KW)
if !isempty(_to_warn) if !isempty(_to_warn)
for k in sort(collect(_to_warn)) for k in sort(collect(_to_warn))
push!(already_warned, k) push!(already_warned, k)
warn("Keyword argument $k not supported with $pkg. Choose from: $(supported_attrs(pkg))") @warn("Keyword argument $k not supported with $pkg. Choose from: $(supported_attrs(pkg))")
end end
end end
end end
@ -1153,13 +1153,13 @@ end
function warnOnUnsupported(pkg::AbstractBackend, d::KW) function warnOnUnsupported(pkg::AbstractBackend, d::KW)
if !is_seriestype_supported(pkg, d[:seriestype]) if !is_seriestype_supported(pkg, d[:seriestype])
warn("seriestype $(d[:seriestype]) is unsupported with $pkg. Choose from: $(supported_seriestypes(pkg))") @warn("seriestype $(d[:seriestype]) is unsupported with $pkg. Choose from: $(supported_seriestypes(pkg))")
end end
if !is_style_supported(pkg, d[:linestyle]) if !is_style_supported(pkg, d[:linestyle])
warn("linestyle $(d[:linestyle]) is unsupported with $pkg. Choose from: $(supported_styles(pkg))") @warn("linestyle $(d[:linestyle]) is unsupported with $pkg. Choose from: $(supported_styles(pkg))")
end end
if !is_marker_supported(pkg, d[:markershape]) if !is_marker_supported(pkg, d[:markershape])
warn("markershape $(d[:markershape]) is unsupported with $pkg. Choose from: $(supported_markers(pkg))") @warn("markershape $(d[:markershape]) is unsupported with $pkg. Choose from: $(supported_markers(pkg))")
end end
end end
@ -1168,7 +1168,7 @@ function warnOnUnsupported_scales(pkg::AbstractBackend, d::KW)
if haskey(d, k) if haskey(d, k)
v = d[k] v = d[k]
if !is_scale_supported(pkg, v) if !is_scale_supported(pkg, v)
warn("scale $v is unsupported with $pkg. Choose from: $(supported_scales(pkg))") @warn("scale $v is unsupported with $pkg. Choose from: $(supported_scales(pkg))")
end end
end end
end end

View File

@ -80,7 +80,7 @@ function process_axis_arg!(d::KW, arg, letter = "")
d[Symbol(letter,:formatter)] = arg d[Symbol(letter,:formatter)] = arg
elseif !handleColors!(d, arg, Symbol(letter, :foreground_color_axis)) elseif !handleColors!(d, arg, Symbol(letter, :foreground_color_axis))
warn("Skipped $(letter)axis arg $arg") @warn("Skipped $(letter)axis arg $arg")
end end
end end

View File

@ -217,7 +217,7 @@ const _deprecated_backends = [:qwt, :winston, :bokeh, :gadfly, :immerse]
function warn_on_deprecated_backend(bsym::Symbol) function warn_on_deprecated_backend(bsym::Symbol)
if bsym in _deprecated_backends if bsym in _deprecated_backends
warn("Backend $bsym has been deprecated. It may not work as originally intended.") @warn("Backend $bsym has been deprecated. It may not work as originally intended.")
end end
end end

View File

@ -1300,7 +1300,7 @@ function gl_poly(points, kw_args)
if !isempty(GeometryTypes.faces(mesh)) # check if polygonation has any faces if !isempty(GeometryTypes.faces(mesh)) # check if polygonation has any faces
push!(result, GLVisualize.visualize(mesh, Style(:default), kw_args)) push!(result, GLVisualize.visualize(mesh, Style(:default), kw_args))
else else
warn("Couldn't draw the polygon: $points") @warn("Couldn't draw the polygon: $points")
end end
end end
result result

View File

@ -225,7 +225,7 @@ end
function _display(plt::Plot{HDF5Backend}) function _display(plt::Plot{HDF5Backend})
msg = "HDF5 interface does not support `display()` function." msg = "HDF5 interface does not support `display()` function."
msg *= "\nUse `Plots.hdf5plot_write(::String)` method to write to .HDF5 \"plot\" file instead." msg *= "\nUse `Plots.hdf5plot_write(::String)` method to write to .HDF5 \"plot\" file instead."
warn(msg) @warn(msg)
return return
end end
@ -293,7 +293,7 @@ end
#= #=
function _hdf5plot_gwrite(grp, k::String, v::Array{Any}) function _hdf5plot_gwrite(grp, k::String, v::Array{Any})
# @show grp, k # @show grp, k
warn("Cannot write Array: $k=$v") @warn("Cannot write Array: $k=$v")
end end
=# =#
function _hdf5plot_gwrite(grp, k::String, v::Nothing) function _hdf5plot_gwrite(grp, k::String, v::Nothing)
@ -323,7 +323,7 @@ function _hdf5plot_gwrite(grp, k::String, v::Tuple)
#NOTE: _hdf5plot_overwritetype overwrites "Array" type with "Tuple". #NOTE: _hdf5plot_overwritetype overwrites "Array" type with "Tuple".
end end
function _hdf5plot_gwrite(grp, k::String, d::Dict) function _hdf5plot_gwrite(grp, k::String, d::Dict)
# warn("Cannot write dict: $k=$d") # @warn("Cannot write dict: $k=$d")
end end
function _hdf5plot_gwrite(grp, k::String, v::AbstractRange) function _hdf5plot_gwrite(grp, k::String, v::AbstractRange)
_hdf5plot_gwrite(grp, k, collect(v)) #For now _hdf5plot_gwrite(grp, k, collect(v)) #For now
@ -586,7 +586,7 @@ function _hdf5plot_read(grp, d::Dict)
catch e catch e
@show e @show e
@show grp @show grp
warn("Could not read field $k") @warn("Could not read field $k")
end end
end end
return return

View File

@ -103,7 +103,7 @@ function pgf_framestyle(style::Symbol)
return style return style
else else
default_style = get(_pgf_framestyle_defaults, style, :axes) default_style = get(_pgf_framestyle_defaults, style, :axes)
warn("Framestyle :$style is not (yet) supported by the PGFPlots backend. :$default_style was cosen instead.") @warn("Framestyle :$style is not (yet) supported by the PGFPlots backend. :$default_style was cosen instead.")
default_style default_style
end end
end end

View File

@ -64,7 +64,7 @@ function _plotly_framestyle(style::Symbol)
return style return style
else else
default_style = get(_plotly_framestyle_defaults, style, :axes) default_style = get(_plotly_framestyle_defaults, style, :axes)
warn("Framestyle :$style is not supported by Plotly and PlotlyJS. :$default_style was cosen instead.") @warn("Framestyle :$style is not supported by Plotly and PlotlyJS. :$default_style was cosen instead.")
default_style default_style
end end
end end
@ -618,7 +618,7 @@ function plotly_series(plt::Plot, series::Series)
d_out[:hoverinfo] = "label+percent+name" d_out[:hoverinfo] = "label+percent+name"
else else
warn("Plotly: seriestype $st isn't supported.") @warn("Plotly: seriestype $st isn't supported.")
return KW() return KW()
end end
@ -731,7 +731,7 @@ function plotly_series_segments(series::Series, d_base::KW, x, y, z)
d_out[:fill] = "tonexty" d_out[:fill] = "tonexty"
d_out[:fillcolor] = rgba_string(plot_color(get_fillcolor(series, i), get_fillalpha(series, i))) d_out[:fillcolor] = rgba_string(plot_color(get_fillcolor(series, i), get_fillalpha(series, i)))
elseif !(series[:fillrange] in (false, nothing)) elseif !(series[:fillrange] in (false, nothing))
warn("fillrange ignored... plotly only supports filling to zero and to a vector of values. fillrange: $(series[:fillrange])") @warn("fillrange ignored... plotly only supports filling to zero and to a vector of values. fillrange: $(series[:fillrange])")
end end
d_out[:x], d_out[:y] = x[rng], y[rng] d_out[:x], d_out[:y] = x[rng], y[rng]

View File

@ -74,7 +74,7 @@ pyart3d = PyPlot.art3D
# "support" matplotlib v1.5 # "support" matplotlib v1.5
set_facecolor_sym = if PyPlot.version < v"2" set_facecolor_sym = if PyPlot.version < v"2"
warn("You are using Matplotlib $(PyPlot.version), which is no longer officialy supported by the Plots community. To ensure smooth Plots.jl integration update your Matplotlib library to a version >= 2.0.0") @warn("You are using Matplotlib $(PyPlot.version), which is no longer officialy supported by the Plots community. To ensure smooth Plots.jl integration update your Matplotlib library to a version >= 2.0.0")
:set_axis_bgcolor :set_axis_bgcolor
else else
:set_facecolor :set_facecolor
@ -130,7 +130,7 @@ function py_linestyle(seriestype::Symbol, linestyle::Symbol)
linestyle == :dash && return "--" linestyle == :dash && return "--"
linestyle == :dot && return ":" linestyle == :dot && return ":"
linestyle == :dashdot && return "-." linestyle == :dashdot && return "-."
warn("Unknown linestyle $linestyle") @warn("Unknown linestyle $linestyle")
return "-" return "-"
end end
@ -191,13 +191,13 @@ function py_marker(marker::Symbol)
marker == :vline && return "|" marker == :vline && return "|"
haskey(_shapes, marker) && return py_marker(_shapes[marker]) haskey(_shapes, marker) && return py_marker(_shapes[marker])
warn("Unknown marker $marker") @warn("Unknown marker $marker")
return "o" return "o"
end end
# py_marker(markers::AVec) = map(py_marker, markers) # py_marker(markers::AVec) = map(py_marker, markers)
function py_marker(markers::AVec) function py_marker(markers::AVec)
warn("Vectors of markers are currently unsupported in PyPlot: $markers") @warn("Vectors of markers are currently unsupported in PyPlot: $markers")
py_marker(markers[1]) py_marker(markers[1])
end end
@ -514,7 +514,7 @@ function py_add_series(plt::Plot{PyPlotBackend}, series::Series)
a = series[:arrow] a = series[:arrow]
if a != nothing && !is3d(st) # TODO: handle 3d later if a != nothing && !is3d(st) # TODO: handle 3d later
if typeof(a) != Arrow if typeof(a) != Arrow
warn("Unexpected type for arrow: $(typeof(a))") @warn("Unexpected type for arrow: $(typeof(a))")
else else
arrowprops = KW( arrowprops = KW(
:arrowstyle => "simple,head_length=$(a.headlength),head_width=$(a.headwidth)", :arrowstyle => "simple,head_length=$(a.headlength),head_width=$(a.headwidth)",
@ -884,7 +884,7 @@ end
function py_set_scale(ax, axis::Axis) function py_set_scale(ax, axis::Axis)
scale = axis[:scale] scale = axis[:scale]
letter = axis[:letter] letter = axis[:letter]
scale in supported_scales() || return warn("Unhandled scale value in pyplot: $scale") scale in supported_scales() || return @warn("Unhandled scale value in pyplot: $scale")
func = ax[Symbol("set_", letter, "scale")] func = ax[Symbol("set_", letter, "scale")]
kw = KW() kw = KW()
arg = if scale == :identity arg = if scale == :identity

View File

@ -297,7 +297,7 @@ function font(args...)
elseif typeof(arg) <: Real elseif typeof(arg) <: Real
rotation = convert(Float64, arg) rotation = convert(Float64, arg)
else else
warn("Unused font arg: $arg ($(typeof(arg)))") @warn("Unused font arg: $arg ($(typeof(arg)))")
end end
end end
@ -396,7 +396,7 @@ function stroke(args...; alpha = nothing)
elseif allReals(arg) elseif allReals(arg)
width = arg width = arg
else else
warn("Unused stroke arg: $arg ($(typeof(arg)))") @warn("Unused stroke arg: $arg ($(typeof(arg)))")
end end
end end
@ -429,7 +429,7 @@ function brush(args...; alpha = nothing)
elseif allReals(arg) elseif allReals(arg)
size = arg size = arg
else else
warn("Unused brush arg: $arg ($(typeof(arg)))") @warn("Unused brush arg: $arg ($(typeof(arg)))")
end end
end end
@ -460,7 +460,7 @@ function series_annotations(strs::AbstractVector, args...)
elseif is_2tuple(arg) elseif is_2tuple(arg)
scalefactor = arg scalefactor = arg
else else
warn("Unused SeriesAnnotations arg: $arg ($(typeof(arg)))") @warn("Unused SeriesAnnotations arg: $arg ($(typeof(arg)))")
end end
end end
# if scalefactor != 1 # if scalefactor != 1
@ -704,7 +704,7 @@ function arrow(args...)
elseif T <: Tuple && length(arg) == 2 elseif T <: Tuple && length(arg) == 2
headlength, headwidth = Float64(arg[1]), Float64(arg[2]) headlength, headwidth = Float64(arg[1]), Float64(arg[2])
else else
warn("Skipped arrow arg $arg") @warn("Skipped arrow arg $arg")
end end
end end
Arrow(style, side, headlength, headwidth) Arrow(style, side, headlength, headwidth)

View File

@ -197,7 +197,7 @@ function getGadflyMarkerTheme(d::KW, attr::KW)
ms = d[:markersize] ms = d[:markersize]
ms = if typeof(ms) <: AVec ms = if typeof(ms) <: AVec
warn("Gadfly doesn't support variable marker sizes... using the average: $(mean(ms))") @warn("Gadfly doesn't support variable marker sizes... using the average: $(mean(ms))")
mean(ms) * Gadfly.px mean(ms) * Gadfly.px
else else
ms * Gadfly.px ms * Gadfly.px

View File

@ -150,7 +150,7 @@ function updateLimsAndTicks(plt::Plot{QwtBackend}, d::KW, isx::Bool)
end end
w[:setAxisScale](axisid, float(minimum(ticks)), float(maximum(ticks)), float(step(ticks))) w[:setAxisScale](axisid, float(minimum(ticks)), float(maximum(ticks)), float(step(ticks)))
elseif !(ticks in (nothing, :none, :auto)) elseif !(ticks in (nothing, :none, :auto))
warn("Only Range types are supported for Qwt xticks/yticks. typeof(ticks)=$(typeof(ticks))") @warn("Only Range types are supported for Qwt xticks/yticks. typeof(ticks)=$(typeof(ticks))")
end end
# change the scale # change the scale
@ -161,7 +161,7 @@ function updateLimsAndTicks(plt::Plot{QwtBackend}, d::KW, isx::Bool)
# scaletype == :log && w[:setAxisScaleEngine](axisid, Qwt.QWT.QwtLogScaleEngine(e)) # scaletype == :log && w[:setAxisScaleEngine](axisid, Qwt.QWT.QwtLogScaleEngine(e))
# scaletype == :log2 && w[:setAxisScaleEngine](axisid, Qwt.QWT.QwtLogScaleEngine(2)) # scaletype == :log2 && w[:setAxisScaleEngine](axisid, Qwt.QWT.QwtLogScaleEngine(2))
scaletype == :log10 && w[:setAxisScaleEngine](axisid, Qwt.QWT.QwtLog10ScaleEngine()) scaletype == :log10 && w[:setAxisScaleEngine](axisid, Qwt.QWT.QwtLog10ScaleEngine())
scaletype in supported_scales() || warn("Unsupported scale type: ", scaletype) scaletype in supported_scales() || @warn("Unsupported scale type: ", scaletype)
end end
end end

View File

@ -147,7 +147,7 @@ function bbox(x, y, w, h, oarg1::Symbol, originargs::Symbol...)
elseif oarg in (:top, :bottom, :vcenter) elseif oarg in (:top, :bottom, :vcenter)
origver = oarg origver = oarg
else else
warn("Unused origin arg in bbox construction: $oarg") @warn("Unused origin arg in bbox construction: $oarg")
end end
end end
bbox(x, y, w, h; h_anchor = orighor, v_anchor = origver) bbox(x, y, w, h; h_anchor = orighor, v_anchor = origver)

View File

@ -416,7 +416,7 @@ function _process_seriesrecipe(plt::Plot, d::KW)
end end
_process_seriesrecipe(plt, data.d) _process_seriesrecipe(plt, data.d)
else else
warn("Unhandled recipe: $(data)") @warn("Unhandled recipe: $(data)")
break break
end end
end end

View File

@ -579,7 +579,7 @@ end
end end
Plots.@deps stepbins path Plots.@deps stepbins path
wand_edges(x...) = (warn("Load the StatPlots package in order to use :wand bins. Defaulting to :auto", once = true); :auto) wand_edges(x...) = (@warn("Load the StatPlots package in order to use :wand bins. Defaulting to :auto", once = true); :auto)
function _auto_binning_nbins(vs::NTuple{N,AbstractVector}, dim::Integer; mode::Symbol = :auto) where N function _auto_binning_nbins(vs::NTuple{N,AbstractVector}, dim::Integer; mode::Symbol = :auto) where N
_cl(x) = ceil(Int, NaNMath.max(x, one(x))) _cl(x) = ceil(Int, NaNMath.max(x, one(x)))

View File

@ -303,7 +303,7 @@ function _expand_limits(lims, x)
lims[1] = NaNMath.min(lims[1], e1) lims[1] = NaNMath.min(lims[1], e1)
lims[2] = NaNMath.max(lims[2], e2) lims[2] = NaNMath.max(lims[2], e2)
# catch err # catch err
# warn(err) # @warn(err)
catch catch
end end
nothing nothing
@ -930,7 +930,7 @@ function attr!(series::Series; kw...)
if haskey(_series_defaults, k) if haskey(_series_defaults, k)
series[k] = v series[k] = v
else else
warn("unused key $k in series attr") @warn("unused key $k in series attr")
end end
end end
_series_updated(series[:subplot].plt, series) _series_updated(series[:subplot].plt, series)
@ -944,7 +944,7 @@ function attr!(sp::Subplot; kw...)
if haskey(_subplot_defaults, k) if haskey(_subplot_defaults, k)
sp[k] = v sp[k] = v
else else
warn("unused key $k in subplot attr") @warn("unused key $k in subplot attr")
end end
end end
sp sp