Skip to content

Commit b9caf6e

Browse files
committed
cleanup
1 parent 32410cf commit b9caf6e

File tree

1 file changed

+14
-17
lines changed

1 file changed

+14
-17
lines changed

datamol/viz/_viz.py

Lines changed: 14 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -122,26 +122,23 @@ def to_image(
122122
_kwargs[k] = v
123123

124124
# Check if we are in a Jupyter notebook or IPython display context
125+
# If so, conditionally add the maxMols argument
125126
in_notebook = get_ipython() is not None
126127

127-
# Create a dictionary of arguments for the MolsToGridImage function
128-
draw_args = {
129-
"mols": mols,
130-
"legends": legends,
131-
"molsPerRow": n_cols,
132-
"useSVG": use_svg,
133-
"subImgSize": mol_size,
134-
"highlightAtomLists": _highlight_atom,
135-
"highlightBondLists": _highlight_bond,
136-
"drawOptions": draw_options,
137-
**_kwargs,
138-
}
139-
140-
# Conditionally add the maxMols argument if in a notebook
141128
if in_notebook:
142-
draw_args["maxMols"] = max_mols
143-
144-
image = Draw.MolsToGridImage(**draw_args)
129+
_kwargs["maxMols"] = max_mols
130+
131+
image = Draw.MolsToGridImage(
132+
mols,
133+
legends=legends,
134+
molsPerRow=n_cols,
135+
useSVG=use_svg,
136+
subImgSize=mol_size,
137+
highlightAtomLists=_highlight_atom,
138+
highlightBondLists=_highlight_bond,
139+
drawOptions=draw_options,
140+
**_kwargs,
141+
)
145142

146143
if outfile is not None:
147144
image_to_file(image, outfile, as_svg=use_svg)

0 commit comments

Comments
 (0)