Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 9 additions & 5 deletions quantecon/kalman.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,19 @@ def __dir__():


def __getattr__(name):
if name not in __all__:
# Fast-path: compare directly to avoid linear search if only a single item
if name != 'Kalman':
raise AttributeError(
"`quantecon.kalman` is deprecated and has no attribute "
f"'{name}'."
)

warnings.warn(f"Please use `{name}` from the `quantecon` namespace, the"
"`quantecon.kalman` namespace is deprecated. You can use"
f" the following instead:\n `from quantecon import {name}`.",
category=DeprecationWarning, stacklevel=2)
# Pre-build warning message for efficiency
warnings.warn(
"Please use `Kalman` from the `quantecon` namespace, the"
"`quantecon.kalman` namespace is deprecated. You can use"
" the following instead:\n `from quantecon import Kalman`.",
category=DeprecationWarning, stacklevel=2
)

return getattr(_kalman, name)