Skip to content

Commit

Permalink
Update confpass import, error handling
Browse files Browse the repository at this point in the history
  • Loading branch information
jessbade committed Apr 2, 2024
1 parent 9751ff2 commit 19aaca9
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions isicle/conformers.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,11 @@
from rdkit import Chem
from rdkit.Chem import PropertyMol

try:
from confpass import confpass
except ImportError:
confpass = None


def _function_selector(func):
"""
Expand Down Expand Up @@ -621,12 +626,16 @@ class ConfpassEnsemble(ConformationalEnsemble):
in Python path.
"""

from confpass import confpass

_defaults = ["temp_dir", "basename", "sdf_file", "priority", "cp"]
_default_value = None

def __init__(self, *args, **kwargs):
if confpass is None:
raise ImportError(
"The confpass module is required to use this feature."
"Please install it with 'pip install isicle[confpass]'."
)

super().__init__(*args)
self.__dict__.update(dict.fromkeys(self._defaults, self._default_value))
self.__dict__.update(**kwargs)
Expand Down

0 comments on commit 19aaca9

Please sign in to comment.