Skip to content

Commit

Permalink
datasets: fix type errors
Browse files Browse the repository at this point in the history
  • Loading branch information
abhidg committed Nov 20, 2024
1 parent 0d89d1f commit 9065c1b
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 10 deletions.
13 changes: 6 additions & 7 deletions l2gv2/datasets/_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ def get_edge_list(

def get_networkx(
self, temp: bool = True
) -> Union[nx.DiGraph, dict[datetime.datetime, nx.DiGraph]]:
) -> Union[nx.Graph, dict[datetime.datetime, nx.Graph]]:
"""Returns networkx.DiGraph representation
Args:
Expand All @@ -205,7 +205,7 @@ def get_networkx(
"""

if self.temporal and temp:
nx_graphs = {}
nx_graphs: dict[datetime.datetime, nx.Graph] = {}
for d in tqdm(self.datelist):
edges = (
self.edges.filter(pl.col("timestamp") == d)
Expand All @@ -214,11 +214,10 @@ def get_networkx(
)
edge_list = [tuple(x) for x in edges]
nx_graphs[d] = nx.from_edgelist(edge_list, create_using=nx.DiGraph)
else:
edges = self.edges.select("source", "dest").unique().to_numpy()
edge_list = [tuple(x) for x in edges]
nx_graphs = nx.from_edgelist(edge_list, create_using=nx.DiGraph)
return nx_graphs
return nx_graphs
edges = self.edges.select("source", "dest").unique().to_numpy()
edge_list = [tuple(x) for x in edges]
return nx.from_edgelist(edge_list, create_using=nx.DiGraph)

def get_edge_index(
self, temp: bool = True
Expand Down
2 changes: 1 addition & 1 deletion notebooks/asad.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -353,7 +353,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.12.0"
"version": "3.11.10"
}
},
"nbformat": 4,
Expand Down
2 changes: 1 addition & 1 deletion notebooks/nas.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -899,7 +899,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.12.0"
"version": "3.11.10"
}
},
"nbformat": 4,
Expand Down
2 changes: 1 addition & 1 deletion notebooks/summary.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -789,7 +789,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.12.0"
"version": "3.11.10"
}
},
"nbformat": 4,
Expand Down

0 comments on commit 9065c1b

Please sign in to comment.