warn -> @warn

This commit is contained in:
Michael Krabbe Borregaard 2018-08-10 18:14:14 +01:00
parent 55ee64b4e6
commit 2844e706a9
15 changed files with 45 additions and 45 deletions

View File

@ -194,7 +194,7 @@ function hasgrid(arg::Symbol, letter)
if arg in _allGridSyms
arg in (:all, :both, :on) || occursin(string(letter), string(arg))
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
end
end
@ -212,7 +212,7 @@ function showaxis(arg::Symbol, letter)
if arg in _allGridSyms
arg in (:all, :both, :on, :yes) || occursin(string(letter), string(arg))
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
end
end
@ -704,7 +704,7 @@ function processLineArg(d::KW, arg)
# color
elseif !handleColors!(d, arg, :linecolor)
warn("Skipped line arg $arg.")
@warn("Skipped line arg $arg.")
end
end
@ -740,7 +740,7 @@ function processMarkerArg(d::KW, arg)
# markercolor
elseif !handleColors!(d, arg, :markercolor)
warn("Skipped marker arg $arg.")
@warn("Skipped marker arg $arg.")
end
end
@ -800,7 +800,7 @@ function processGridArg!(d::KW, arg, letter)
# color
elseif !handleColors!(d, arg, Symbol(letter, :foreground_color_grid))
warn("Skipped grid arg $arg.")
@warn("Skipped grid arg $arg.")
end
end
@ -834,7 +834,7 @@ function processMinorGridArg!(d::KW, arg, letter)
elseif handleColors!(d, arg, Symbol(letter, :foreground_color_minor_grid))
d[Symbol(letter, :minorgrid)] = true
else
warn("Skipped grid arg $arg.")
@warn("Skipped grid arg $arg.")
end
end
@ -867,7 +867,7 @@ function processFontArg!(d::KW, fontname::Symbol, arg)
elseif typeof(arg) <: Real
d[Symbol(fontname, :rotation)] = convert(Float64, arg)
else
warn("Skipped font arg: $arg ($(typeof(arg)))")
@warn("Skipped font arg: $arg ($(typeof(arg)))")
end
end
@ -1050,7 +1050,7 @@ function preprocessArgs!(d::KW)
# warnings for moved recipes
st = get(d, :seriestype, :path)
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
return
@ -1070,7 +1070,7 @@ function extractGroupArgs(v::AVec, args...; legendEntry = string)
groupLabels = sort(collect(unique(v)))
n = length(groupLabels)
if n > 100
warn("You created n=$n groups... Is that intended?")
@warn("You created n=$n groups... Is that intended?")
end
groupIds = Vector{Int}[filter(i -> v[i] == glab, 1:length(v)) for glab in groupLabels]
GroupBy(map(legendEntry, groupLabels), groupIds)
@ -1142,7 +1142,7 @@ function warnOnUnsupported_args(pkg::AbstractBackend, d::KW)
if !isempty(_to_warn)
for k in sort(collect(_to_warn))
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
@ -1153,13 +1153,13 @@ end
function warnOnUnsupported(pkg::AbstractBackend, d::KW)
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
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
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
@ -1168,7 +1168,7 @@ function warnOnUnsupported_scales(pkg::AbstractBackend, d::KW)
if haskey(d, k)
v = d[k]
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

View File

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

View File

@ -217,7 +217,7 @@ const _deprecated_backends = [:qwt, :winston, :bokeh, :gadfly, :immerse]
function warn_on_deprecated_backend(bsym::Symbol)
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

View File

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

View File

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

View File

@ -103,7 +103,7 @@ function pgf_framestyle(style::Symbol)
return style
else
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
end
end

View File

@ -64,7 +64,7 @@ function _plotly_framestyle(style::Symbol)
return style
else
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
end
end
@ -618,7 +618,7 @@ function plotly_series(plt::Plot, series::Series)
d_out[:hoverinfo] = "label+percent+name"
else
warn("Plotly: seriestype $st isn't supported.")
@warn("Plotly: seriestype $st isn't supported.")
return KW()
end
@ -731,7 +731,7 @@ function plotly_series_segments(series::Series, d_base::KW, x, y, z)
d_out[:fill] = "tonexty"
d_out[:fillcolor] = rgba_string(plot_color(get_fillcolor(series, i), get_fillalpha(series, i)))
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
d_out[:x], d_out[:y] = x[rng], y[rng]

View File

@ -74,7 +74,7 @@ pyart3d = PyPlot.art3D
# "support" matplotlib v1.5
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
else
:set_facecolor
@ -130,7 +130,7 @@ function py_linestyle(seriestype::Symbol, linestyle::Symbol)
linestyle == :dash && return "--"
linestyle == :dot && return ":"
linestyle == :dashdot && return "-."
warn("Unknown linestyle $linestyle")
@warn("Unknown linestyle $linestyle")
return "-"
end
@ -191,13 +191,13 @@ function py_marker(marker::Symbol)
marker == :vline && return "|"
haskey(_shapes, marker) && return py_marker(_shapes[marker])
warn("Unknown marker $marker")
@warn("Unknown marker $marker")
return "o"
end
# py_marker(markers::AVec) = map(py_marker, markers)
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])
end
@ -514,7 +514,7 @@ function py_add_series(plt::Plot{PyPlotBackend}, series::Series)
a = series[:arrow]
if a != nothing && !is3d(st) # TODO: handle 3d later
if typeof(a) != Arrow
warn("Unexpected type for arrow: $(typeof(a))")
@warn("Unexpected type for arrow: $(typeof(a))")
else
arrowprops = KW(
:arrowstyle => "simple,head_length=$(a.headlength),head_width=$(a.headwidth)",
@ -884,7 +884,7 @@ end
function py_set_scale(ax, axis::Axis)
scale = axis[:scale]
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")]
kw = KW()
arg = if scale == :identity

View File

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

View File

@ -197,7 +197,7 @@ function getGadflyMarkerTheme(d::KW, attr::KW)
ms = d[:markersize]
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
else
ms * Gadfly.px

View File

@ -150,7 +150,7 @@ function updateLimsAndTicks(plt::Plot{QwtBackend}, d::KW, isx::Bool)
end
w[:setAxisScale](axisid, float(minimum(ticks)), float(maximum(ticks)), float(step(ticks)))
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
# 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 == :log2 && w[:setAxisScaleEngine](axisid, Qwt.QWT.QwtLogScaleEngine(2))
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

View File

@ -147,7 +147,7 @@ function bbox(x, y, w, h, oarg1::Symbol, originargs::Symbol...)
elseif oarg in (:top, :bottom, :vcenter)
origver = oarg
else
warn("Unused origin arg in bbox construction: $oarg")
@warn("Unused origin arg in bbox construction: $oarg")
end
end
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
_process_seriesrecipe(plt, data.d)
else
warn("Unhandled recipe: $(data)")
@warn("Unhandled recipe: $(data)")
break
end
end

View File

@ -579,7 +579,7 @@ end
end
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
_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[2] = NaNMath.max(lims[2], e2)
# catch err
# warn(err)
# @warn(err)
catch
end
nothing
@ -930,7 +930,7 @@ function attr!(series::Series; kw...)
if haskey(_series_defaults, k)
series[k] = v
else
warn("unused key $k in series attr")
@warn("unused key $k in series attr")
end
end
_series_updated(series[:subplot].plt, series)
@ -944,7 +944,7 @@ function attr!(sp::Subplot; kw...)
if haskey(_subplot_defaults, k)
sp[k] = v
else
warn("unused key $k in subplot attr")
@warn("unused key $k in subplot attr")
end
end
sp