add unused.py, refactor common code a bit

This commit is contained in:
Carl Pearson
2021-12-01 08:28:45 -08:00
parent 84bdee85ce
commit 4a09bc2d33
7 changed files with 83 additions and 48 deletions

28
unused.py Normal file
View File

@@ -0,0 +1,28 @@
"""list unused data in suitesparse"""
import os
from pathlib import Path, PurePath
import sys
from lib import config
from lib import datasets
used = set()
for dataset in datasets.DATASETS:
# check if dataset directory exists
if not os.path.isdir(config.DIR / dataset.name):
continue
for f in os.listdir(config.DIR / dataset.name):
if f.endswith(".mtx"):
used.add(f[:-4])
for f in os.listdir(config.DIR / "suitesparse"):
if f not in used:
print(os.path.abspath(config.DIR / "suitesparse" / f))