From 2844e706a94921c5c118d561846ae997325aee8e Mon Sep 17 00:00:00 2001 From: Michael Krabbe Borregaard Date: Fri, 10 Aug 2018 18:14:14 +0100 Subject: [PATCH] warn -> @warn --- src/args.jl | 28 ++++++++++++++-------------- src/axes.jl | 2 +- src/backends.jl | 2 +- src/backends/glvisualize.jl | 2 +- src/backends/hdf5.jl | 8 ++++---- src/backends/pgfplots.jl | 2 +- src/backends/plotly.jl | 6 +++--- src/backends/pyplot.jl | 12 ++++++------ src/components.jl | 10 +++++----- src/deprecated/backends/gadfly.jl | 2 +- src/deprecated/backends/qwt.jl | 4 ++-- src/layouts.jl | 2 +- src/pipeline.jl | 2 +- src/recipes.jl | 2 +- src/utils.jl | 6 +++--- 15 files changed, 45 insertions(+), 45 deletions(-) diff --git a/src/args.jl b/src/args.jl index 7930b775..a6310170 100644 --- a/src/args.jl +++ b/src/args.jl @@ -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 diff --git a/src/axes.jl b/src/axes.jl index 43bef9a0..094d4494 100644 --- a/src/axes.jl +++ b/src/axes.jl @@ -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 diff --git a/src/backends.jl b/src/backends.jl index aa0b5189..ad1b92d2 100644 --- a/src/backends.jl +++ b/src/backends.jl @@ -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 diff --git a/src/backends/glvisualize.jl b/src/backends/glvisualize.jl index 42889747..bf33704b 100644 --- a/src/backends/glvisualize.jl +++ b/src/backends/glvisualize.jl @@ -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 diff --git a/src/backends/hdf5.jl b/src/backends/hdf5.jl index ffc5ec53..d8919942 100644 --- a/src/backends/hdf5.jl +++ b/src/backends/hdf5.jl @@ -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 diff --git a/src/backends/pgfplots.jl b/src/backends/pgfplots.jl index cb0a8d2a..153331d8 100644 --- a/src/backends/pgfplots.jl +++ b/src/backends/pgfplots.jl @@ -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 diff --git a/src/backends/plotly.jl b/src/backends/plotly.jl index 9c1841ee..51c24c85 100644 --- a/src/backends/plotly.jl +++ b/src/backends/plotly.jl @@ -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] diff --git a/src/backends/pyplot.jl b/src/backends/pyplot.jl index 0fe05c96..e6ac252c 100644 --- a/src/backends/pyplot.jl +++ b/src/backends/pyplot.jl @@ -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 diff --git a/src/components.jl b/src/components.jl index c9b03d41..8a35c95c 100644 --- a/src/components.jl +++ b/src/components.jl @@ -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) diff --git a/src/deprecated/backends/gadfly.jl b/src/deprecated/backends/gadfly.jl index 90072a94..50ffc526 100644 --- a/src/deprecated/backends/gadfly.jl +++ b/src/deprecated/backends/gadfly.jl @@ -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 diff --git a/src/deprecated/backends/qwt.jl b/src/deprecated/backends/qwt.jl index 6f7fefcb..d64e5cd9 100644 --- a/src/deprecated/backends/qwt.jl +++ b/src/deprecated/backends/qwt.jl @@ -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 diff --git a/src/layouts.jl b/src/layouts.jl index 924f571d..038a9361 100644 --- a/src/layouts.jl +++ b/src/layouts.jl @@ -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) diff --git a/src/pipeline.jl b/src/pipeline.jl index d4cb1f4a..bca77623 100644 --- a/src/pipeline.jl +++ b/src/pipeline.jl @@ -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 diff --git a/src/recipes.jl b/src/recipes.jl index b16ad72e..26796657 100644 --- a/src/recipes.jl +++ b/src/recipes.jl @@ -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))) diff --git a/src/utils.jl b/src/utils.jl index e816dd51..f76785fe 100644 --- a/src/utils.jl +++ b/src/utils.jl @@ -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