Skip to content

Commit 39073f3

Browse files
committed
Fixed bugs and updated version
1 parent bea10d5 commit 39073f3

File tree

3 files changed

+27
-11
lines changed

3 files changed

+27
-11
lines changed

cfpq_data/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
experimental analysis of context-free path querying algorithms
88
"""
99

10-
__version__ = "1.0.1-dev"
10+
__version__ = "1.0.1"
1111

1212
import cfpq_data.config
1313
from cfpq_data.config import *

cfpq_data/graphs/readwrite/rdf.py

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
"""Read (and write) a graph
22
from (and to) RDF file.
33
"""
4+
import re
45
from os import path, remove
56
from pathlib import Path
67
from shutil import unpack_archive
@@ -26,9 +27,6 @@
2627
"graph_to_rdf",
2728
]
2829

29-
if "dev" in VERSION:
30-
VERSION = "dev"
31-
3230

3331
def graph_from_dataset(graph_name: str, verbose: bool = True) -> MultiDiGraph:
3432
"""Returns a graph from
@@ -65,6 +63,17 @@ def graph_from_dataset(graph_name: str, verbose: bool = True) -> MultiDiGraph:
6563
graph_file_path = str(dst / graph_file)
6664

6765
if not path.isfile(graph_file_path):
66+
67+
DATASET_VERSION = VERSION
68+
69+
if re.match(r"^(\d+)\.(\d+)\.(\d+)$", DATASET_VERSION) is not None:
70+
DATASET_VERSION = (
71+
str(
72+
re.match(r"^(\d+)\.(\d+)\.(\d+)$", DATASET_VERSION).group(1)
73+
)
74+
+ ".0.0"
75+
)
76+
6877
graph_archive = (
6978
graph_file + DATASET[graph_class][graph_name]["ArchiveExtension"]
7079
)
@@ -86,7 +95,7 @@ def _inner(bytes_amount):
8695

8796
file_size_in_bytes = s3.head_object(
8897
Bucket=BUCKET_NAME,
89-
Key=f"{VERSION}/{graph_class}/{graph_archive}",
98+
Key=f"{DATASET_VERSION}/{graph_class}/{graph_archive}",
9099
)["ContentLength"]
91100

92101
with tqdm(
@@ -97,14 +106,14 @@ def _inner(bytes_amount):
97106
) as t:
98107
s3.download_file(
99108
Bucket=BUCKET_NAME,
100-
Key=f"{VERSION}/{graph_class}/{graph_archive}",
109+
Key=f"{DATASET_VERSION}/{graph_class}/{graph_archive}",
101110
Filename=graph_archive_path,
102111
Callback=_hook(t),
103112
)
104113
else:
105114
s3.download_file(
106115
Bucket=BUCKET_NAME,
107-
Key=f"{VERSION}/{graph_class}/{graph_archive}",
116+
Key=f"{DATASET_VERSION}/{graph_class}/{graph_archive}",
108117
Filename=graph_archive_path,
109118
)
110119

utils/fetch_dataset.py

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import re
12
from collections import defaultdict
23
from json import dumps
34

@@ -7,11 +8,15 @@
78
from cfpq_data.config import AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY, BUCKET_NAME
89
from config import MAIN_FOLDER
910

10-
if "dev" in VERSION:
11-
VERSION = "dev"
12-
1311

1412
def fetch_dataset():
13+
DATASET_VERSION = VERSION
14+
15+
if re.match(r"^(\d+)\.(\d+)\.(\d+)$", DATASET_VERSION) is not None:
16+
DATASET_VERSION = (
17+
str(re.match(r"^(\d+)\.(\d+)\.(\d+)$", DATASET_VERSION).group(1)) + ".0.0"
18+
)
19+
1520
s3 = client(
1621
"s3",
1722
aws_access_key_id=AWS_ACCESS_KEY_ID,
@@ -20,7 +25,9 @@ def fetch_dataset():
2025

2126
dataset = defaultdict(dict)
2227

23-
for graph in s3.list_objects(Bucket="cfpq-data", Prefix=VERSION)["Contents"]:
28+
for graph in s3.list_objects(Bucket="cfpq-data", Prefix=DATASET_VERSION)[
29+
"Contents"
30+
]:
2431
graph_key = graph["Key"]
2532
graph_class, graph_full_name = graph_key.split("/")[1:]
2633
graph_name = graph_full_name.split(".")[0]

0 commit comments

Comments
 (0)