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

Julia 0.4 compatibility fixes #718

Merged
merged 2 commits into from
Nov 3, 2014
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
1 change: 1 addition & 0 deletions REQUIRE
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,4 @@ StatsBase 0.3.9+
GZip
SortingAlgorithms
Reexport
Compat
2 changes: 1 addition & 1 deletion src/DataFrames.jl
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ module DataFrames

using Base.Intrinsics
using Reexport
using Compat
@reexport using StatsBase
@reexport using DataArrays
using GZip
Expand Down Expand Up @@ -97,7 +98,6 @@ export @~,
##
##############################################################################

include("compatibility.jl")
include(joinpath("other", "utils.jl"))
include(joinpath("other", "index.jl"))
include(joinpath("abstractdataframe", "abstractdataframe.jl"))
Expand Down
2 changes: 1 addition & 1 deletion src/RDA.jl
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
##
##############################################################################

const SXPtab = @Dict( # Defined in Rinternals.h
const SXPtab = @compat Dict( # Defined in Rinternals.h
0x00=>"NULL",
0x01=>"Symbol",
0x02=>"Pairlist",
Expand Down
21 changes: 0 additions & 21 deletions src/compatibility.jl

This file was deleted.

4 changes: 2 additions & 2 deletions src/dataframe/io.jl
Original file line number Diff line number Diff line change
Expand Up @@ -393,7 +393,7 @@ function bytestotype{N <: Integer,

while index > left
if '0' <= byte <= '9'
value += (byte - '0') * power
value += (byte - uint8('0')) * power
power *= 10
else
return value, false, false
Expand All @@ -407,7 +407,7 @@ function bytestotype{N <: Integer,
elseif byte == '+'
return value, left < right, false
elseif '0' <= byte <= '9'
value += (byte - '0') * power
value += (byte - uint8('0')) * power
return value, true, false
else
return value, false, false
Expand Down
2 changes: 1 addition & 1 deletion src/statsmodels/formula.jl
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ end
dospecials(a::Any) = a

## Distribution of & over +
const distributive = [:& => :+]
const distributive = @compat Dict(:& => :+)

distribute(ex::Expr) = distribute!(copy(ex))
distribute(a::Any) = a
Expand Down
22 changes: 11 additions & 11 deletions test/dataframe.jl
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module TestDataFrame
using Base.Test
using DataFrames, DataFrames.Compatibility
using DataFrames, Compat

#test_group("Operations on DataFrames that have column groupings")

Expand Down Expand Up @@ -133,17 +133,17 @@ module TestDataFrame
@test typeof(df[:, 1]) == Vector{Float64}

#test_group("Other DataFrame constructors")
df = DataFrame([@AnyDict(:a=>1, :b=>'c'),
@AnyDict(:a=>3, :b=>'d'),
@AnyDict(:a=>5)])
df = DataFrame([@compat(Dict{Any,Any}(:a=>1, :b=>'c')),
@compat(Dict{Any,Any}(:a=>3, :b=>'d')),
@compat(Dict{Any,Any}(:a=>5))])
@test size(df, 1) == 3
@test size(df, 2) == 2
@test typeof(df[:,:a]) == DataVector{Int}
@test typeof(df[:,:b]) == DataVector{Char}

df = DataFrame([@AnyDict(:a=>1, :b=>'c'),
@AnyDict(:a=>3, :b=>'d'),
@AnyDict(:a=>5)],
df = DataFrame([@compat(Dict{Any,Any}(:a=>1, :b=>'c')),
@compat(Dict{Any,Any}(:a=>3, :b=>'d')),
@compat(Dict{Any,Any}(:a=>5))],
[:a, :b])
@test size(df, 1) == 3
@test size(df, 2) == 2
Expand Down Expand Up @@ -184,22 +184,22 @@ module TestDataFrame
@test_throws ArgumentError push!(dfb, ("coconut",22))

dfb= DataFrame( first=[1,2], second=["apple","orange"] )
push!(dfb, @Dict(:first=>3, :second=>"pear"))
push!(dfb, @compat(Dict(:first=>3, :second=>"pear")))
@test df==dfb

df=DataFrame( first=[1,2,3], second=["apple","orange","banana"] )
dfb= DataFrame( first=[1,2], second=["apple","orange"] )
push!(dfb, @Dict("first"=>3, "second"=>"banana"))
push!(dfb, @compat(Dict("first"=>3, "second"=>"banana")))
@test df==dfb

df0= DataFrame( first=[1,2], second=["apple","orange"] )
dfb= DataFrame( first=[1,2], second=["apple","orange"] )
@test_throws ArgumentError push!(dfb, @Dict(:first=>true, :second=>false))
@test_throws ArgumentError push!(dfb, @compat(Dict(:first=>true, :second=>false)))
@test df0==dfb

df0= DataFrame( first=[1,2], second=["apple","orange"] )
dfb= DataFrame( first=[1,2], second=["apple","orange"] )
@test_throws ArgumentError push!(dfb, @Dict("first"=>"chicken", "second"=>"stuff"))
@test_throws ArgumentError push!(dfb, @compat(Dict("first"=>"chicken", "second"=>"stuff")))
@test df0==dfb

# delete!
Expand Down
4 changes: 2 additions & 2 deletions test/index.jl
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module TestIndex
using Base.Test
using DataFrames, DataFrames.Index, DataFrames.Compatibility
using DataFrames, DataFrames.Index, Compat

i = Index()
push!(i, :A)
Expand Down Expand Up @@ -37,7 +37,7 @@ end

@test names(i) == [:A,:B]
@test names!(i, [:a,:b]) == Index([:a,:b])
@test rename(i, @Dict(:a=>:A, :b=>:B)) == Index([:A,:B])
@test rename(i, @compat(Dict(:a=>:A, :b=>:B))) == Index([:A,:B])
@test rename(i, :a, :A) == Index([:A,:b])
@test rename(i, [:a], [:A]) == Index([:A,:b])
# @test rename(i, uppercase) == Index([:A,:B])
Expand Down
6 changes: 3 additions & 3 deletions test/io.jl
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module TestIO
using Base.Test
using DataFrames, DataFrames.Compatibility
using DataFrames, Compat

#test_group("We can read various file types.")

Expand Down Expand Up @@ -141,8 +141,8 @@ module TestIO
osxpath = "$data/skiplines/complex_osx.csv"
winpath = "$data/skiplines/complex_windows.csv"

opts1 = @AnyDict(:allowcomments => true)
opts2 = @AnyDict(:skipstart => 4, :skiprows => [6, 7, 12, 14, 17], :skipblanks => false)
opts1 = @compat Dict{Any,Any}(:allowcomments => true)
opts2 = @compat Dict{Any,Any}(:skipstart => 4, :skiprows => [6, 7, 12, 14, 17], :skipblanks => false)

df1 = readtable(osxpath; opts1...)
# df2 = readtable(osxpath; opts2...)
Expand Down