Skip to content

Commit e93760e

Browse files
committed
Replace @setup_workload by @compile_workload
1 parent 0f09721 commit e93760e

5 files changed

Lines changed: 14 additions & 30 deletions

File tree

.github/workflows/ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ jobs:
2727
version:
2828
#- '1.7' # Leave this line unchanged. '1' will automatically expand to the latest stable 1.x release of Julia.
2929
- '~1.10.0-0'
30-
- '~1.11.0-0'
30+
#- '~1.11.0-0'
3131
- '~1.12.0-0'
3232
- 'nightly'
3333
os:

src/GMT.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -372,7 +372,7 @@ using GMT.Laszip
372372
#include("ImageFeatures/ImageFeatures.jl")
373373
#using GMT.ImageFeatures
374374

375-
@setup_workload let
375+
@compile_workload let
376376
G_API[1] = GMT_Create_Session("GMT", 2, GMT_SESSION_BITFLAGS)
377377
GMT.parse_B(Dict(:frame => (annot=10, title="Ai Ai"), :grid => (pen=2, x=10, y=20)), "", " -Baf -BWSen");
378378
GMT.parse_R(Dict(:xlim => (1,2), :ylim => (3,4), :zlim => (5,6)), "");

src/PrettyTables.jl

Lines changed: 6 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -49,9 +49,7 @@ function crop_width_to_fit_string_in_field(str::AbstractString, field_width::Int
4949
if add_continuation_char
5050
cont_str_width = textwidth(continuation_char)
5151

52-
if add_space_in_continuation_char
53-
cont_str_width += 1
54-
end
52+
add_space_in_continuation_char && (cont_str_width += 1)
5553

5654
Δ += cont_str_width
5755

@@ -743,9 +741,7 @@ function _print_table_with_text_back_end(
743741
# Check which columns must have fixed sizes.
744742
columns_width isa Integer && (columns_width = fill(columns_width, num_columns))
745743

746-
if length(columns_width) != num_columns
747-
error("The length of `columns_width` must be the same as the number of columns.")
748-
end
744+
(length(columns_width) != num_columns) && error("The length of `columns_width` must be the same as the number of columns.")
749745

750746
# The number of lines that must be skipped from printing ellipsis must be greater of equal 0.
751747
(ellipsis_line_skip < 0) && (ellipsis_line_skip = 0)
@@ -1351,9 +1347,7 @@ function _is_cell_alignment_overridden(ptable::ProcessedTable, i::Int, j::Int)
13511347

13521348
# Search for alignment overrides in this cell.
13531349
for f in ptable._data_cell_alignment
1354-
alignment_override =
1355-
f(_getdata(ptable.data), ir, jr)::Union{Nothing, Symbol}
1356-
1350+
alignment_override = f(_getdata(ptable.data), ir, jr)::Union{Nothing, Symbol}
13571351
if _is_alignment_valid(alignment_override)
13581352
return true
13591353
end
@@ -1991,9 +1985,7 @@ function _update_column_width(column_width::Int, largest_cell_width::Int, column
19911985
end
19921986

19931987
# Make sure that the minimum column width is respected.
1994-
if (minimum_column_width > 0) && (minimum_column_width > column_width)
1995-
column_width = minimum_column_width
1996-
end
1988+
(minimum_column_width > 0) && (minimum_column_width > column_width) && (column_width = minimum_column_width)
19971989
else
19981990
column_width = column_width_specification
19991991
end
@@ -2027,11 +2019,7 @@ end
20272019

20282020
# Return the available rows in `display`. If there is no row limit, this function returns -1.
20292021
function _available_rows(display::Display)
2030-
if display.size[1] > 0
2031-
return display.size[1] - display.row
2032-
else
2033-
return -1
2034-
end
2022+
return (display.size[1] > 0) ? (display.size[1] - display.row) : -1
20352023
end
20362024

20372025
# Draw the continuation row when the table has filled the vertical space available. This
@@ -2574,11 +2562,7 @@ function _print_omitted_cell_summary(display::Display, num_omitted_cols::Int, nu
25742562
if show_omitted_cell_summary && ((num_omitted_cols + num_omitted_rows) > 0)
25752563
cs_str = _get_omitted_cell_string(num_omitted_rows, num_omitted_cols)
25762564

2577-
if display.size[2] > 0
2578-
table_display_width = min(table_width, display.size[2])
2579-
else
2580-
table_display_width = table_width
2581-
end
2565+
table_display_width = (display.size[2] > 0) ? min(table_width, display.size[2]) : table_width
25822566

25832567
if textwidth(cs_str) < table_display_width
25842568
cs_str = align_string(cs_str, table_display_width, :r)

src/common_options.jl

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2846,7 +2846,7 @@ function get_color(val)::String
28462846
# Parse a color input.
28472847
# color1,color2[,color3,…] colorn can be a r/g/b triplet, a color name, or an HTML hexadecimal color (e.g. #aabbcc)
28482848
(isa(val, AbstractString) || isa(val, Symbol) || isa(val, Real)) && return isa(val, Bool) ? "" : string(val)
2849-
error("\tGET_COLOR: got an unsupported data type: $(typeof(val))")
2849+
error("\tGET_COLOR: got an unsupported data type")
28502850
end
28512851
function get_color(val::Tuple)::String
28522852
out::String = ""
@@ -2899,7 +2899,7 @@ end
28992899
# ---------------------------------------------------------------------------------------------------
29002900
function parse_units(val)::String
29012901
# Parse a units string in the form d|e|f|k|n|M|n|s or expanded
2902-
(isa(val, String) || isa(val, Symbol) || isa(val, Real)) && return string(val)
2902+
(isa(val, StrSymb) || isa(val, Real)) && return string(val)
29032903

29042904
!(isa(val, Tuple) && (length(val) == 2)) && error("PARSE_UNITS, got and unsupported data type: $(typeof(val))")
29052905
return string(val[1], parse_unit_unit(val[2]))
@@ -3379,9 +3379,9 @@ function vector4_attrib(; kwargs...)::String
33793379
if (isa(val, NamedTuple) || isa(val, AbstractDict))
33803380
ha::String = "0.075c"; hl::String = "0.3c"; hw::String = "0.25c"
33813381
dh = isa(val, NamedTuple) ? nt2dict(val) : val
3382-
haskey(dh, :arrowwidth) && (ha = string(dh[:arrowwidth]))
3383-
haskey(dh, :headlength) && (hl = string(dh[:headlength]))
3384-
haskey(dh, :headwidth) && (hw = string(dh[:headwidth]))
3382+
haskey(dh, :arrowwidth) && (ha = string(dh[:arrowwidth])::String)
3383+
haskey(dh, :headlength) && (hl = string(dh[:headlength])::String)
3384+
haskey(dh, :headwidth) && (hw = string(dh[:headwidth])::String)
33853385
hh::String = ha * '/' * hl * '/' * hw
33863386
elseif (isa(val, Tuple) && length(val) == 3) hh = arg2str(val)
33873387
elseif (isa(val, String)) hh = val # No checking

src/psxy.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ function _common_plot_xyz(cmd0::String, arg1, caller::String, O::Bool, K::Bool,
4444

4545
if (is_ternary)
4646
opt_B::String = ""
47-
if (haskey(d, :B)) # Not necessarely the case when ternary!
47+
if (haskey(d, :B)) # Not necessarely the case when ternary!
4848
cmd, opt_B = string(cmd, d[:B]), d[:B] # B option was parsed in plot/ternary
4949
delete!(d, :B)
5050
end

0 commit comments

Comments
 (0)