Skip to content

Commit 2a039b6

Browse files
committed
fix nx dynamic import
1 parent 795e67a commit 2a039b6

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

chebai/preprocessing/datasets/chebi.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -783,8 +783,10 @@ def _extract_class_hierarchy(self, chebi_path: str) -> "nx.DiGraph":
783783
)
784784
return g
785785

786-
def select_classes(self, g: nx.DiGraph, *args, **kwargs) -> List:
786+
def select_classes(self, g: "nx.DiGraph", *args, **kwargs) -> List:
787787
"""Only selects classes that meet the threshold AND are subclasses of the top class ID (including itself)."""
788+
import networkx as nx
789+
788790
smiles = nx.get_node_attributes(g, "smiles")
789791
nodes = list(
790792
sorted(

0 commit comments

Comments
 (0)