Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ dependencies = [
"requests>=2.0",
"matplotlib>=3.4",
"seaborn>=0.10",
"xopen>=2.0.2",
]

[project.urls]
Expand Down Expand Up @@ -116,4 +117,4 @@ markers = [

[tool.isort]
skip = ["__init__.py", "benchmarks/env"]
profile = "black"
profile = "black"
4 changes: 3 additions & 1 deletion xgi/readwrite/bipartite.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
"""Read from and write to bipartite formats."""

from xopen import xopen

from ..exception import XGIError
from ..generators import empty_hypergraph

Expand Down Expand Up @@ -111,7 +113,7 @@ def read_bipartite_edgelist(
>>> # H = xgi.read_bipartite_edgelist("test.csv", delimiter=",")

"""
with open(path, "rb") as file:
with xopen(path, "rb") as file:
lines = (
line if isinstance(line, str) else line.decode(encoding) for line in file
)
Expand Down
4 changes: 3 additions & 1 deletion xgi/readwrite/edgelist.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
"""Read from and write to edgelists."""

from xopen import xopen

from ..generators import empty_hypergraph

__all__ = [
Expand Down Expand Up @@ -98,7 +100,7 @@ def read_edgelist(
>>> # H = xgi.read_edgelist("test.csv", delimiter=",")

"""
with open(path, "rb") as file:
with xopen(path, "rb") as file:
lines = (
line if isinstance(line, str) else line.decode(encoding) for line in file
)
Expand Down
4 changes: 3 additions & 1 deletion xgi/readwrite/hif.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
from collections import defaultdict
from os.path import dirname, join

from xopen import xopen

from ..convert import from_hif_dict, to_hif_dict
from ..exception import XGIError

Expand Down Expand Up @@ -99,7 +101,7 @@ def read_hif(path, nodetype=None, edgetype=None):
A Hypergraph, SimplicialComplex, or DiHypergraph object
The loaded network
"""
with open(path) as file:
with xopen(path) as file:
data = json.loads(file.read())

return from_hif_dict(data, nodetype=nodetype, edgetype=edgetype)
Expand Down
Loading