Skip to content

Commit 64cc589

Browse files
authored
Merge pull request #643 from JuliaCollections/ox/break
Mark as 0.18-DEV and remove deprecations
2 parents a60cd18 + 9c11640 commit 64cc589

18 files changed

+22
-210
lines changed

Project.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
name = "DataStructures"
22
uuid = "864edb3b-99cc-5e75-8d2d-829cb0a9cfe8"
3-
version = "0.17.20"
3+
version = "0.18.0-DEV"
44

55
[deps]
66
InteractiveUtils = "b77e0a4c-d291-57a0-90e8-8db25a27a240"

docs/src/heaps.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,9 @@ isempty(h) # returns whether the heap is empty
1515

1616
push!(h, v) # add a value to the heap
1717

18-
top(h) # return the top value of a heap
18+
first(h) # return the first (top) value of a heap
1919

20-
pop!(h) # removes the top value, and returns it
20+
pop!(h) # removes the first (top) value, and returns it
2121

2222
```
2323

@@ -73,7 +73,7 @@ popmax!(h, k) # remove and return the largest k elements
7373
popall!(h) # remove and return all the elements, sorted smallest to largest
7474
popall!(h, o) # remove and return all the elements according to ordering o
7575
```
76-
The usual `top(h)` and `pop!(h)` are defined to be `minimum(h)` and `popmin!(h)`,
76+
The usual `first(h)` and `pop!(h)` are defined to be `minimum(h)` and `popmin!(h)`,
7777
respectively.
7878

7979
This package includes an implementation of a binary min-max heap (`BinaryMinMaxHeap`).

src/DataStructures.jl

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -27,12 +27,7 @@ module DataStructures
2727
export capacity, num_blocks, top_with_handle, sizehint!
2828

2929
export Accumulator, counter, reset!, inc!, dec!
30-
31-
export ClassifiedCollections
32-
export classified_lists, classified_sets, classified_counters
33-
3430
export IntDisjointSets, DisjointSets, num_groups, find_root!, in_same_set, root_union!
35-
3631
export FenwickTree, length, inc!, dec!, incdec!, prefixsum
3732

3833
export AbstractHeap, compare, extract_all!
@@ -70,7 +65,6 @@ module DataStructures
7065
include("stack.jl")
7166
include("queue.jl")
7267
include("accumulator.jl")
73-
include("classified_collections.jl")
7468
include("disjoint_set.jl")
7569
include("heaps.jl")
7670

src/classified_collections.jl

Lines changed: 0 additions & 55 deletions
This file was deleted.

src/default_dict.jl

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,6 @@ DefaultDictBase{K,V}(default::F; kwargs...) where {K,V,F} = DefaultDictBase{K,V,
5959
@delegate_return_parent DefaultDictBase.d [ delete!, empty!, setindex!, sizehint! ]
6060

6161
empty(d::DefaultDictBase{K,V,F}) where {K,V,F} = DefaultDictBase{K,V,F}(d.default; passkey=d.passkey)
62-
@deprecate similar(d::DefaultDictBase) empty(d)
6362

6463
getindex(d::DefaultDictBase, key) = get!(d.d, key, d.default)
6564

@@ -144,8 +143,6 @@ for _Dict in [:Dict, :OrderedDict]
144143

145144
empty(d::$DefaultDict{K,V,F}) where {K,V,F} = $DefaultDict{K,V,F}(d.d.default)
146145
in(key, v::Base.KeySet{K,T}) where {K,T<:$DefaultDict{K}} = key in keys(v.dict.d.d)
147-
148-
@deprecate similar(d::$DefaultDict) empty(d)
149146
end
150147
end
151148

src/deprecations.jl

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,3 @@
1-
@deprecate front(x) first(x)
2-
@deprecate back(x) last(x)
3-
@deprecate top(x) first(x)
4-
#@deprecate find_root find_root! # 2020-03-31 - deprecate in v0.18, or when Julia 1.5 is released.
5-
export find_root
6-
const find_root = find_root!
7-
8-
@deprecate deque(::Type{T}) where {T} Deque{T}()
9-
10-
@deprecate path(t::Trie, str::AbstractString) partial_path(t::Trie, str::AbstractString)
1+
# 0.18 deprecations. Remove before releasing 0.19
2+
@deprecate path(t::Trie, str::AbstractString) partial_path(t::Trie, str::AbstractString)
3+
@deprecate find_root find_root!

src/heaps.jl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,9 @@
2424
#
2525
# - sizehint!(h, s) set size hint to a heap
2626
#
27-
# - top(h) return the top value of a heap
27+
# - first(h) return the first (top) value of a heap
2828
#
29-
# - pop!(h) removes the top value, and
29+
# - pop!(h) removes the first (top) value, and
3030
# returns it
3131
#
3232
# For mutable heaps, it should also support
@@ -113,7 +113,7 @@ function nextreme(comp::Comp, n::Int, arr::AbstractVector{T}) where {T, Comp}
113113

114114
for i = n + 1 : length(arr)
115115
@inbounds xi = arr[i]
116-
if compare(comp, top(buffer), xi)
116+
if compare(comp, first(buffer), xi)
117117
# This could use a pushpop method
118118
pop!(buffer)
119119
push!(buffer, xi)

src/heaps/binary_heap.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -144,10 +144,10 @@ function sizehint!(h::BinaryHeap, s::Integer)
144144
end
145145

146146
"""
147-
top(h::BinaryHeap)
147+
first(h::BinaryHeap)
148148
149149
Returns the element at the top of the heap `h`.
150150
"""
151-
@inline top(h::BinaryHeap) = h.valtree[1]
151+
@inline first(h::BinaryHeap) = h.valtree[1]
152152

153153
pop!(h::BinaryHeap{T}) where {T} = _binary_heap_pop!(h.comparer, h.valtree)

src/heaps/minmax_heap.jl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -244,11 +244,11 @@ function push!(h::BinaryMinMaxHeap, v)
244244
end
245245

246246
"""
247-
top(h::BinaryMinMaxHeap)
247+
first(h::BinaryMinMaxHeap)
248248
249-
Get the top (minimum) of the heap.
249+
Get the first (minimum) of the heap.
250250
"""
251-
@inline top(h::BinaryMinMaxHeap) = minimum(h)
251+
@inline first(h::BinaryMinMaxHeap) = minimum(h)
252252

253253
@inline function minimum(h::BinaryMinMaxHeap)
254254
valtree = h.valtree

src/heaps/mutable_binary_heap.jl

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -178,14 +178,6 @@ const MutableBinaryMaxHeap{T} = MutableBinaryHeap{T, GreaterThan}
178178
MutableBinaryMinHeap(xs::AbstractVector{T}) where T = MutableBinaryMinHeap{T}(xs)
179179
MutableBinaryMaxHeap(xs::AbstractVector{T}) where T = MutableBinaryMaxHeap{T}(xs)
180180

181-
# deprecated constructors
182-
183-
@deprecate mutable_binary_minheap(::Type{T}) where {T} MutableBinaryMinHeap{T}()
184-
@deprecate mutable_binary_minheap(xs::AbstractVector{T}) where {T} MutableBinaryMinHeap(xs)
185-
@deprecate mutable_binary_maxheap(::Type{T}) where {T} MutableBinaryMaxHeap{T}()
186-
@deprecate mutable_binary_maxheap(xs::AbstractVector{T}) where {T} MutableBinaryMaxHeap(xs)
187-
188-
189181
function show(io::IO, h::MutableBinaryHeap)
190182
print(io, "MutableBinaryHeap(")
191183
nodes = h.nodes
@@ -227,7 +219,7 @@ function sizehint!(h::MutableBinaryHeap, s::Integer)
227219
return h
228220
end
229221

230-
@inline top(h::MutableBinaryHeap) = h.nodes[1].value
222+
@inline first(h::MutableBinaryHeap) = h.nodes[1].value
231223

232224
"""
233225
top_with_handle(h::MutableBinaryHeap)

src/multi_dict.jl

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,8 +52,6 @@ empty(d::MultiDict{K,V}) where {K,V} = MultiDict{K,V}()
5252
delete!(d::MultiDict, key) = (delete!(d.d, key); d)
5353
empty!(d::MultiDict) = (empty!(d.d); d)
5454

55-
@deprecate similar(d::MultiDict) empty(d)
56-
5755
function insert!(d::MultiDict{K,V}, k, v) where {K,V}
5856
if !haskey(d.d, k)
5957
d.d[k] = V[]

src/sorted_dict.jl

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -623,6 +623,4 @@ empty). Time: O(1)
623623
empty(m::SortedDict{K,D,Ord}) where {K,D,Ord<:Ordering} =
624624
SortedDict{K,D,Ord}(orderobject(m))
625625

626-
@deprecate similar(m::SortedDict) empty(m)
627-
628626
isordered(::Type{T}) where {T<:SortedDict} = true

test/runtests.jl

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ tests = ["deprecations",
1616
"stack",
1717
"queue",
1818
"accumulator",
19-
"classified_collections",
2019
"disjoint_set",
2120
"binheap",
2221
"mutable_binheap",

test/test_binheap.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010

1111
@test length(h) == 10
1212
@test !isempty(h)
13-
@test top(h) == 1
13+
@test first(h) == 1
1414
@test isequal(h.valtree, [1, 2, 3, 4, 7, 9, 10, 14, 8, 16])
1515
@test sizehint!(h, 100) === h
1616
end
@@ -20,7 +20,7 @@
2020

2121
@test length(h) == 10
2222
@test !isempty(h)
23-
@test top(h) == 16
23+
@test first(h) == 16
2424
@test isequal(h.valtree, [16, 14, 10, 8, 7, 3, 9, 1, 4, 2])
2525
@test sizehint!(h, 100) === h
2626
end

test/test_classified_collections.jl

Lines changed: 0 additions & 87 deletions
This file was deleted.

test/test_deque.jl

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -197,9 +197,4 @@
197197
@test typeof(empty!(q)) === typeof(Deque{Int}())
198198
@test isempty(q)
199199
end
200-
201-
@testset "deprecated constructors" begin
202-
@test_deprecated deque(Int)
203-
end
204-
205200
end # @testset Deque

test/test_minmax_heap.jl

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ using Base.Order: Forward, Reverse
2828
h = BinaryMinMaxHeap(vs)
2929
@test length(h) == 10
3030
@test !isempty(h)
31-
@test top(h) == minimum(h) == 1
31+
@test first(h) == minimum(h) == 1
3232
@test maximum(h) == 20
3333
@test is_minmax_heap(h.valtree)
3434
end
@@ -48,7 +48,7 @@ using Base.Order: Forward, Reverse
4848
@test isempty(h)
4949

5050
push!(h, 1)
51-
@test top(h) == 1
51+
@test first(h) == 1
5252
push!(h, 2)
5353
@test is_minmax_heap(h.valtree)
5454
push!(h, 10)
@@ -163,10 +163,8 @@ using Base.Order: Forward, Reverse
163163
h = BinaryMinMaxHeap{Int}()
164164
@test_throws ArgumentError pop!(h)
165165
@test_throws ArgumentError popmin!(h)
166-
167166
@test_throws ArgumentError popmax!(h)
168167

169-
@test_throws ArgumentError top(h)
170168
@test_throws ArgumentError minimum(h)
171169
@test_throws ArgumentError maximum(h)
172170

0 commit comments

Comments
 (0)