Skip to content

Commit

Permalink
Let MessageException be imported from utils.toolkits with warning
Browse files Browse the repository at this point in the history
  • Loading branch information
mattwthompson committed Aug 19, 2021
1 parent cb5dfc0 commit 85a00ba
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion openff/toolkit/utils/toolkits.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@
"ALLOWED_FRACTIONAL_BOND_ORDER_MODELS",
"DEFAULT_CHARGE_MODEL",
"ALLOWED_CHARGE_MODELS",
"MessageException",
"IncompatibleUnitError",
"MissingDependencyError",
"MissingPackageError",
Expand Down Expand Up @@ -59,6 +58,7 @@


import logging
import warnings

from openff.toolkit.utils.ambertools_wrapper import AmberToolsToolkitWrapper
from openff.toolkit.utils.base_wrapper import ToolkitWrapper
Expand Down Expand Up @@ -96,6 +96,19 @@
from openff.toolkit.utils.rdkit_wrapper import RDKitToolkitWrapper
from openff.toolkit.utils.toolkit_registry import ToolkitRegistry

deprecated_names = ["MessageException"]

# TODO: Remove in January 2022, see _DeprecatedMessageException in openff/toolkit/utils/exceptions.py
def __getattr__(name):
if name in deprecated_names:
warnings.filterwarnings("default", category=DeprecationWarning)
from openff.toolkit.utils.exceptions import MessageException

return MessageException
# return globals()[f"MessageException"]
raise AttributeError(f"module {__name__} has no attribute {name}")


# =============================================================================================
# CONFIGURE LOGGER
# =============================================================================================
Expand Down

0 comments on commit 85a00ba

Please sign in to comment.