Skip to content

Commit 6b4ef1a

Browse files
committed
run JuliaFormatter
1 parent ebc9c15 commit 6b4ef1a

File tree

2 files changed

+7
-12
lines changed

2 files changed

+7
-12
lines changed

src/DBFTables.jl

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ struct Header
2222
mdx::Bool
2323
lang_id::UInt8
2424
fields::Vector{FieldDescriptor}
25-
fieldcolumns::Dict{Symbol, Int}
25+
fieldcolumns::Dict{Symbol,Int}
2626
end
2727

2828
"Struct representing the DBF Table"
@@ -97,7 +97,7 @@ function Header(io::IO)
9797
fields = FieldDescriptor[]
9898

9999
# use Dict for quicker column index lookup
100-
fieldcolumns = Dict{Symbol, Int}()
100+
fieldcolumns = Dict{Symbol,Int}()
101101
col = 1
102102
while !eof(io)
103103
field = read_dbf_field(io)
@@ -146,8 +146,7 @@ function dbf_value(::Type{Bool}, str::AbstractString)
146146
end
147147
end
148148

149-
dbf_value(T::Union{Type{Int},Type{Float64}}, str::AbstractString) =
150-
miss(tryparse(T, str))
149+
dbf_value(T::Union{Type{Int},Type{Float64}}, str::AbstractString) = miss(tryparse(T, str))
151150
# String to avoid returning SubString{String}
152151
function dbf_value(::Type{String}, str::AbstractString)
153152
stripped = rstrip(str)
@@ -221,10 +220,8 @@ function Base.NamedTuple(row::Row)
221220
ncol = length(fields)
222221
rowidx = getrow(row)
223222
@inbounds record = @view str[:, rowidx]
224-
@inbounds prs = (fields[col].name => dbf_value(
225-
fields[col].type,
226-
record[col],
227-
) for col = 1:ncol)
223+
@inbounds prs =
224+
(fields[col].name => dbf_value(fields[col].type, record[col]) for col = 1:ncol)
228225
return (; prs...)
229226
end
230227

test/runtests.jl

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38,10 +38,8 @@ row, st = iterate(dbf)
3838
@testset "show" begin
3939
@test sprint(show, row) === sprint(show, NamedTuple(row))
4040
# use replace to update to julia 1.4 union printing
41-
@test replace(sprint(
42-
show,
43-
dbf,
44-
), r"\} +"=>"}") === "DBFTables.Table with 7 rows and 6 columns\nTables.Schema:\n :CHAR Union{Missing, String}\n :DATE Union{Missing, String}\n :BOOL Union{Missing, Bool}\n :FLOAT Union{Missing, Float64}\n :NUMERIC Union{Missing, Float64}\n :INTEGER Union{Missing, $Int}\n"
41+
@test replace(sprint(show, dbf), r"\} +" => "}") ===
42+
"DBFTables.Table with 7 rows and 6 columns\nTables.Schema:\n :CHAR Union{Missing, String}\n :DATE Union{Missing, String}\n :BOOL Union{Missing, Bool}\n :FLOAT Union{Missing, Float64}\n :NUMERIC Union{Missing, Float64}\n :INTEGER Union{Missing, $Int}\n"
4543
end
4644

4745
@testset "iterate" begin

0 commit comments

Comments
 (0)