Skip to content
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

Fix depwarnings of Requires in Julia v0.7 #403

Merged
merged 2 commits into from
Jul 31, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 0 additions & 4 deletions src/Approximations/overapproximate.jl
Original file line number Diff line number Diff line change
Expand Up @@ -146,8 +146,6 @@ function overapproximate(X::LazySet{N},
return H
end

@require IntervalArithmetic begin

"""
overapproximate(::LazySet{N}, ::Type{LazySets.Interval}) where {N<:Real}

Expand All @@ -168,5 +166,3 @@ function overapproximate(S::LazySet{N}, ::Type{LazySets.Interval}) where {N<:Rea
hi = σ([one(N)], S)[1]
return LazySets.Interval(lo, hi)
end

end # @require
7 changes: 4 additions & 3 deletions src/HPolytope.jl
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,8 @@ function tosimplehrep(P::HPolytope{N}) where {N}
return (A, b)
end

@require Polyhedra begin
function load_polyhedra_hpolytope() # function to be loaded by Requires
return quote

using CDDLib # default backend
import Polyhedra:polyhedron, SimpleHRepresentation, SimpleHRepresentation,
Expand Down Expand Up @@ -347,5 +348,5 @@ function vertices_list(P::HPolytope{N};
prunefunc(P)
return [vi for vi in vreps(P)]
end

end
end # quote
end # function load_polyhedra_hpolytope()
5 changes: 5 additions & 0 deletions src/LazySets.jl
Original file line number Diff line number Diff line change
Expand Up @@ -85,4 +85,9 @@ include("Approximations/Approximations.jl")
# ============
include("plot_recipes.jl")

# ===================================================
# Load external packages on-demand (using 'Requires')
# ===================================================
include("init.jl")

end # module
6 changes: 4 additions & 2 deletions src/VPolytope.jl
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,8 @@ function vertices_list(P::VPolytope{N})::Vector{Vector{N}} where {N<:Real}
end


@require Polyhedra begin
function load_polyhedra_vpolytope() # function to be loaded by Requires
return quote

using CDDLib # default backend
import Polyhedra:polyhedron, SimpleHRepresentation, SimpleVRepresentation,
Expand Down Expand Up @@ -222,4 +223,5 @@ function cartesian_product(P1::VPolytope, P2::VPolytope; backend=CDDLib.CDDLibra
return VPolytope(Pcp)
end

end
end # quote
end # function load_polyhedra_vpolytope()
8 changes: 8 additions & 0 deletions src/init.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
function __init__()
@require Polyhedra = "67491407-f73d-577b-9b50-8179a7c68029" load_polyhedra()
end

function load_polyhedra()
eval(load_polyhedra_hpolytope())
eval(load_polyhedra_vpolytope())
end