Skip to content

Commit

Permalink
Apply suggestions from code review
Browse files Browse the repository at this point in the history
Co-authored-by: Josh A. Mitchell <yoshanuikabundi@gmail.com>
  • Loading branch information
mattwthompson and Yoshanuikabundi authored Oct 14, 2022
1 parent 8a8a667 commit cfd5dec
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 11 deletions.
14 changes: 7 additions & 7 deletions openff/toolkit/utils/openeye_wrapper.py
Original file line number Diff line number Diff line change
Expand Up @@ -146,10 +146,14 @@ def __init__(self):
if self._is_installed is False:
raise ToolkitUnavailableException(
"OpenEye Toolkits are not installed."
"{self._toolkit_installation_instructions}"
+ self._toolkit_installation_instructions
)
if self._is_licensed is False:
raise LicenseError(self._toolkit_license_instructions)
raise LicenseError(
"The OpenEye Toolkits are found to be installed but not licensed and "
+ "therefore will not be used.\n"
+ self._toolkit_license_instructions
)

from openeye import __version__ as openeye_version

Expand All @@ -158,7 +162,7 @@ def __init__(self):
@classmethod
def _check_licenses(cls) -> bool:
"""Check license of all known OpenEye tools. Returns True if any are found
to be licensed, False if any are not."""
to be licensed, False if all are not."""
for tool, license_func in cls._license_functions.items():
try:
module = importlib.import_module("openeye." + tool)
Expand Down Expand Up @@ -199,10 +203,6 @@ def is_available(cls):
cls._is_available = True
else:
cls._is_available = False
logger.warning(
"The OpenEye Toolkits are found to be installed but not licensed and "
"therefore will not be used."
)
cls._is_available = cls._is_installed and cls._is_licensed
return cls._is_available

Expand Down
8 changes: 4 additions & 4 deletions openff/toolkit/utils/toolkit_registry.py
Original file line number Diff line number Diff line change
Expand Up @@ -164,12 +164,12 @@ def register_toolkit(self, toolkit_wrapper, exception_if_unavailable=True):
try:
toolkit_wrapper = toolkit_wrapper()

# This exception can only be raised by OpenEyeToolkitWrapper
except LicenseError as openeye_exception:
# This exception can be raised by OpenEyeToolkitWrapper
except LicenseError as license_exception:
if exception_if_unavailable:
raise ToolkitUnavailableException(openeye_exception)
raise ToolkitUnavailableException(license_exception.msg)
else:
logger.warning(openeye_exception)
logger.warning(license_exception)
except ToolkitUnavailableException:
msg = "Unable to load toolkit '{}'. ".format(
toolkit_wrapper._toolkit_name
Expand Down

0 comments on commit cfd5dec

Please sign in to comment.