From 6938d26a25f3df2b280ee79ca16c7c0689572beb Mon Sep 17 00:00:00 2001 From: Nicholas Landry Date: Mon, 28 Oct 2024 14:05:09 -0400 Subject: [PATCH] remove other changes --- xgi/readwrite/xgi_data.py | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/xgi/readwrite/xgi_data.py b/xgi/readwrite/xgi_data.py index 15ab8bce..1c6fceda 100644 --- a/xgi/readwrite/xgi_data.py +++ b/xgi/readwrite/xgi_data.py @@ -6,7 +6,6 @@ from ..convert import cut_to_order, from_hif_dict, from_hypergraph_dict from ..exception import XGIError from ..utils import request_json_from_url, request_json_from_url_cached -from .hif import write_hif, write_hif_collection __all__ = ["load_xgi_data", "download_xgi_data"] @@ -59,9 +58,9 @@ def load_xgi_data( if read: cfp = join(path, dataset + ".json") if exists(cfp): - from ..readwrite import read_hif + from ..readwrite import read_json - return read_hif(cfp, nodetype=nodetype, edgetype=edgetype) + return read_json(cfp, nodetype=nodetype, edgetype=edgetype) else: warn( f"No local copy was found at {cfp}. The data is requested " @@ -109,6 +108,8 @@ def download_xgi_data(dataset, path="", collection_name=""): The name of the collection of data (if any). If `dataset` is not a collection, this argument is unused. """ + from ..readwrite import write_json + index_url = "https://raw.githubusercontent.com/xgi-org/xgi-data/main/index.json" index_data = request_json_from_url(index_url) @@ -124,10 +125,10 @@ def download_xgi_data(dataset, path="", collection_name=""): url, nodetype=None, edgetype=None, max_order=None, cache=True ) if isinstance(H, dict): - write_hif_collection(H, path, collection_name=collection_name) + write_json(H, path, collection_name=collection_name) else: filename = join(path, key + ".json") - write_hif(H, filename) + write_json(H, filename) def _request_from_xgi_data( @@ -166,8 +167,8 @@ def _request_from_xgi_data( if "incidences" in jsondata: H = from_hif_dict(H, nodetype=nodetype, edgetype=edgetype) return cut_to_order(H, order=max_order) - - if "type" in jsondata and jsondata["type"] != "collection": + + if "type" in jsondata and jsondata["type"] == "collection": collection = {} for name, data in jsondata["datasets"].items(): relpath = data["relative-path"]