Skip to content

Commit 090ebcc

Browse files
authored
Merge pull request #41 from tkelman/compatetc
Remove unnecessary uses of Compat, Docile, etc
2 parents 5c0a57c + 7b79c76 commit 090ebcc

File tree

8 files changed

+13
-28
lines changed

8 files changed

+13
-28
lines changed

REQUIRE

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
11
julia 0.5
2-
Docile
32
DataStructures
43
#Lint

src/MatrixNetwork.jl

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
using Compat
2-
31
# create type MatrixNetwork
42
type MatrixNetwork{T}
53
n::Int64 # number of columns/rows

src/MatrixNetworks.jl

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,7 @@
11
module MatrixNetworks
22

3-
using Compat
43
using DataStructures
54

6-
if VERSION < v"0.4-"
7-
using Docile
8-
end
9-
105
"""
116
Module ``MatrixNetworks``: Documentation on the module
127

src/diffusions.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11

22
## Todo
33

4-
import Compat.LinAlg.checksquare
4+
import Base.LinAlg.checksquare
55
import Base.eltype
66
import Base.length
77
import Base.*

src/manage_data.jl

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
#using Lint
22

3-
using Compat
4-
53
function readSMAT(filename::AbstractString)
64
(rows,header) = readdlm(filename;header=true)
75
A = sparse(
@@ -23,7 +21,7 @@ end
2321

2422
function load_matrix_network_all(name::AbstractString)
2523
A = load_matrix_network(name)
26-
pathname = joinpath(Pkg.dir("MatrixNetworks"),"data")
24+
pathname = joinpath(dirname(dirname(@__FILE__)),"data")
2725

2826
meta_source = joinpath(pathname,"$(name).source")
2927
if isfile(meta_source)
@@ -51,7 +49,7 @@ end
5149

5250

5351
function load_matrix_network(name::AbstractString)
54-
pathname = joinpath(Pkg.dir("MatrixNetworks"),"data")
52+
pathname = joinpath(dirname(dirname(@__FILE__)),"data")
5553
smatfile = joinpath(pathname,"$(name).smat")
5654
if isfile(smatfile)
5755
return readSMAT(smatfile)
@@ -61,7 +59,7 @@ function load_matrix_network(name::AbstractString)
6159
end
6260

6361
function load_matrix_network_metadata(name::AbstractString)
64-
pathname = joinpath(Pkg.dir("MatrixNetworks"),"data")
62+
pathname = joinpath(dirname(dirname(@__FILE__)),"data")
6563
smatfile = joinpath(pathname,"$(name).smat")
6664
meta_xy = joinpath(pathname,"$(name).xy")
6765
meta_labels = joinpath(pathname,"$(name).labels")
@@ -77,7 +75,7 @@ function load_matrix_network_metadata(name::AbstractString)
7775
end
7876

7977
function matrix_network_datasets()
80-
datasets_location = joinpath(Pkg.dir("MatrixNetworks"),"data")
78+
datasets_location = joinpath(dirname(dirname(@__FILE__)),"data")
8179
content = readdir(datasets_location)
8280
smat_files = filter(x->contains(x,".smat"),content)
8381
for i = 1:length(smat_files)

src/spectral.jl

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
1-
# for issymmetric and checksquare
2-
using Compat
3-
import Compat.LinAlg.checksquare # updates for v0.5
1+
import Base.LinAlg.checksquare
42

53
## Todo
64
# 1. Add method for partial sweep cut
@@ -48,10 +46,10 @@ function _symeigs_smallest_arpack{V}(
4846
mode = 1
4947
sym = true
5048
iscmplx = false
51-
bmat = Compat.String("I") # ByteString on Julia 0.4, String on 0.5
49+
bmat = String("I")
5250
ncv = min(max(2*nev,20),n-1)
5351

54-
whichstr = Compat.String("SA") # ByteString on Julia 0.4, String on 0.5
52+
whichstr = String("SA")
5553
ritzvec = true
5654
sigma = 0.
5755

@@ -105,7 +103,7 @@ function _symeigs_smallest_arpack{V}(
105103
# eigenvectors.
106104

107105
# calls to eupd
108-
howmny = Compat.String("A") # ByteString on Julia 0.4, String on 0.5
106+
howmny = String("A")
109107
select = Array(Base.LinAlg.BlasInt, ncv)
110108

111109
d = Array(V, nev)
@@ -300,7 +298,7 @@ immutable SweepcutProfile{V,F}
300298
total_volume::V
301299
total_nodes::Int
302300

303-
@compat function (::Type{SweepcutProfile{V,F}}){V,F}(p::Vector{Int},nnodes::Int,totalvol::V)
301+
function (::Type{SweepcutProfile{V,F}}){V,F}(p::Vector{Int},nnodes::Int,totalvol::V)
304302
n = length(p)
305303
new{V,F}(p,Array(F,n-1),Array(V,n-1),Array(V,n-1),totalvol,nnodes)
306304
end

test/generators_test.jl

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -57,9 +57,7 @@ function pa_graph_test()
5757
@assert typeof(pa_graph(10,5,5)) == MatrixNetwork{Bool}
5858
@assert typeof(pa_edges!(2,1,[(1,1)])) == Vector{Tuple{Int,Int}}
5959
@test_throws ArgumentError pa_edges!(5,2,Vector{Tuple{Int,Int}}())
60-
if VERSION >= v"0.5.0"
61-
@test is_empty(pa_graph(0,0,0)) == true
62-
end
60+
@test is_empty(pa_graph(0,0,0)) == true
6361
@test all(diag(sparse_transpose(pa_graph(10, 2, 3))) .== 0.)
6462
@test is_undirected(pa_graph(10, 12, 3))
6563
@test_throws ArgumentError pa_graph(-1,10,3)
@@ -79,4 +77,4 @@ havel_hakimi_test()
7977
pa_graph_test()
8078
return true
8179

82-
end
80+
end

test/runtests.jl

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
using MatrixNetworks
22
using Base.Test
3-
using Compat
43
#using Lint
54

65
# Todo
@@ -30,7 +29,7 @@ all_tests = ["matrixnetwork",
3029

3130
for t in all_tests
3231
test_name = join(["$(t)", "_test",".jl"])
33-
test_path = joinpath(Pkg.dir("MatrixNetworks"), "test", test_name)
32+
test_path = joinpath(dirname(@__FILE__), test_name)
3433
println("running $(test_path) ...")
3534
test_function = include(test_path)
3635
test_function()

0 commit comments

Comments
 (0)