Skip to content

Commit

Permalink
Merge pull request #10 from PharmCat/dev
Browse files Browse the repository at this point in the history
v0.11.3
  • Loading branch information
PharmCat authored May 9, 2023
2 parents 8b1b5d5 + 3c420d4 commit 809bee6
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 4 deletions.
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name = "MetidaBase"
uuid = "075456b7-4006-432f-9324-2f8453996c49"
authors = ["PharmCat <[email protected]> and contributors"]
version = "0.11.2"
version = "0.11.3"

[deps]
CategoricalArrays = "324d7699-5711-5eae-9e2f-1d82baa6b597"
Expand Down
6 changes: 3 additions & 3 deletions src/dataset.jl
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ function getdata(d::DataSet)
d.ds
end

@inline function getindormiss(d::Dict{K}, i::K) where K
@inline function getindormiss(d::AbstractDict{K}, i::K) where K
if haskey(d, i) return d[i] end
missing
end
Expand Down Expand Up @@ -81,7 +81,7 @@ end
################################################################################
# sort!
################################################################################
function islessdict(a::Dict{A1,A2}, b::Dict{B1,B2}, k::Union{AbstractVector, Set}) where A1 where A2 where B1 where B2
function islessdict(a::AbstractDict{A1,A2}, b::AbstractDict{B1,B2}, k::Union{AbstractVector, Set}) where A1 where A2 where B1 where B2
l = length(k)
av = Vector{Union{Missing, A2}}(undef, l)
bv = Vector{Union{Missing, B2}}(undef, l)
Expand All @@ -91,7 +91,7 @@ function islessdict(a::Dict{A1,A2}, b::Dict{B1,B2}, k::Union{AbstractVector, Set
end
isless(av, bv)
end
function islessdict(a::Dict, b::Dict, k)
function islessdict(a::AbstractDict, b::AbstractDict, k)
isless(getindormiss(a, k), getindormiss(b, k))
end
function Base.sort!(d::DataSet{T}, k; alg::Base.Algorithm = QuickSort, lt=nothing, by=nothing, rev::Bool=false, order::Base.Ordering = Base.Forward) where T <: Union{AbstractIdData, AbstractIDResult}
Expand Down
8 changes: 8 additions & 0 deletions test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,9 @@ using Test, Tables, TypedTables, DataFrames, CSV
end
exidds = MetidaBase.DataSet(exiddsv)
############################################################################
@test Tables.istable(exidds) == false
@test Tables.rowaccess(exidds) == false
############################################################################
item = ExampleIDStruct(Dict(:c => 6, :j => 6))
ds1 = deepcopy(exidds)
ds2 = deepcopy(exidds)
Expand Down Expand Up @@ -123,6 +126,11 @@ using Test, Tables, TypedTables, DataFrames, CSV
@test exrsds[1, :r1] == 3

@test MetidaBase.getid(exidds[3], :a) == 2

dsr = exrsds[1:2]
@test length(dsr) == 2
@test exrsds[1] === dsr[1]
@test exrsds[2] === dsr[2]
######################################################################
# SORT
######################################################################
Expand Down

2 comments on commit 809bee6

@PharmCat
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@JuliaRegistrator
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Registration pull request created: JuliaRegistries/General/83147

After the above pull request is merged, it is recommended that a tag is created on this repository for the registered package version.

This will be done automatically if the Julia TagBot GitHub Action is installed, or can be done manually through the github interface, or via:

git tag -a v0.11.3 -m "<description of version>" 809bee663350f34744d8f63f19a6bc597ee264a5
git push origin v0.11.3

Please sign in to comment.