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
23 changes: 15 additions & 8 deletions quantecon/rank_nullspace.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
import warnings
from . import _rank_nullspace

__warned_names = set()


__all__ = ['rank_est', 'nullspace']

Expand All @@ -16,13 +18,18 @@ def __dir__():
def __getattr__(name):
if name not in __all__:
raise AttributeError(
"`quantecon.rank_nullspace` is deprecated and has no attribute"
f" '{name}'."
)

warnings.warn(f"Please use `{name}` from the `quantecon` namespace, the"
"`quantecon.rank_nullspace` namespace is deprecated. You can"
f" use following instead:\n `from quantecon import {name}`.",
category=DeprecationWarning, stacklevel=2)
"`quantecon.rank_nullspace` is deprecated and has no attribute"
f" '{name}'."
)

# Only warn once per attribute (per interpreter session)
if name not in __warned_names:
warnings.warn(
f"Please use `{name}` from the `quantecon` namespace, the"
"`quantecon.rank_nullspace` namespace is deprecated. You can"
f" use following instead:\n `from quantecon import {name}`.",
category=DeprecationWarning, stacklevel=2
)
__warned_names.add(name)

return getattr(_rank_nullspace, name)