Skip to content

Commit bbefdf7

Browse files
committed
remove deprecations, including lingering references to top
1 parent c3b0927 commit bbefdf7

13 files changed

+21
-60
lines changed

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/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/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

0 commit comments

Comments
 (0)