Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
marscher committed May 18, 2016
1 parent 6ba81d1 commit e4b0d3f
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 3 deletions.
6 changes: 4 additions & 2 deletions pyemma/util/_ext/shimmodule.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,7 @@ def __path__(self):
@property
def __spec__(self):
"""Don't produce __spec__ until requested"""
self._warn()
return __import__(self._mirror).__spec__

def __dir__(self):
Expand All @@ -111,8 +112,8 @@ def __dir__(self):
@property
def __all__(self):
"""Ensure __all__ is always defined"""
self._warn()
mod = __import__(self._mirror)
#self._warn()
try:
return mod.__all__
except AttributeError:
Expand All @@ -129,4 +130,5 @@ def __getattr__(self, key):
raise AttributeError(key)

def _warn(self):
warnings.warn(self.msg if self.msg else self.default_msg, ShimWarning)
from pyemma.util.exceptions import PyEMMA_DeprecationWarning
warnings.warn(self.msg if self.msg else self.default_msg, PyEMMA_DeprecationWarning)
4 changes: 3 additions & 1 deletion pyemma/util/annotators.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@ def foo(self):
from decorator import decorator, decorate
from inspect import stack

from pyemma.util.exceptions import PyEMMA_DeprecationWarning

__all__ = ['alias',
'aliased',
'deprecated',
Expand Down Expand Up @@ -213,7 +215,7 @@ def _deprecated(func, *args, **kw):

warnings.warn_explicit(
user_msg,
category=DeprecationWarning,
category=PyEMMA_DeprecationWarning,
filename=filename,
lineno=lineno
)
Expand Down
5 changes: 5 additions & 0 deletions pyemma/util/exceptions.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,3 +65,8 @@ class ParserWarning(UserWarning):
class ConfigDirectoryException(Exception):
""" Some operation with PyEMMAs configuration directory went wrong. """
pass


class PyEMMA_DeprecationWarning(UserWarning):
"""You are using a feature, which will be removed in a future release. You have been warned!"""
pass

0 comments on commit e4b0d3f

Please sign in to comment.