HEX
Server: Apache/2.4.46 (Win64) OpenSSL/1.1.1j PHP/8.4.25
System: Windows NT DESKTOP-4TAV2RJ 10.0 build 19045 (Windows 10) AMD64
User: fred (0)
PHP: 8.4.25
Disabled: NONE
Upload Files
File: C:/Users/fred/anaconda3/Lib/site-packages/qtpy/tests/optional_deps/__init__.py
"""Package used for testing the deferred import error mechanism."""


# See https://github.com/spyder-ide/qtpy/pull/387/


from qtpy._utils import getattr_missing_optional_dep

from .optional_dep import ExampleClass

_missing_optional_names = {}


try:
    from .optional_dep import MissingClass
except ImportError as error:
    _missing_optional_names["MissingClass"] = {
        "name": "optional_dep.MissingClass",
        "missing_package": "test_package_please_ignore",
        "import_error": error,
    }


def __getattr__(name):
    """Custom getattr to chain and wrap errors due to missing optional deps."""
    raise getattr_missing_optional_dep(
        name,
        module_name=__name__,
        optional_names=_missing_optional_names,
    )