Skip to content

Commit 3041d40

Browse files
committed
fix ruff errors
1 parent 35f07c8 commit 3041d40

File tree

3 files changed

+18
-19
lines changed

3 files changed

+18
-19
lines changed

chebai_graph/preprocessing/property_encoder.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ def get_encoding_length(self) -> int:
125125

126126
@property
127127
def name(self):
128-
return f"one_hot"
128+
return "one_hot"
129129

130130
def on_start(self, property_values):
131131
"""To get correct number of classes during encoding, cache unique tokens beforehand"""

chebai_graph/preprocessing/reader/augmented_reader.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -383,7 +383,6 @@ def _construct_fg_to_atom_structure(
383383
for fg_smiles, fg_group in structure.items():
384384
fg_to_atoms_map[self._num_of_nodes] = fg_group
385385
is_ring_fg = fg_group["is_ring_fg"]
386-
is_alkyl = 0
387386

388387
connected_atoms = []
389388
# Build edge index for fg to atom nodes connections

chebai_graph/preprocessing/utils/visualize_augmented_molecule.py

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -10,16 +10,16 @@
1010
from rdkit.Chem.Draw import rdMolDraw2D
1111
from torch import Tensor
1212

13-
from chebai_graph.preprocessing.properties.constants import *
13+
from chebai_graph.preprocessing.properties import constants as k
1414
from chebai_graph.preprocessing.reader import GraphFGAugmentorReader
1515

1616
matplotlib.use("TkAgg")
1717

1818
EDGE_COLOR_MAP = {
19-
WITHIN_ATOMS_EDGE: "#1f77b4",
20-
ATOM_FG_EDGE: "#9467bd",
21-
WITHIN_FG_EDGE: "#ff7f0e",
22-
FG_GRAPHNODE_EDGE: "#2ca02c",
19+
k.WITHIN_ATOMS_EDGE: "#1f77b4",
20+
k.ATOM_FG_EDGE: "#9467bd",
21+
k.WITHIN_FG_EDGE: "#ff7f0e",
22+
k.FG_GRAPHNODE_EDGE: "#2ca02c",
2323
}
2424

2525
NODE_COLOR_MAP = {
@@ -90,22 +90,22 @@ def _create_graph(
9090
src_nodes, tgt_nodes = edge_index.tolist()
9191
with_atom_edges = {
9292
f"{bond.GetBeginAtomIdx()}_{bond.GetEndAtomIdx()}"
93-
for bond in augmented_graph_edges[WITHIN_ATOMS_EDGE].GetBonds()
93+
for bond in augmented_graph_edges[k.WITHIN_ATOMS_EDGE].GetBonds()
9494
}
95-
atom_fg_edges = set(augmented_graph_edges[ATOM_FG_EDGE])
96-
within_fg_edges = set(augmented_graph_edges[WITHIN_FG_EDGE])
97-
fg_graph_edges = set(augmented_graph_edges[FG_GRAPHNODE_EDGE])
95+
atom_fg_edges = set(augmented_graph_edges[k.ATOM_FG_EDGE])
96+
within_fg_edges = set(augmented_graph_edges[k.WITHIN_FG_EDGE])
97+
fg_graph_edges = set(augmented_graph_edges[k.FG_GRAPHNODE_EDGE])
9898

9999
for src, tgt in zip(src_nodes, tgt_nodes):
100100
undirected_edge_set = {f"{src}_{tgt}", f"{tgt}_{src}"}
101101
if undirected_edge_set & with_atom_edges:
102-
edge_type = WITHIN_ATOMS_EDGE
102+
edge_type = k.WITHIN_ATOMS_EDGE
103103
elif undirected_edge_set & atom_fg_edges:
104-
edge_type = ATOM_FG_EDGE
104+
edge_type = k.ATOM_FG_EDGE
105105
elif undirected_edge_set & within_fg_edges:
106-
edge_type = WITHIN_FG_EDGE
106+
edge_type = k.WITHIN_FG_EDGE
107107
elif undirected_edge_set & fg_graph_edges:
108-
edge_type = FG_GRAPHNODE_EDGE
108+
edge_type = k.FG_GRAPHNODE_EDGE
109109
else:
110110
raise ValueError("Unexpected edge type")
111111
G.add_edge(src, tgt, edge_type=edge_type, edge_color=EDGE_COLOR_MAP[edge_type])
@@ -266,10 +266,10 @@ def _draw_3d(G: nx.Graph, mol: Mol) -> None:
266266

267267
# Collect edges by type
268268
edge_type_to_edges = {
269-
WITHIN_ATOMS_EDGE: [],
270-
ATOM_FG_EDGE: [],
271-
WITHIN_FG_EDGE: [],
272-
FG_GRAPHNODE_EDGE: [],
269+
k.WITHIN_ATOMS_EDGE: [],
270+
k.ATOM_FG_EDGE: [],
271+
k.WITHIN_FG_EDGE: [],
272+
k.FG_GRAPHNODE_EDGE: [],
273273
}
274274
for src, tgt, data in G.edges(data=True):
275275
edge_type_to_edges[data["edge_type"]].append((src, tgt))

0 commit comments

Comments
 (0)