diff --git a/docs/make.jl b/docs/make.jl index 69ceb68..7ef11c1 100644 --- a/docs/make.jl +++ b/docs/make.jl @@ -3,7 +3,7 @@ using Documenter, QueryOperators makedocs( modules = [QueryOperators], sitename = "QueryOperators.jl", - analytics="UA-132838790-1", + analytics = "UA-132838790-1", pages = [ "Introduction" => "index.md" ] diff --git a/src/NamedTupleUtilities.jl b/src/NamedTupleUtilities.jl index 1ebbb70..d5b282f 100644 --- a/src/NamedTupleUtilities.jl +++ b/src/NamedTupleUtilities.jl @@ -8,7 +8,7 @@ julia> QueryOperators.NamedTupleUtilities.select((a=1,b=2,c=3),Val(:a)) (a = 1,) ``` """ -@generated function select(a::NamedTuple{an}, ::Val{bn}) where {an, bn} +@generated function select(a::NamedTuple{an}, ::Val{bn}) where {an,bn} names = ((i for i in an if i == bn)...,) types = Tuple{(fieldtype(a, n) for n in names)...} vals = Expr[:(getfield(a, $(QuoteNode(n)))) for n in names] @@ -23,7 +23,7 @@ julia> QueryOperators.NamedTupleUtilities.remove((a=1,b=2,c=3),Val(:c)) (a = 1, b = 2) ``` """ -@generated function remove(a::NamedTuple{an}, ::Val{bn}) where {an, bn} +@generated function remove(a::NamedTuple{an}, ::Val{bn}) where {an,bn} names = ((i for i in an if i != bn)...,) types = Tuple{(fieldtype(a, n) for n in names)...} vals = Expr[:(getfield(a, $(QuoteNode(n)))) for n in names] @@ -40,7 +40,7 @@ julia> QueryOperators.NamedTupleUtilities.range((a=1,b=2,c=3),Val(:a),Val(:b)) (a = 1, b = 2) ``` """ -@generated function range(a::NamedTuple{an}, ::Val{bn}, ::Val{cn}) where {an, bn, cn} +@generated function range(a::NamedTuple{an}, ::Val{bn}, ::Val{cn}) where {an,bn,cn} rangeStarted = false names = Symbol[] for n in an @@ -74,7 +74,7 @@ julia> QueryOperators.NamedTupleUtilities.rename((a = 1, b = 2, c = 3),Val(:a),V ERROR: duplicate field name in NamedTuple: "c" is not unique ``` """ -@generated function rename(a::NamedTuple{an}, ::Val{bn}, ::Val{cn}) where {an, bn, cn} +@generated function rename(a::NamedTuple{an}, ::Val{bn}, ::Val{cn}) where {an,bn,cn} names = Symbol[] typesArray = DataType[] vals = Expr[] @@ -99,7 +99,7 @@ julia> QueryOperators.NamedTupleUtilities.startswith((abc=1,bcd=2,cde=3),Val(:a) (abc = 1,) ``` """ -@generated function startswith(a::NamedTuple{an}, ::Val{bn}) where {an, bn} +@generated function startswith(a::NamedTuple{an}, ::Val{bn}) where {an,bn} names = ((i for i in an if Base.startswith(String(i), String(bn)))...,) types = Tuple{(fieldtype(a, n) for n in names)...} vals = Expr[:(getfield(a, $(QuoteNode(n)))) for n in names] @@ -114,7 +114,7 @@ julia> QueryOperators.NamedTupleUtilities.not_startswith((abc=1,bcd=2,cde=3),Val (bcd = 2, cde = 3) ``` """ -@generated function not_startswith(a::NamedTuple{an}, ::Val{bn}) where {an, bn} +@generated function not_startswith(a::NamedTuple{an}, ::Val{bn}) where {an,bn} names = ((i for i in an if !Base.startswith(String(i), String(bn)))...,) types = Tuple{(fieldtype(a, n) for n in names)...} vals = Expr[:(getfield(a, $(QuoteNode(n)))) for n in names] @@ -129,7 +129,7 @@ julia> QueryOperators.NamedTupleUtilities.not_endswith((abc=1,bcd=2,cde=3),Val(: (abc = 1, cde = 3) ``` """ -@generated function endswith(a::NamedTuple{an}, ::Val{bn}) where {an, bn} +@generated function endswith(a::NamedTuple{an}, ::Val{bn}) where {an,bn} names = ((i for i in an if Base.endswith(String(i), String(bn)))...,) types = Tuple{(fieldtype(a, n) for n in names)...} vals = Expr[:(getfield(a, $(QuoteNode(n)))) for n in names] @@ -144,7 +144,7 @@ julia> QueryOperators.NamedTupleUtilities.endswith((abc=1,bcd=2,cde=3),Val(:d)) (bcd = 2,) ``` """ -@generated function not_endswith(a::NamedTuple{an}, ::Val{bn}) where {an, bn} +@generated function not_endswith(a::NamedTuple{an}, ::Val{bn}) where {an,bn} names = ((i for i in an if !Base.endswith(String(i), String(bn)))...,) types = Tuple{(fieldtype(a, n) for n in names)...} vals = Expr[:(getfield(a, $(QuoteNode(n)))) for n in names] @@ -159,7 +159,7 @@ julia> QueryOperators.NamedTupleUtilities.occursin((abc=1,bcd=2,cde=3),Val(:d)) (bcd = 2, cde = 3) ``` """ -@generated function occursin(a::NamedTuple{an}, ::Val{bn}) where {an, bn} +@generated function occursin(a::NamedTuple{an}, ::Val{bn}) where {an,bn} names = ((i for i in an if Base.occursin(String(bn), String(i)))...,) types = Tuple{(fieldtype(a, n) for n in names)...} vals = Expr[:(getfield(a, $(QuoteNode(n)))) for n in names] @@ -174,7 +174,7 @@ julia> QueryOperators.NamedTupleUtilities.not_occursin((abc=1,bcd=2,cde=3),Val(: (abc = 1,) ``` """ -@generated function not_occursin(a::NamedTuple{an}, ::Val{bn}) where {an, bn} +@generated function not_occursin(a::NamedTuple{an}, ::Val{bn}) where {an,bn} names = ((i for i in an if !Base.occursin(String(bn), String(i)))...,) types = Tuple{(fieldtype(a, n) for n in names)...} vals = Expr[:(getfield(a, $(QuoteNode(n)))) for n in names] @@ -193,7 +193,7 @@ julia> QueryOperators.NamedTupleUtilities.oftype((a = [4,5,6], b = [3.,2.,1.], c NamedTuple() ``` """ -@generated function oftype(a::NamedTuple{an}, ::Val{b}) where {an, b} +@generated function oftype(a::NamedTuple{an}, ::Val{b}) where {an,b} names = ((i for i in an if fieldtype(a, i) <: b)...,) types = Tuple{(fieldtype(a, n) for n in names)...} vals = Expr[:(getfield(a, $(QuoteNode(n)))) for n in names] diff --git a/src/enumerable/enumerable.jl b/src/enumerable/enumerable.jl index c6469a4..2f37c36 100644 --- a/src/enumerable/enumerable.jl +++ b/src/enumerable/enumerable.jl @@ -3,4 +3,4 @@ abstract type Enumerable end Base.IteratorSize(::Type{T}) where {T <: Enumerable} = Base.SizeUnknown() IteratorInterfaceExtensions.isiterable(x::Enumerable) = true -haslength(S) = Base.IteratorSize(S) isa Union{Base.HasLength, Base.HasShape} ? Base.HasLength() : Base.IteratorSize(S) +haslength(S) = Base.IteratorSize(S) isa Union{Base.HasLength,Base.HasShape} ? Base.HasLength() : Base.IteratorSize(S) diff --git a/src/enumerable/enumerable_defaultifempty.jl b/src/enumerable/enumerable_defaultifempty.jl index 9a9c7c4..ef65204 100644 --- a/src/enumerable/enumerable_defaultifempty.jl +++ b/src/enumerable/enumerable_defaultifempty.jl @@ -7,10 +7,10 @@ Base.eltype(iter::Type{EnumerableDefaultIfEmpty{T,S}}) where {T,S} = T _default_value_expr(::Type{T}) where {T} = :( DataValues.DataValue{$T}() ) -_default_value_expr(::Type{T}) where {T<:DataValues.DataValue} = :( $T() ) +_default_value_expr(::Type{T}) where {T <: DataValues.DataValue} = :( $T() ) -function _default_value_expr(::Type{T}) where {T<:NamedTuple} - return :( NamedTuple{$(fieldnames(T))}( ($( (_default_value_expr(fieldtype(T,i)) for i in 1:length(fieldnames(T)))... ),)) ) +function _default_value_expr(::Type{T}) where {T <: NamedTuple} + return :( NamedTuple{$(fieldnames(T))}(($( (_default_value_expr(fieldtype(T, i)) for i in 1:length(fieldnames(T)))... ),)) ) end @generated function default_if_empty(source::S) where {S} @@ -32,7 +32,7 @@ end function default_if_empty(source::S, default_value::TD) where {S,TD} T = eltype(source) - if T!=TD + if T != TD error("The default value must have the same type as the elements from the source.") end return EnumerableDefaultIfEmpty{T,S}(source, default_value) @@ -41,18 +41,18 @@ end function Base.iterate(iter::EnumerableDefaultIfEmpty{T,S}) where {T,S} s = iterate(iter.source) - if s===nothing + if s === nothing return iter.default_value, nothing else - return convert(T,s[1]), s[2] + return convert(T, s[1]), s[2] end end function Base.iterate(iter::EnumerableDefaultIfEmpty{T,S}, state) where {T,S} - state===nothing && return nothing + state === nothing && return nothing s = iterate(iter.source, state) - if s===nothing + if s === nothing return nothing else return convert(T, s[1]), s[2] diff --git a/src/enumerable/enumerable_drop.jl b/src/enumerable/enumerable_drop.jl index a7aa9b0..81fec72 100644 --- a/src/enumerable/enumerable_drop.jl +++ b/src/enumerable/enumerable_drop.jl @@ -13,12 +13,12 @@ Base.IteratorSize(::Type{EnumerableDrop{T,S}}) where {T,S} = (Base.IteratorSize( Base.eltype(::Type{EnumerableDrop{T,S}}) where {T,S} = T -Base.length(iter::EnumerableDrop{T,S}) where {T,S} = max(length(iter.source)-iter.n,0) +Base.length(iter::EnumerableDrop{T,S}) where {T,S} = max(length(iter.source) - iter.n, 0) function Base.iterate(iter::EnumerableDrop{T,S}) where {T,S} ret = iterate(iter.source) for i in 1:iter.n - if ret===nothing + if ret === nothing return nothing else ret = iterate(iter.source, ret[2]) diff --git a/src/enumerable/enumerable_filter.jl b/src/enumerable/enumerable_filter.jl index e6e188b..0e5f700 100644 --- a/src/enumerable/enumerable_filter.jl +++ b/src/enumerable/enumerable_filter.jl @@ -1,5 +1,5 @@ # T is the type of the elements produced by this iterator -struct EnumerableFilter{T,S,Q<:Function} <: Enumerable +struct EnumerableFilter{T,S,Q <: Function} <: Enumerable source::S filter::Q end @@ -16,7 +16,7 @@ end function Base.iterate(iter::EnumerableFilter{T,S,Q}, state...) where {T,S,Q} ret = iterate(iter.source, state...) - while ret!==nothing + while ret !== nothing if iter.filter(ret[1]) return ret end diff --git a/src/enumerable/enumerable_gather.jl b/src/enumerable/enumerable_gather.jl index f892f99..264c28a 100644 --- a/src/enumerable/enumerable_gather.jl +++ b/src/enumerable/enumerable_gather.jl @@ -14,7 +14,7 @@ end function gather(source::Enumerable, args...; key::Symbol = :key, value::Symbol = :value) fields = fieldnames(eltype(source)) if length(args) > 0 - indexFields_vector = Vector{Symbol}(undef, 0) + indexFields_vector = Vector{Symbol}(undef, 0) firstArg = true for arg in args if typeof(arg) == Symbol @@ -39,12 +39,12 @@ function gather(source::Enumerable, args...; key::Symbol = :key, value::Symbol = valueTypes = (fieldtype(eltype(source), indexField) for indexField in indexFields) valueType = reduce(promote_type, valueTypes) - T = NamedTuple{(savedFields..., key, value), Tuple{savedFieldsType..., Symbol, valueType}} - return EnumerableGather{T, typeof(source), typeof(fields), typeof(indexFields), typeof(savedFields)}(source, + T = NamedTuple{(savedFields..., key, value),Tuple{savedFieldsType...,Symbol,valueType}} + return EnumerableGather{T,typeof(source),typeof(fields),typeof(indexFields),typeof(savedFields)}(source, fields, indexFields, savedFields, key, value) end -function Base.iterate(iter::EnumerableGather{T, S, F, I, A}) where {T, S, F, I, A} +function Base.iterate(iter::EnumerableGather{T,S,F,I,A}) where {T,S,F,I,A} source_iterate = iterate(iter.source) if source_iterate == nothing || length(iter.indexFields) == 0 return nothing @@ -52,11 +52,11 @@ function Base.iterate(iter::EnumerableGather{T, S, F, I, A}) where {T, S, F, I, key = iter.indexFields[1] current_source_row = source_iterate[1] value = current_source_row[key] - return (T((Base.map(n->current_source_row[n], iter.savedFields)..., key, value)), - (current_source_row=current_source_row, source_state=source_iterate[2], current_index_field_index=1)) + return (T((Base.map(n->current_source_row[n], iter.savedFields)..., key, value)), + (current_source_row = current_source_row, source_state = source_iterate[2], current_index_field_index = 1)) end -function Base.iterate(iter::EnumerableGather{T, S, F, I, A}, state) where {T, S, F, I, A} +function Base.iterate(iter::EnumerableGather{T,S,F,I,A}, state) where {T,S,F,I,A} current_index_field_index = state.current_index_field_index + 1 if current_index_field_index > length(iter.indexFields) source_iterate = iterate(iter.source, state.source_state) @@ -72,10 +72,10 @@ function Base.iterate(iter::EnumerableGather{T, S, F, I, A}, state) where {T, S, end key = iter.indexFields[current_index_field_index] value = current_source_row[key] - return (T((Base.map(n->current_source_row[n], iter.savedFields)..., key, value)), - (current_source_row=current_source_row, source_state=source_state, current_index_field_index=current_index_field_index)) + return (T((Base.map(n->current_source_row[n], iter.savedFields)..., key, value)), + (current_source_row = current_source_row, source_state = source_state, current_index_field_index = current_index_field_index)) end -function Base.eltype(iter::EnumerableGather{T, S, F, I, A}) where {T, S, F, I, A} +function Base.eltype(iter::EnumerableGather{T,S,F,I,A}) where {T,S,F,I,A} return T end diff --git a/src/enumerable/enumerable_groupby.jl b/src/enumerable/enumerable_groupby.jl index b5df210..8737603 100644 --- a/src/enumerable/enumerable_groupby.jl +++ b/src/enumerable/enumerable_groupby.jl @@ -1,4 +1,4 @@ -struct EnumerableGroupBySimple{T,TKey,TS,SO,ES<:Function} <: Enumerable +struct EnumerableGroupBySimple{T,TKey,TS,SO,ES <: Function} <: Enumerable source::SO elementSelector::ES end @@ -19,14 +19,14 @@ function Base.size(gcav::GroupColumnArrayView) end function Base.getindex(gcav::GroupColumnArrayView{T,G,INDEX}, i::Int) where {T,G,INDEX} - return getproperty(gcav.grouping[i],INDEX) + return getproperty(gcav.grouping[i], INDEX) end Base.IndexStyle(::Type{GroupColumnArrayView}) = IndexLinear() function Base.getproperty(g::Grouping{TKey,T}, name::Symbol) where {TKey,T} - - return GroupColumnArrayView{fieldtype(T,name),Grouping{TKey,T},name}(g) + + return GroupColumnArrayView{fieldtype(T, name),Grouping{TKey,T},name}(g) end Base.size(A::Grouping{TKey,T}) where {TKey,T} = size(getfield(A, :elements)) @@ -45,7 +45,7 @@ function groupby(source::Enumerable, f_elementSelector::Function, elementSelecto ES = typeof(f_elementSelector) - return EnumerableGroupBySimple{T,TKey,TS,SO,ES}(source,f_elementSelector) + return EnumerableGroupBySimple{T,TKey,TS,SO,ES}(source, f_elementSelector) end function Base.iterate(iter::EnumerableGroupBySimple{T,TKey,TS,SO,ES}) where {T,TKey,TS,SO,ES} @@ -53,13 +53,13 @@ function Base.iterate(iter::EnumerableGroupBySimple{T,TKey,TS,SO,ES}) where {T,T for i in iter.source key = iter.elementSelector(i) if !haskey(result, key) - result[key] = T(key,Array{TS}(undef, 0)) + result[key] = T(key, Array{TS}(undef, 0)) end - push!(getfield(result[key], :elements),i) + push!(getfield(result[key], :elements), i) end groups = collect(values(result)) - if length(groups)==0 + if length(groups) == 0 return nothing else return groups[1], (groups, 2) @@ -67,20 +67,20 @@ function Base.iterate(iter::EnumerableGroupBySimple{T,TKey,TS,SO,ES}) where {T,T end function Base.iterate(iter::EnumerableGroupBySimple{T,TKey,TS,SO,ES}, state) where {T,TKey,TS,SO,ES} - if state[2]>length(state[1]) + if state[2] > length(state[1]) return nothing else - return state[1][state[2]], (state[1], state[2]+1) + return state[1][state[2]], (state[1], state[2] + 1) end end -struct EnumerableGroupBy{T,TKey,TR,SO,ES<:Function,RS<:Function} <: Enumerable +struct EnumerableGroupBy{T,TKey,TR,SO,ES <: Function,RS <: Function} <: Enumerable source::SO elementSelector::ES resultSelector::RS end -Base.eltype(::Type{EnumerableGroupBy{T,TKey,TR,SO,ES, RS}}) where {T,TKey,TR,SO,ES,RS} = T +Base.eltype(::Type{EnumerableGroupBy{T,TKey,TR,SO,ES,RS}}) where {T,TKey,TR,SO,ES,RS} = T function groupby(source::Enumerable, f_elementSelector::Function, elementSelector::Expr, f_resultSelector::Function, resultSelector::Expr) TS = eltype(source) @@ -95,7 +95,7 @@ function groupby(source::Enumerable, f_elementSelector::Function, elementSelecto ES = typeof(f_elementSelector) RS = typeof(f_resultSelector) - return EnumerableGroupBy{T,TKey,TR,SO,ES,RS}(source,f_elementSelector,f_resultSelector) + return EnumerableGroupBy{T,TKey,TR,SO,ES,RS}(source, f_elementSelector, f_resultSelector) end function Base.iterate(iter::EnumerableGroupBy{T,TKey,TR,SO,ES}) where {T,TKey,TR,SO,ES} @@ -103,13 +103,13 @@ function Base.iterate(iter::EnumerableGroupBy{T,TKey,TR,SO,ES}) where {T,TKey,TR for i in iter.source key = iter.elementSelector(i) if !haskey(result, key) - result[key] = T(key,Array{TR}(undef,0)) + result[key] = T(key, Array{TR}(undef, 0)) end - push!(getfield(result[key], :elements),iter.resultSelector(i)) + push!(getfield(result[key], :elements), iter.resultSelector(i)) end groups = collect(values(result)) - if length(groups)==0 + if length(groups) == 0 return nothing else return groups[1], (groups, 2) @@ -117,9 +117,9 @@ function Base.iterate(iter::EnumerableGroupBy{T,TKey,TR,SO,ES}) where {T,TKey,TR end function Base.iterate(iter::EnumerableGroupBy{T,TKey,TR,SO,ES}, state) where {T,TKey,TR,SO,ES} - if state[2]>length(state[1]) + if state[2] > length(state[1]) return nothing else - return state[1][state[2]], (state[1], state[2]+1) + return state[1][state[2]], (state[1], state[2] + 1) end end diff --git a/src/enumerable/enumerable_groupjoin.jl b/src/enumerable/enumerable_groupjoin.jl index 07b9ebb..6e3046a 100644 --- a/src/enumerable/enumerable_groupjoin.jl +++ b/src/enumerable/enumerable_groupjoin.jl @@ -1,4 +1,4 @@ -struct EnumerableGroupJoin{T,TKey,TI,SO,SI,OKS<:Function,IKS<:Function,RS<:Function} <: Enumerable +struct EnumerableGroupJoin{T,TKey,TI,SO,SI,OKS <: Function,IKS <: Function,RS <: Function} <: Enumerable outer::SO inner::SI outerKeySelector::OKS @@ -14,7 +14,7 @@ function groupjoin(outer::Enumerable, inner::Enumerable, f_outerKeySelector::Fun TKeyOuter = Base._return_type(f_outerKeySelector, Tuple{TO,}) TKeyInner = Base._return_type(f_innerKeySelector, Tuple{TI,}) - if TKeyOuter!=TKeyInner + if TKeyOuter != TKeyInner error("The keys in the join clause have different types, $TKeyOuter and $TKeyInner.") end @@ -27,7 +27,7 @@ function groupjoin(outer::Enumerable, inner::Enumerable, f_outerKeySelector::Fun IKS = typeof(f_innerKeySelector) RS = typeof(f_resultSelector) - return EnumerableGroupJoin{T,TKeyOuter,TI,SO,SI,OKS,IKS,RS}(outer,inner,f_outerKeySelector,f_innerKeySelector,f_resultSelector) + return EnumerableGroupJoin{T,TKeyOuter,TI,SO,SI,OKS,IKS,RS}(outer, inner, f_outerKeySelector, f_innerKeySelector, f_resultSelector) end function Base.iterate(iter::EnumerableGroupJoin{T,TKeyOuter,TI,SO,SI,OKS,IKS,RS}) where {T,TKeyOuter,TI,SO,SI,OKS,IKS,RS} @@ -44,25 +44,25 @@ function Base.iterate(iter::EnumerableGroupJoin{T,TKeyOuter,TI,SO,SI,OKS,IKS,RS} for i in iter.outer outerKey = iter.outerKeySelector(i) - if haskey(inner_dict,outerKey) + if haskey(inner_dict, outerKey) g = inner_dict[outerKey] else g = Array{TI}(undef, 0) end - push!(results, iter.resultSelector(i,g)) + push!(results, iter.resultSelector(i, g)) end - if length(results)==0 + if length(results) == 0 return nothing end - return results[1], (results,2) + return results[1], (results, 2) end function Base.iterate(iter::EnumerableGroupJoin{T,TKeyOuter,TI,SO,SI,OKS,IKS,RS}, state) where {T,TKeyOuter,TI,SO,SI,OKS,IKS,RS} - if state[2]>length(state[1]) + if state[2] > length(state[1]) return nothing else - return state[1][state[2]], (state[1], state[2]+1) + return state[1][state[2]], (state[1], state[2] + 1) end end diff --git a/src/enumerable/enumerable_join.jl b/src/enumerable/enumerable_join.jl index 9a930c4..9a678a3 100644 --- a/src/enumerable/enumerable_join.jl +++ b/src/enumerable/enumerable_join.jl @@ -1,4 +1,4 @@ -struct EnumerableJoin{T,TKey,TI,SO,SI,OKS<:Function,IKS<:Function,RS<:Function} <: Enumerable +struct EnumerableJoin{T,TKey,TI,SO,SI,OKS <: Function,IKS <: Function,RS <: Function} <: Enumerable outer::SO inner::SI outerKeySelector::OKS @@ -14,7 +14,7 @@ function join(outer::Enumerable, inner::Enumerable, f_outerKeySelector::Function TKeyOuter = Base._return_type(f_outerKeySelector, Tuple{TO,}) TKeyInner = Base._return_type(f_innerKeySelector, Tuple{TI,}) - if TKeyOuter!=TKeyInner + if TKeyOuter != TKeyInner error("The keys in the join clause have different types, $TKeyOuter and $TKeyInner.") end @@ -27,7 +27,7 @@ function join(outer::Enumerable, inner::Enumerable, f_outerKeySelector::Function IKS = typeof(f_innerKeySelector) RS = typeof(f_resultSelector) - return EnumerableJoin{T,TKeyOuter,TI,SO,SI,OKS,IKS,RS}(outer,inner,f_outerKeySelector,f_innerKeySelector,f_resultSelector) + return EnumerableJoin{T,TKeyOuter,TI,SO,SI,OKS,IKS,RS}(outer, inner, f_outerKeySelector, f_innerKeySelector, f_resultSelector) end function Base.iterate(iter::EnumerableJoin{T,TKeyOuter,TI,SO,SI,OKS,IKS,RS}) where {T,TKeyOuter,TI,SO,SI,OKS,IKS,RS} @@ -44,14 +44,14 @@ function Base.iterate(iter::EnumerableJoin{T,TKeyOuter,TI,SO,SI,OKS,IKS,RS}) whe for i in iter.outer outerKey = iter.outerKeySelector(i) - if haskey(inner_dict,outerKey) + if haskey(inner_dict, outerKey) for j in inner_dict[outerKey] - push!(results, iter.resultSelector(i,j)) + push!(results, iter.resultSelector(i, j)) end end end - if length(results)==0 + if length(results) == 0 return nothing end @@ -59,9 +59,9 @@ function Base.iterate(iter::EnumerableJoin{T,TKeyOuter,TI,SO,SI,OKS,IKS,RS}) whe end function Base.iterate(iter::EnumerableJoin{T,TKeyOuter,TI,SO,SI,OKS,IKS,RS}, state) where {T,TKeyOuter,TI,SO,SI,OKS,IKS,RS} - if state[2]>length(state[1]) + if state[2] > length(state[1]) return nothing else - return state[1][state[2]], (state[1], state[2]+1) + return state[1][state[2]], (state[1], state[2] + 1) end end diff --git a/src/enumerable/enumerable_map.jl b/src/enumerable/enumerable_map.jl index aafe151..075ec4b 100644 --- a/src/enumerable/enumerable_map.jl +++ b/src/enumerable/enumerable_map.jl @@ -1,4 +1,4 @@ -struct EnumerableMap{T, S, Q<:Function} <: Enumerable +struct EnumerableMap{T,S,Q <: Function} <: Enumerable source::S f::Q end @@ -19,7 +19,7 @@ end function Base.iterate(iter::EnumerableMap{T,S,Q}, state...) where {T,S,Q} ret = iterate(iter.source, state...) - if ret===nothing + if ret === nothing return nothing else return iter.f(ret[1]), ret[2] diff --git a/src/enumerable/enumerable_mapmany.jl b/src/enumerable/enumerable_mapmany.jl index 50e29e6..2a38fd2 100644 --- a/src/enumerable/enumerable_mapmany.jl +++ b/src/enumerable/enumerable_mapmany.jl @@ -1,4 +1,4 @@ -struct EnumerableMapMany{T,SO,CS<:Function,RS<:Function} <: Enumerable +struct EnumerableMapMany{T,SO,CS <: Function,RS <: Function} <: Enumerable source::SO collectionSelector::CS resultSelector::RS @@ -11,7 +11,7 @@ Base.eltype(::Type{EnumerableMapMany{T,SO,CS,RS}}) where {T,SO,CS,RS} = T function expr_contains_ref_to(expr::Expr, var_name::Symbol) for sub_expr in expr.args if isa(sub_expr, Symbol) - if sub_expr==var_name + if sub_expr == var_name return true end else @@ -25,11 +25,11 @@ function expr_contains_ref_to(expr::Expr, var_name::Symbol) end function expr_contains_ref_to(expr::Symbol, var_name::Symbol) - return expr==var_name + return expr == var_name end function expr_contains_ref_to(expr::QuoteNode, var_name::Symbol) - return expr==var_name + return expr == var_name end function expr_contains_ref_to(expr::Function, var_name::Symbol) @@ -42,8 +42,8 @@ function mapmany(source::Enumerable, f_collectionSelector::Function, collectionS TS = eltype(source) # First detect whether the collectionSelector return value depends at all # on the value of the anonymous function argument - anon_var = collectionSelector.head==:escape ? collectionSelector.args[1].args[1] : collectionSelector.args[1] - body = collectionSelector.head==:escape ? collectionSelector.args[1].args[2].args[2] : collectionSelector.args[2].args[2] + anon_var = collectionSelector.head == :escape ? collectionSelector.args[1].args[1] : collectionSelector.args[1] + body = collectionSelector.head == :escape ? collectionSelector.args[1].args[2].args[2] : collectionSelector.args[2].args[2] crossJoin = !expr_contains_ref_to(body, anon_var) if crossJoin @@ -52,7 +52,7 @@ function mapmany(source::Enumerable, f_collectionSelector::Function, collectionS TCE = input_type_collection_selector.parameters[1] else input_type_collection_selector = Base._return_type(f_collectionSelector, Tuple{TS,}) - TCE = typeof(input_type_collection_selector)==Union || input_type_collection_selector==Any ? Any : eltype(input_type_collection_selector) + TCE = typeof(input_type_collection_selector) == Union || input_type_collection_selector == Any ? Any : eltype(input_type_collection_selector) end T = Base._return_type(f_resultSelector, Tuple{TS,TCE}) @@ -61,7 +61,7 @@ function mapmany(source::Enumerable, f_collectionSelector::Function, collectionS CS = typeof(f_collectionSelector) RS = typeof(f_resultSelector) - return EnumerableMapMany{T,SO,CS,RS}(source,f_collectionSelector,f_resultSelector) + return EnumerableMapMany{T,SO,CS,RS}(source, f_collectionSelector, f_resultSelector) end # TODO This should be changed to a lazy implementation @@ -69,21 +69,21 @@ function Base.iterate(iter::EnumerableMapMany{T,SO,CS,RS}) where {T,SO,CS,RS} results = Array{T}(undef, 0) for i in iter.source for j in iter.collectionSelector(i) - push!(results,iter.resultSelector(i,j)) + push!(results, iter.resultSelector(i, j)) end end - if length(results)==0 + if length(results) == 0 return nothing end - return results[1], (results,2) + return results[1], (results, 2) end function Base.iterate(iter::EnumerableMapMany{T,SO,CS,RS}, state) where {T,SO,CS,RS} - if state[2]>length(state[1]) + if state[2] > length(state[1]) return nothing else - return state[1][state[2]], (state[1], state[2]+1) + return state[1][state[2]], (state[1], state[2] + 1) end end diff --git a/src/enumerable/enumerable_orderby.jl b/src/enumerable/enumerable_orderby.jl index b815d7e..07a6500 100644 --- a/src/enumerable/enumerable_orderby.jl +++ b/src/enumerable/enumerable_orderby.jl @@ -1,4 +1,4 @@ -struct EnumerableOrderby{T,S,KS<:Function,TKS} <: Enumerable +struct EnumerableOrderby{T,S,KS <: Function,TKS} <: Enumerable source::S keySelector::KS descending::Bool @@ -16,7 +16,7 @@ function orderby(source::Enumerable, f::Function, f_expr::Expr) KS = typeof(f) - return EnumerableOrderby{T,typeof(source), KS,TKS}(source, f, false) + return EnumerableOrderby{T,typeof(source),KS,TKS}(source, f, false) end function orderby_descending(source::Enumerable, f::Function, f_expr::Expr) @@ -43,24 +43,24 @@ function Base.iterate(iter::EnumerableOrderby{T,S,KS,TKS}) where {T,S,KS,TKS} end end - if length(elements)==0 + if length(elements) == 0 return nothing end - sort!(elements, by=iter.keySelector, rev=iter.descending) + sort!(elements, by = iter.keySelector, rev = iter.descending) return elements[1], (elements, 2) end function Base.iterate(iter::EnumerableOrderby{T,S,KS,TKS}, state) where {T,S,KS,TKS} - if state[2]>length(state[1]) + if state[2] > length(state[1]) return nothing else - return state[1][state[2]], (state[1], state[2]+1) + return state[1][state[2]], (state[1], state[2] + 1) end end -struct EnumerableThenBy{T,S,KS<:Function,TKS} <: Enumerable +struct EnumerableThenBy{T,S,KS <: Function,TKS} <: Enumerable source::S keySelector::KS descending::Bool @@ -91,12 +91,12 @@ function Base.iterate(iter::EnumerableThenBy{T,S,KS,TKS}) where {T,S,KS,TKS} directions = [source.descending, iter.descending] while !isa(source, EnumerableOrderby) source = source.source - insert!(keySelectors,1,source.keySelector) - insert!(directions,1,source.descending) + insert!(keySelectors, 1, source.keySelector) + insert!(directions, 1, source.descending) end keySelector = element->[i(element) for i in keySelectors] - lt = (t1,t2) -> begin + lt = (t1, t2)->begin n1, n2 = length(t1), length(t2) for i = 1:min(n1, n2) a, b = t1[i], t2[i] @@ -115,26 +115,26 @@ function Base.iterate(iter::EnumerableThenBy{T,S,KS,TKS}) where {T,S,KS,TKS} if (Base.IteratorSize(typeof(iter)) isa Base.HasLength || Base.IteratorSize(typeof(iter)) isa Base.HasShape) for i in enumerate(iter.source) elements[i[1]] = i[2] - end + end else for i in iter.source push!(elements, i) end end - if length(elements)==0 + if length(elements) == 0 return nothing end - sort!(elements, by=keySelector, lt=lt) + sort!(elements, by = keySelector, lt = lt) return elements[1], (elements, 2) end function Base.iterate(iter::EnumerableThenBy{T,S,KS,TKS}, state) where {T,S,KS,TKS} - if state[2]>length(state[1]) + if state[2] > length(state[1]) return nothing else - return state[1][state[2]], (state[1], state[2]+1) + return state[1][state[2]], (state[1], state[2] + 1) end end diff --git a/src/enumerable/enumerable_take.jl b/src/enumerable/enumerable_take.jl index 0fe29ae..94e1c31 100644 --- a/src/enumerable/enumerable_take.jl +++ b/src/enumerable/enumerable_take.jl @@ -13,30 +13,30 @@ Base.IteratorSize(::Type{EnumerableTake{T,S}}) where {T,S} = haslength(S) Base.eltype(::Type{EnumerableTake{T,S}}) where {T,S} = T -Base.length(iter::EnumerableTake{T,S}) where {T,S} = min(length(iter.source),iter.n) +Base.length(iter::EnumerableTake{T,S}) where {T,S} = min(length(iter.source), iter.n) function Base.iterate(iter::EnumerableTake{T,S}) where {T,S} ret = iterate(iter.source) - if ret===nothing + if ret === nothing return nothing - elseif iter.n==0 + elseif iter.n == 0 return nothing else - return ret[1], (ret[2],1) + return ret[1], (ret[2], 1) end end function Base.iterate(iter::EnumerableTake{T,S}, state) where {T,S} - if state[2]==iter.n + if state[2] == iter.n return nothing else ret = iterate(iter.source, state[1]) - if ret===nothing + if ret === nothing return nothing else - return ret[1], (ret[2], state[2]+1) + return ret[1], (ret[2], state[2] + 1) end end end diff --git a/src/enumerable/enumerable_unique.jl b/src/enumerable/enumerable_unique.jl index aa733e9..c8b6a91 100644 --- a/src/enumerable/enumerable_unique.jl +++ b/src/enumerable/enumerable_unique.jl @@ -1,4 +1,4 @@ -struct EnumerableUnique{T,TKEY,S,Q<:Function} <: Enumerable +struct EnumerableUnique{T,TKEY,S,Q <: Function} <: Enumerable source::S f::Q end @@ -14,8 +14,8 @@ Base.eltype(::Type{EnumerableUnique{T,TKEY,S,Q}}) where {T,TKEY,S,Q} = T function Base.iterate(iter::EnumerableUnique{T,TKEY,S,Q}) where {T,TKEY,S,Q} ret = iterate(iter.source) - - ret===nothing && return nothing + + ret === nothing && return nothing observed_keys = Set{TKEY}() @@ -26,24 +26,24 @@ function Base.iterate(iter::EnumerableUnique{T,TKEY,S,Q}) where {T,TKEY,S,Q} push!(observed_keys, key_first_element) - return first_element, (observed_keys=observed_keys, source_state=source_state) + return first_element, (observed_keys = observed_keys, source_state = source_state) end function Base.iterate(iter::EnumerableUnique{T,TKEY,S,Q}, state) where {T,TKEY,S,Q} ret = iterate(iter.source, state.source_state) - ret===nothing && return nothing + ret === nothing && return nothing while true current_element = ret[1] - key_current_element=iter.f(current_element) + key_current_element = iter.f(current_element) if key_current_element in state.observed_keys ret = iterate(iter.source, ret[2]) - ret===nothing && return nothing + ret === nothing && return nothing else push!(state.observed_keys, key_current_element) - return current_element, (observed_keys=state.observed_keys, source_state=ret[2]) + return current_element, (observed_keys = state.observed_keys, source_state = ret[2]) end end end diff --git a/src/enumerable/show.jl b/src/enumerable/show.jl index 4aa32e7..8b00c37 100644 --- a/src/enumerable/show.jl +++ b/src/enumerable/show.jl @@ -8,16 +8,16 @@ function printsequence(io::IO, source::Enumerable) i = 1 foo = iterate(source) - while foo!==nothing + while foo !== nothing v, s = foo println(io) - if i==max_element_to_show+1 + if i == max_element_to_show + 1 print(io, "... with ") - if Base.IteratorSize(source)!=Base.HasLength() + if Base.IteratorSize(source) != Base.HasLength() print(io, " more elements") else extra_rows = length(source) - max_element_to_show - print(io, "$extra_rows more $(extra_rows==1 ? "element" : "elements")") + print(io, "$extra_rows more $(extra_rows == 1 ? "element" : "elements")") end break else diff --git a/src/operators.jl b/src/operators.jl index 29fd4f5..e22365f 100644 --- a/src/operators.jl +++ b/src/operators.jl @@ -34,14 +34,14 @@ end function groupby end -macro groupby(source,elementSelector,resultSelector) +macro groupby(source, elementSelector, resultSelector) q_elementSelector = Expr(:quote, elementSelector) q_resultSelector = Expr(:quote, resultSelector) :(groupby($(esc(source)), $(esc(elementSelector)), $(esc(q_elementSelector)), $(esc(resultSelector)), $(esc(q_resultSelector)))) end -macro groupby_simple(source,elementSelector) +macro groupby_simple(source, elementSelector) q_elementSelector = Expr(:quote, elementSelector) :(groupby($(esc(source)), $(esc(elementSelector)), $(esc(q_elementSelector)))) @@ -54,7 +54,7 @@ macro groupjoin(outer, inner, outerKeySelector, innerKeySelector, resultSelector q_innerKeySelector = Expr(:quote, innerKeySelector) q_resultSelector = Expr(:quote, resultSelector) - :(groupjoin($(esc(outer)), $(esc(inner)), $(esc(outerKeySelector)), $(esc(q_outerKeySelector)), $(esc(innerKeySelector)),$(esc(q_innerKeySelector)), $(esc(resultSelector)),$(esc(q_resultSelector)))) + :(groupjoin($(esc(outer)), $(esc(inner)), $(esc(outerKeySelector)), $(esc(q_outerKeySelector)), $(esc(innerKeySelector)), $(esc(q_innerKeySelector)), $(esc(resultSelector)), $(esc(q_resultSelector)))) end function join end @@ -64,7 +64,7 @@ macro join(outer, inner, outerKeySelector, innerKeySelector, resultSelector) q_innerKeySelector = Expr(:quote, innerKeySelector) q_resultSelector = Expr(:quote, resultSelector) - :(join($(esc(outer)), $(esc(inner)), $(esc(outerKeySelector)), $(esc(q_outerKeySelector)), $(esc(innerKeySelector)),$(esc(q_innerKeySelector)), $(esc(resultSelector)),$(esc(q_resultSelector)))) + :(join($(esc(outer)), $(esc(inner)), $(esc(outerKeySelector)), $(esc(q_outerKeySelector)), $(esc(innerKeySelector)), $(esc(q_innerKeySelector)), $(esc(resultSelector)), $(esc(q_resultSelector)))) end function map end @@ -76,7 +76,7 @@ end function mapmany end -macro mapmany(source,collectionSelector,resultSelector) +macro mapmany(source, collectionSelector, resultSelector) q_collectionSelector = Expr(:quote, collectionSelector) q_resultSelector = Expr(:quote, resultSelector) diff --git a/test/runtests.jl b/test/runtests.jl index da271c0..ef9149e 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -4,138 +4,138 @@ using Test @testset "QueryOperators" begin -@testset "Core" begin + @testset "Core" begin -source_1 = [1,2,2,3,4] -enum = QueryOperators.query(source_1) + source_1 = [1,2,2,3,4] + enum = QueryOperators.query(source_1) -@test collect(QueryOperators.@filter(QueryOperators.query(source_1), i->i>2)) == [3,4] + @test collect(QueryOperators.@filter(QueryOperators.query(source_1), i->i > 2)) == [3,4] -@test collect(QueryOperators.@map(QueryOperators.query(source_1), i->i^2)) == [1,4,4,9,16] + @test collect(QueryOperators.@map(QueryOperators.query(source_1), i->i^2)) == [1,4,4,9,16] -@test collect(QueryOperators.@take(enum, 2)) == [1,2] -@test collect(QueryOperators.@drop(enum, 2)) == [2,3,4] -@test QueryOperators.@count(enum) == 5 -@test QueryOperators.@count(enum, x->x%2==0) == 3 + @test collect(QueryOperators.@take(enum, 2)) == [1,2] + @test collect(QueryOperators.@drop(enum, 2)) == [2,3,4] + @test QueryOperators.@count(enum) == 5 + @test QueryOperators.@count(enum, x->x % 2 == 0) == 3 -dropped_str = "" -for i in QueryOperators.drop(enum, 2) - dropped_str *= string(i) -end -@test dropped_str == "234" + dropped_str = "" + for i in QueryOperators.drop(enum, 2) + dropped_str *= string(i) + end + @test dropped_str == "234" -dropped_str = "" -for i in QueryOperators.drop(enum, 80) - dropped_str *= string(i) -end -@test dropped_str == "" + dropped_str = "" + for i in QueryOperators.drop(enum, 80) + dropped_str *= string(i) + end + @test dropped_str == "" -taken_str = "" -for i in QueryOperators.take(enum, 2) - taken_str *= string(i) -end -@test taken_str == "12" + taken_str = "" + for i in QueryOperators.take(enum, 2) + taken_str *= string(i) + end + @test taken_str == "12" -filtered_str = "" -for i in QueryOperators.@filter(enum, x->x%2==0) - filtered_str *= string(i) -end -@test filtered_str == "224" + filtered_str = "" + for i in QueryOperators.@filter(enum, x->x % 2 == 0) + filtered_str *= string(i) + end + @test filtered_str == "224" -filtered_str = "" -for i in QueryOperators.@filter(enum, x->x>100) - filtered_str *= string(i) -end -@test filtered_str == "" + filtered_str = "" + for i in QueryOperators.@filter(enum, x->x > 100) + filtered_str *= string(i) + end + @test filtered_str == "" -@test collect(QueryOperators.@filter(enum, x->x<3)) == [1,2,2] + @test collect(QueryOperators.@filter(enum, x->x < 3)) == [1,2,2] -grouped = [] -for i in QueryOperators.@groupby(QueryOperators.query(source_1), i->i, i->i^2) - push!(grouped, i) -end + grouped = [] + for i in QueryOperators.@groupby(QueryOperators.query(source_1), i->i, i->i^2) + push!(grouped, i) + end -@test grouped == [[1],[4,4],[9],[16]] + @test grouped == [[1],[4,4],[9],[16]] -mapped = [] -for i in collect(QueryOperators.@map(enum, i->i*3)) - push!(mapped, i) -end -@test mapped == [3,6,6,9,12] + mapped = [] + for i in collect(QueryOperators.@map(enum, i->i * 3)) + push!(mapped, i) + end + @test mapped == [3,6,6,9,12] # ensure that the default value must be of the same type -errored = false -try - QueryOperators.@default_if_empty(source_1, "string") -catch - errored = true -end + errored = false + try + QueryOperators.@default_if_empty(source_1, "string") + catch + errored = true + end -@test errored == true + @test errored == true # default_if_empty for regular array -d = [] -for i in QueryOperators.@default_if_empty(source_1, 0) - push!(d, i) -end -@test d == [1, 2, 2, 3, 4] + d = [] + for i in QueryOperators.@default_if_empty(source_1, 0) + push!(d, i) + end + @test d == [1, 2, 2, 3, 4] -@test collect(QueryOperators.default_if_empty(DataValue{Int}[]))[1] == DataValue{Int}() -@test collect(QueryOperators.default_if_empty(DataValue{Int}[], DataValue{Int}()))[1] == DataValue{Int}() + @test collect(QueryOperators.default_if_empty(DataValue{Int}[]))[1] == DataValue{Int}() + @test collect(QueryOperators.default_if_empty(DataValue{Int}[], DataValue{Int}()))[1] == DataValue{Int}() # passing in a NamedTuple of DataValues -nt = (a=DataValue(2), b=DataValue("test"), c=DataValue(3)) -def = QueryOperators.default_if_empty(typeof(nt)[]) -@test typeof(collect(def)[1]) == typeof(nt) + nt = (a = DataValue(2), b = DataValue("test"), c = DataValue(3)) + def = QueryOperators.default_if_empty(typeof(nt)[]) + @test typeof(collect(def)[1]) == typeof(nt) -ordered = QueryOperators.@orderby(enum, x -> -x) -@test collect(ordered) == [4, 3, 2, 2, 1] + ordered = QueryOperators.@orderby(enum, x->-x) + @test collect(ordered) == [4, 3, 2, 2, 1] -filtered = QueryOperators.@orderby(QueryOperators.@filter(enum, x->x%2 == 0), x->x) -@test collect(filtered) == [2, 2, 4] + filtered = QueryOperators.@orderby(QueryOperators.@filter(enum, x->x % 2 == 0), x->x) + @test collect(filtered) == [2, 2, 4] -ordered = QueryOperators.@orderby_descending(enum, x -> -x) -@test collect(ordered) == [1, 2, 2, 3, 4] + ordered = QueryOperators.@orderby_descending(enum, x->-x) + @test collect(ordered) == [1, 2, 2, 3, 4] -desired = [[1], [2, 2, 3], [4]] -grouped = QueryOperators.@groupby(enum, x -> floor(x/2), x->x) -@test collect(grouped) == desired + desired = [[1], [2, 2, 3], [4]] + grouped = QueryOperators.@groupby(enum, x->floor(x / 2), x->x) + @test collect(grouped) == desired -group_no_macro = QueryOperators.groupby(enum, x -> floor(x/2), quote x->floor(x/2) end) -@test collect(group_no_macro) == desired + group_no_macro = QueryOperators.groupby(enum, x->floor(x / 2), quote x->floor(x / 2) end) + @test collect(group_no_macro) == desired -outer = QueryOperators.query([1,2,3,4,5,6]) -inner = QueryOperators.query([2,3,4,5]) + outer = QueryOperators.query([1,2,3,4,5,6]) + inner = QueryOperators.query([2,3,4,5]) -join_desired = [[3,2], [4,3], [5,4], [6,5]] -@test collect(QueryOperators.@join(outer, inner, x->x, x->x+1, (i,j)->[i,j])) == join_desired + join_desired = [[3,2], [4,3], [5,4], [6,5]] + @test collect(QueryOperators.@join(outer, inner, x->x, x->x + 1, (i, j)->[i,j])) == join_desired -group_desired = [[1, Int64[]], [2, Int64[]], [3, [2]], [4, [3]], [5, [4]], [6, [5]]] -@test collect(QueryOperators.@groupjoin(outer, inner, x->x, x->x+1, (i,j)->[i,j])) == group_desired + group_desired = [[1, Int64[]], [2, Int64[]], [3, [2]], [4, [3]], [5, [4]], [6, [5]]] + @test collect(QueryOperators.@groupjoin(outer, inner, x->x, x->x + 1, (i, j)->[i,j])) == group_desired -many_map_desired = [[1, 2], [2, 4], [2, 4], [3, 6], [4, 8]] -success = collect(QueryOperators.@mapmany(enum, x->[x*2], (x,y)->[x,y])) == many_map_desired -@test success # for some reason, this is required to avoid a BoundsError + many_map_desired = [[1, 2], [2, 4], [2, 4], [3, 6], [4, 8]] + success = collect(QueryOperators.@mapmany(enum, x->[x * 2], (x, y)->[x,y])) == many_map_desired + @test success # for some reason, this is required to avoid a BoundsError -first = QueryOperators.query([1, 2]) -second = [3, 4] -many_map_desired = [(1,3), (1,4), (2,3), (2,4)] -success = collect(QueryOperators.@mapmany(first, i->second, (x,y)->(x,y))) == many_map_desired -@test success + first = QueryOperators.query([1, 2]) + second = [3, 4] + many_map_desired = [(1, 3), (1, 4), (2, 3), (2, 4)] + success = collect(QueryOperators.@mapmany(first, i->second, (x, y)->(x, y))) == many_map_desired + @test success -ntups = QueryOperators.query([(a=1, b=2, c=3), (a=4, b=5, c=6)]) + ntups = QueryOperators.query([(a = 1, b = 2, c = 3), (a = 4, b = 5, c = 6)]) -@test sprint(show, ntups) == """ + @test sprint(show, ntups) == """ 2x3 query result a │ b │ c ──┼───┼── 1 │ 2 │ 3 4 │ 5 │ 6""" -@test sprint(show, enum) == """ + @test sprint(show, enum) == """ 5-element query result 1 2 @@ -144,21 +144,21 @@ a │ b │ c 4""" -@test sprint((stream,data)->show(stream, "text/html", data), ntups) == + @test sprint((stream, data)->show(stream, "text/html", data), ntups) == "
a | b | c |
---|---|---|
1 | 2 | 3 |
4 | 5 | 6 |