Skip to content

Commit 63b865f

Browse files
authored
Use Manual deps for registering some datahubs (#143)
* Use Manual deps for registering some packages * no && in ogb
1 parent 43b6262 commit 63b865f

File tree

3 files changed

+17
-9
lines changed

3 files changed

+17
-9
lines changed

src/datasets/graphs/ogbdataset.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -508,7 +508,7 @@ function read_ogb_file(p, T; tovec = false, transp = true)
508508
if transp && res !== nothing && !tovec
509509
res = collect(res')
510510
end
511-
if res !== nothing T === Any
511+
if res !== nothing && T === Any
512512
res = restrict_array_type(res)
513513
end
514514
return res

src/datasets/graphs/tudataset.jl

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,13 @@
11
function __init__tudataset()
22
DEPNAME = "TUDataset"
3-
LINK = "https://www.chrsmrrs.com/graphkerneldatasets"
43
DOCS = "https://chrsmrrs.github.io/datasets/docs/home/"
5-
DATA = "PROTEINS.zip"
64

7-
register(DataDep(
5+
register(ManualDataDep(
86
DEPNAME,
97
"""
10-
Dataset: The $DEPNAME dataset.
11-
Website: $LINK)
8+
Datahub: $DEPNAME.
9+
Website: $DOCS
1210
""",
13-
"$LINK/$DATA",
14-
"2da8de15284b88edabca2888ce5444d62f364ed41159260977088c4e53d4d848", # if checksum omitted, will be generated by DataDeps
15-
post_fetch_method = unpack
1611
))
1712
end
1813

@@ -57,6 +52,7 @@ struct TUDataset <: AbstractDataset
5752
end
5853

5954
function TUDataset(name; dir=nothing)
55+
create_default_dir("TUDataset")
6056
d = tudataset_datadir(name, dir)
6157
# See here for the file format: https://chrsmrrs.github.io/datasets/docs/format/
6258

src/utils.jl

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,3 +102,15 @@ convert2image(d::SupervisedDataset, i::AbstractVector) =
102102
convert2image(typeof(d), d[i].features)
103103
convert2image(d::SupervisedDataset, x::AbstractArray) =
104104
convert2image(typeof(d), x)
105+
106+
"""
107+
creates_default_dir(data_name)
108+
109+
Creates the default datadir for the DataHub or Dataset.
110+
"""
111+
function create_default_dir(data_name::AbstractString)::String
112+
# don't overrride methods for ManualDataDeps
113+
dir = DataDeps.determine_save_path(data_name)
114+
isdir(dir) || mkpath(dir)
115+
return dir
116+
end

0 commit comments

Comments
 (0)