Skip to content

Commit

Permalink
squeeze is now dropdims
Browse files Browse the repository at this point in the history
`squeeze` was renamed `dropdims` in [#28303](JuliaLang/julia#28303)

Fixes #617
  • Loading branch information
galenlynch committed Aug 19, 2018
1 parent 5a66c69 commit 15eb85c
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 0 deletions.
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -434,6 +434,8 @@ Currently, the `@compat` macro supports the following syntaxes:

* `realmin` and `realmax` are now `floatmin` and `floatmax` ([#28302])

* `squeeze` is now `dropdims` ([#28303]).

## New macros

* `@__DIR__` has been added ([#18380])
Expand Down Expand Up @@ -671,3 +673,4 @@ includes this fix. Find the minimum version from there.
[#27828]: https://github.com/JuliaLang/julia/issues/27828
[#27834]: https://github.com/JuliaLang/julia/issues/27834
[#28302]: https://github.com/JuliaLang/julia/issues/28302
[#28303]: https://github.com/JuliaLang/julia/issues/28303
5 changes: 5 additions & 0 deletions src/Compat.jl
Original file line number Diff line number Diff line change
Expand Up @@ -2011,6 +2011,11 @@ if VERSION < v"0.7.0-beta2.169"
export floatmin, floatmax
end

# https://github.com/JuliaLang/julia/pull/28303
if VERSION < v"0.7.0-beta2.143"
dropdims(X; dims = throw(UndefKeywordError("dropdims: keyword argument dims not assigned"))) = squeeze(X, dims)
end

include("deprecated.jl")

end # module Compat
8 changes: 8 additions & 0 deletions test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -1935,4 +1935,12 @@ end
@test floatmax(Float32) == @eval $(Core.Intrinsics.bitcast(Float32, 0x7f7fffff))
@test floatmin(zero(Float64)) == floatmin(Float64)

# 0.7.0-beta2.143
if VERSION < v"0.7.0-beta2.143"
let a = reshape(Vector(1:4),(2,2,1,1)), b = reshape(Vector(1:4), (2,2,1))
@test Compat.dropdims(a; dims=3) == b
@test_throws UndefKeywordError Compat.dropdims(a)
end
end

nothing

0 comments on commit 15eb85c

Please sign in to comment.