-
Notifications
You must be signed in to change notification settings - Fork 18
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Drop all v1 deprecations for v2 #214
Open
rofinn
wants to merge
6
commits into
v2-DEV
Choose a base branch
from
rf/drop-deps
base: v2-DEV
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
cde39c3
Drop deprecated DateTime constructors.
rofinn 066ac31
Drop deprecated Interval constructors.
rofinn 8df18d1
Drop deprecated Endpoint constructors.
rofinn 02e5964
Drop deprecated AnchoredInterval constructors.
rofinn ed55f07
Drop deprecated Inclusivity type completely.
rofinn eb2afc1
Drop interval set deprecations.
rofinn File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,202 +1,5 @@ | ||
using Base: @deprecate, depwarn | ||
import Dates: Date, DateTime | ||
|
||
# BEGIN Intervals 1.X.Y deprecations | ||
# BEGIN Intervals 2.X.Y deprecations | ||
|
||
export Inclusivity, inclusivity | ||
include("inclusivity.jl") | ||
|
||
@deprecate Date(interval::Interval{Date}) convert(Date, interval) | ||
@deprecate DateTime(interval::Interval{DateTime}) convert(DateTime, interval) | ||
@deprecate Date(interval::AnchoredInterval{P, Date} where P) convert(Date, interval) | ||
@deprecate DateTime(interval::AnchoredInterval{P, DateTime} where P) convert(DateTime, interval) | ||
|
||
|
||
function Endpoint{T,D}(ep::T, included::Bool) where {T,D} | ||
B = bound_type(included) | ||
depwarn("`Endpoint{T,D}(ep, $included)` is deprecated, use `Endpoint{T,D,$(repr(B))}(ep)` instead.", :Endpoint) | ||
return Endpoint{T,D,B}(ep) | ||
end | ||
|
||
function LeftEndpoint(ep, included::Bool) | ||
B = bound_type(included) | ||
depwarn("`LeftEndpoint(ep, $included)` is deprecated, use `LeftEndpoint{$(repr(B))}(ep)` instead.", :LeftEndpoint) | ||
return LeftEndpoint{B}(ep) | ||
end | ||
|
||
function RightEndpoint(ep, included::Bool) | ||
B = bound_type(included) | ||
depwarn("`RightEndpoint(ep, $included)` is deprecated, use `RightEndpoint{$(repr(B))}(ep)` instead.", :RightEndpoint) | ||
return RightEndpoint{B}(ep) | ||
end | ||
|
||
# intervals.jl | ||
function Interval{T,L,R}(f::T, l::T, inc::Inclusivity) where {T,L,R} | ||
left_inc = bound_type(first(inc)) | ||
right_inc = bound_type(last(inc)) | ||
if L !== left_inc || R !== right_inc | ||
throw(ArgumentError("Specified inclusivity ($(repr(left_inc)), $(repr(right_inc))) doesn't match bound types ($(repr(L)), $(repr(R)))")) | ||
end | ||
depwarn("`Interval{T,$(repr(L)),$(repr(R))}(f, l, $(repr(inc)))` is deprecated, use `Interval{T,$(repr(L)),$(repr(R))}(f, l)` instead.", :Interval) | ||
return Interval{T,L,R}(f, l) | ||
end | ||
|
||
function Interval{T,L,R}(f, l, inc::Inclusivity) where {T,L,R} | ||
# Using depwarn from next call | ||
return Interval{T,L,R}(convert(T, f), convert(T, l), inc) | ||
end | ||
|
||
function Interval{T}(f, l, inc::Inclusivity) where T | ||
L = bound_type(first(inc)) | ||
R = bound_type(last(inc)) | ||
depwarn("`Interval{T}(f, l, $(repr(inc)))` is deprecated, use `Interval{T,$(repr(L)),$(repr(R))}(f, l)` instead.", :Interval) | ||
return Interval{T,L,R}(f, l) | ||
end | ||
|
||
function Interval{T}(f, l, x::Bool, y::Bool) where T | ||
L = bound_type(x) | ||
R = bound_type(y) | ||
depwarn("`Interval{T}(f, l, $x, $y)` is deprecated, use `Interval{T,$(repr(L)),$(repr(R))}(f, l)` instead.", :Interval) | ||
return Interval{T,L,R}(f, l) | ||
end | ||
|
||
function Interval(f, l, inc::Inclusivity) | ||
L = bound_type(first(inc)) | ||
R = bound_type(last(inc)) | ||
depwarn("`Interval(f, l, $(repr(inc)))` is deprecated, use `Interval{T,$(repr(L)),$(repr(R))}(f, l)` instead.", :Interval) | ||
return Interval{L,R}(f, l) | ||
end | ||
|
||
function Interval(f, l, x::Bool, y::Bool) | ||
L = bound_type(x) | ||
R = bound_type(y) | ||
depwarn("`Interval(f, l, $x, $y)` is deprecated, use `Interval{T,$(repr(L)),$(repr(R))}(f, l)` instead.", :Interval) | ||
return Interval{L,R}(f, l) | ||
end | ||
|
||
function inclusivity(interval::AbstractInterval{T,L,R}) where {T,L,R} | ||
depwarn("`inclusivity(interval)` is deprecated and has no direct replacement. See `bounds_types(interval)` for similar functionality.", :inclusivity) | ||
return Inclusivity(L === Closed, R === Closed; ignore_depwarn=true) | ||
end | ||
|
||
# anchoredintervals.jl | ||
function AnchoredInterval{P,T,L,R}(anchor::T, inc::Inclusivity) where {P,T,L,R} | ||
left_inc = bound_type(first(inc)) | ||
right_inc = bound_type(last(inc)) | ||
if L !== left_inc || R !== right_inc | ||
throw(ArgumentError("Specified inclusivity ($(repr(left_inc)), $(repr(right_inc))) doesn't match bound types ($(repr(L)), $(repr(R)))")) | ||
end | ||
depwarn("`AnchoredInterval{P,T,$(repr(L)),$(repr(R))}(anchor, $(repr(inc)))` is deprecated, use `AnchoredInterval{P,T,$(repr(L)),$(repr(R))}(anchor)` instead.", :AnchoredInterval) | ||
return AnchoredInterval{P,T,L,R}(anchor) | ||
end | ||
|
||
function AnchoredInterval{P,T,L,R}(anchor, inc::Inclusivity) where {P,T,L,R} | ||
# Using depwarn from next call | ||
return AnchoredInterval{P,T,L,R}(convert(T, anchor), inc) | ||
end | ||
|
||
function AnchoredInterval{P,T}(anchor, inc::Inclusivity) where {P,T} | ||
L = bound_type(first(inc)) | ||
R = bound_type(last(inc)) | ||
depwarn("`AnchoredInterval{P,T}(anchor, $(repr(inc)))` is deprecated, use `AnchoredInterval{P,T,$(repr(L)),$(repr(R))}(anchor)` instead.", :AnchoredInterval) | ||
return AnchoredInterval{P,T,L,R}(anchor) | ||
end | ||
|
||
function AnchoredInterval{P,T}(anchor, x::Bool, y::Bool) where {P,T} | ||
L = bound_type(x) | ||
R = bound_type(y) | ||
depwarn("`AnchoredInterval{P,T}(anchor, $x, $y)` is deprecated, use `AnchoredInterval{P,T,$(repr(L)),$(repr(R))}(anchor)` instead.", :AnchoredInterval) | ||
return AnchoredInterval{P,T,L,R}(anchor) | ||
end | ||
|
||
function AnchoredInterval{P}(anchor, inc::Inclusivity) where P | ||
L = bound_type(first(inc)) | ||
R = bound_type(last(inc)) | ||
depwarn("`AnchoredInterval{P}(anchor, $(repr(inc)))` is deprecated, use `AnchoredInterval{P,$(repr(L)),$(repr(R))}(anchor)` instead.", :AnchoredInterval) | ||
return AnchoredInterval{P,L,R}(anchor) | ||
end | ||
|
||
function AnchoredInterval{P}(anchor, x::Bool, y::Bool) where P | ||
L = bound_type(x) | ||
R = bound_type(y) | ||
depwarn("`AnchoredInterval{P}(anchor, $x, $y)` is deprecated, use `AnchoredInterval{P,$(repr(L)),$(repr(R))}(anchor)` instead.", :AnchoredInterval) | ||
return AnchoredInterval{P,L,R}(anchor) | ||
end | ||
|
||
function HourEnding(anchor, x::Bool, y::Bool) | ||
L = bound_type(x) | ||
R = bound_type(y) | ||
depwarn("`HourEnding(anchor, $x, $y)` is deprecated, use `HourEnding{$(repr(L)),$(repr(R))}(anchor)` instead.", :HourEnding) | ||
return HourEnding{L,R}(anchor) | ||
end | ||
|
||
function HourEnding(anchor, inc::Inclusivity) | ||
L = bound_type(first(inc)) | ||
R = bound_type(last(inc)) | ||
depwarn("`HourEnding(anchor, $(repr(inc)))` is deprecated, use `HourEnding{$(repr(L)),$(repr(R))}(anchor)` instead.", :HourEnding) | ||
return HourEnding{L,R}(anchor) | ||
end | ||
|
||
function HourBeginning(anchor, x::Bool, y::Bool) | ||
L = bound_type(x) | ||
R = bound_type(y) | ||
depwarn("`HourBeginning(anchor, $x, $y)` is deprecated, use `HourBeginning{$(repr(L)),$(repr(R))}(anchor)` instead.", :HourBeginning) | ||
return HourBeginning{L,R}(anchor) | ||
end | ||
|
||
function HourBeginning(anchor, inc::Inclusivity) | ||
L = bound_type(first(inc)) | ||
R = bound_type(last(inc)) | ||
depwarn("`HourBeginning(anchor, $(repr(inc)))` is deprecated, use `HourBeginning{$(repr(L)),$(repr(R))}(anchor)` instead.", :HourBeginning) | ||
return HourBeginning{L,R}(anchor) | ||
end | ||
|
||
function HE(anchor, x::Bool, y::Bool) | ||
L = bound_type(x) | ||
R = bound_type(y) | ||
if !x && y | ||
depwarn("`HE(anchor, $x, $y)` is deprecated, use `HE(anchor)` instead.", :HE) | ||
else | ||
depwarn("`HE(anchor, $x, $y)` is deprecated, use `HourEnding{$(repr(L)),$(repr(R))}(ceil(anchor, Hour))` instead.", :HE) | ||
end | ||
return HourEnding{L,R}(ceil(anchor, Hour)) | ||
end | ||
|
||
function HE(anchor, inc::Inclusivity) | ||
L = bound_type(first(inc)) | ||
R = bound_type(last(inc)) | ||
if !first(inc) && last(inc) | ||
depwarn("`HE(anchor, $(repr(inc)))` is deprecated, use `HE(anchor)` instead.", :HE) | ||
else | ||
depwarn("`HE(anchor, $(repr(inc)))` is deprecated, use `HourEnding{$(repr(L)),$(repr(R))}(ceil(anchor, Hour))` instead.", :HE) | ||
end | ||
return HourEnding{L,R}(ceil(anchor, Hour)) | ||
end | ||
|
||
function HB(anchor, x::Bool, y::Bool) | ||
L = bound_type(x) | ||
R = bound_type(y) | ||
if x && !y | ||
depwarn("`HB(anchor, $x, $y)` is deprecated, use `HB(anchor)` instead.", :HB) | ||
else | ||
depwarn("`HB(anchor, $x, $y)` is deprecated, use `HourBeginning{$(repr(L)),$(repr(R))}(floor(anchor, Hour))` instead.", :HB) | ||
end | ||
return HourBeginning{L,R}(floor(anchor, Hour)) | ||
end | ||
|
||
function HB(anchor, inc::Inclusivity) | ||
L = bound_type(first(inc)) | ||
R = bound_type(last(inc)) | ||
if first(inc) && !last(inc) | ||
depwarn("`HB(anchor, $(repr(inc)))` is deprecated, use `HB(anchor)` instead.", :HB) | ||
else | ||
depwarn("`HB(anchor, $(repr(inc)))` is deprecated, use `HourBeginning{$(repr(L)),$(repr(R))}(floor(anchor, Hour))` instead.", :HB) | ||
end | ||
return HourBeginning{L,R}(floor(anchor, Hour)) | ||
end | ||
|
||
@deprecate union(intervals::AbstractVector{<:AbstractInterval}) convert(Vector, union(IntervalSet(intervals))) | ||
@deprecate union!(intervals::AbstractVector{<:AbstractInterval}) convert(Vector, union!(IntervalSet(intervals))) | ||
@deprecate superset(intervals::AbstractVector{<:AbstractInterval}) superset(IntervalSet(intervals)) | ||
|
||
# END Intervals 1.X.Y deprecations | ||
# END Intervals 2.X.Y deprecations |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You removed the legacy deserialization tests but didn't remove the code from
compat.jl
which is what this tests. I think the reason you removed this is that the removal ofInclusivity
broke the code incompat.jl
but we can make a minor change to continue supporting deserialization of the old Interval 1.2 types. It's definitely not necessary with a breaking version change but it's not hard to support:With this updated
compat.jl
code these tests should pass.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since this is already going into the break v2-DEV release I'm inclined to just drop the compat.jl code. Also, deserialization will likely break again with #217 anyway. If we don't drop it for v2 are we just going to retain this compat code indefinitely?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree we can't keep the serialization compat code forever but it is nice to have some compatibility with old serialized versions. I think having backwards compatible serialization with the latest previous version would be a good goal to have (1.9.0) in this case.
I'd personally probably include this compat change in this PR and then just remove it in #217 just to keep in the commit history.