summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLaurent Peuch <cortex@worlddomination.be>2020-05-06 13:59:56 +0200
committerLaurent Peuch <cortex@worlddomination.be>2020-05-06 13:59:56 +0200
commit49dc54a7c761ca4acbef6d2104f8a45a1d5a9cb1 (patch)
tree793d01d868a88d1eb1a2ec23c196b65acdf0c37a
parentebe94c2439618c14541ce4918fa9d2881c934ce3 (diff)
downloadlogilab-common-49dc54a7c761ca4acbef6d2104f8a45a1d5a9cb1.tar.gz
[DepreciationWarning] deprecated has been renamed to callable_deprecated
-rw-r--r--logilab/common/compat.py6
-rw-r--r--logilab/common/configuration.py6
-rw-r--r--logilab/common/fileutils.py6
-rw-r--r--logilab/common/modutils.py4
-rw-r--r--logilab/common/pytest.py4
-rw-r--r--logilab/common/registry.py8
-rw-r--r--logilab/common/shellutils.py4
-rw-r--r--logilab/common/testlib.py14
-rw-r--r--logilab/common/textutils.py4
9 files changed, 29 insertions, 27 deletions
diff --git a/logilab/common/compat.py b/logilab/common/compat.py
index c0d3d41..9373239 100644
--- a/logilab/common/compat.py
+++ b/logilab/common/compat.py
@@ -70,9 +70,9 @@ else:
from io import StringIO, FileIO # noqa
from imp import reload # noqa
-from logilab.common.deprecation import deprecated # noqa
+from logilab.common.deprecation import callable_deprecated # noqa
# Other projects import these from here, keep providing them for
# backwards compat
-any = deprecated('use builtin "any"')(any)
-all = deprecated('use builtin "all"')(all)
+any = callable_deprecated('use builtin "any"')(any)
+all = callable_deprecated('use builtin "all"')(all)
diff --git a/logilab/common/configuration.py b/logilab/common/configuration.py
index fac0121..2429297 100644
--- a/logilab/common/configuration.py
+++ b/logilab/common/configuration.py
@@ -133,7 +133,7 @@ import configparser as cp
from logilab.common.types import OptionParser, Option, attrdict
from logilab.common.compat import str_encode as _encode
-from logilab.common.deprecation import deprecated
+from logilab.common.deprecation import callable_deprecated
from logilab.common.textutils import normalize_text, unquote
from logilab.common import optik_ext
@@ -360,7 +360,7 @@ def _validate(
return _call_validator(_type, optdict, name, value)
-convert = deprecated("[0.60] convert() was renamed _validate()")(_validate)
+convert = callable_deprecated("[0.60] convert() was renamed _validate()")(_validate)
# format and output functions ##################################################
@@ -941,7 +941,7 @@ class OptionsProviderMixIn(object):
optdict = self.get_option_def(opt)
return optdict.get("dest", opt.replace("-", "_"))
- option_name = deprecated(
+ option_name = callable_deprecated(
"[0.60] OptionsProviderMixIn.option_name() was renamed to option_attrname()"
)(option_attrname)
diff --git a/logilab/common/fileutils.py b/logilab/common/fileutils.py
index f89ae1d..0694ade 100644
--- a/logilab/common/fileutils.py
+++ b/logilab/common/fileutils.py
@@ -40,7 +40,7 @@ from typing import Optional, List, Tuple
from _io import TextIOWrapper
from logilab.common import STD_BLACKLIST as BASE_BLACKLIST, IGNORED_EXTENSIONS
-from logilab.common.deprecation import deprecated
+from logilab.common.deprecation import callable_deprecated
from logilab.common.compat import FileIO
@@ -260,7 +260,7 @@ def norm_read(path):
return open(path, "U").read()
-norm_read = deprecated("use \"open(path, 'U').read()\"")(norm_read)
+norm_read = callable_deprecated("use \"open(path, 'U').read()\"")(norm_read)
def norm_open(path):
@@ -275,7 +275,7 @@ def norm_open(path):
return open(path, "U")
-norm_open = deprecated("use \"open(path, 'U')\"")(norm_open)
+norm_open = callable_deprecated("use \"open(path, 'U')\"")(norm_open)
def lines(path: str, comments: Optional[str] = None) -> List[str]:
diff --git a/logilab/common/modutils.py b/logilab/common/modutils.py
index 4c1aee6..bc467b3 100644
--- a/logilab/common/modutils.py
+++ b/logilab/common/modutils.py
@@ -51,7 +51,7 @@ from types import ModuleType
from _frozen_importlib_external import FileFinder
from logilab.common import STD_BLACKLIST, _handle_blacklist
-from logilab.common.deprecation import deprecated
+from logilab.common.deprecation import callable_deprecated
try:
import zipimport
@@ -244,7 +244,7 @@ def _canonicalize_path(path: str) -> str:
return realpath(expanduser(path))
-@deprecated("you should avoid using modpath_from_file()")
+@callable_deprecated("you should avoid using modpath_from_file()")
def modpath_from_file(filename: str, extrapath: Optional[Dict[str, str]] = None) -> List[str]:
"""DEPRECATED: doens't play well with symlinks and sys.meta_path
diff --git a/logilab/common/pytest.py b/logilab/common/pytest.py
index 5c8a69b..88e22f9 100644
--- a/logilab/common/pytest.py
+++ b/logilab/common/pytest.py
@@ -116,7 +116,7 @@ from unittest.suite import TestSuite
from typing import Callable, Any, Optional, List, Tuple, Generator, Dict
-from logilab.common.deprecation import deprecated
+from logilab.common.deprecation import callable_deprecated
from logilab.common.fileutils import abspath_listdir
from logilab.common import textutils
from logilab.common import testlib, STD_BLACKLIST
@@ -702,7 +702,7 @@ def parseargs(parser):
return options, explicitfile
-@deprecated("[logilab-common 1.3] logilab-pytest is deprecated, use another test runner")
+@callable_deprecated("[logilab-common 1.3] logilab-pytest is deprecated, use another test runner")
def run():
parser = make_parser()
rootdir, testercls = project_root(parser)
diff --git a/logilab/common/registry.py b/logilab/common/registry.py
index b0c07d2..556bffa 100644
--- a/logilab/common/registry.py
+++ b/logilab/common/registry.py
@@ -98,7 +98,7 @@ from typing_extensions import TypedDict
from logilab.common.modutils import modpath_from_file
from logilab.common.logging_ext import set_log_methods
from logilab.common.decorators import classproperty
-from logilab.common.deprecation import deprecated
+from logilab.common.deprecation import callable_deprecated
# selector base classes and operations ########################################
@@ -321,12 +321,12 @@ class yes(Predicate): # pylint: disable=C0103
# deprecated stuff #############################################################
-@deprecated("[lgc 0.59] use Registry.objid class method instead")
+@callable_deprecated("[lgc 0.59] use Registry.objid class method instead")
def classid(cls):
return "%s.%s" % (cls.__module__, cls.__name__)
-@deprecated("[lgc 0.59] use obj_registries function instead")
+@callable_deprecated("[lgc 0.59] use obj_registries function instead")
def class_registries(cls, registryname):
return obj_registries(cls, registryname)
@@ -1015,7 +1015,7 @@ class RegistryStore(dict):
self._loadedmods: Dict[str, Dict[str, type]] = {}
return filemods
- @deprecated("use register_modnames() instead")
+ @callable_deprecated("use register_modnames() instead")
def register_objects(self, path: List[str], extrapath: Optional[Any] = None) -> None:
"""register all objects found walking down <path>"""
# load views from each directory in the instance's path
diff --git a/logilab/common/shellutils.py b/logilab/common/shellutils.py
index f8914da..9950deb 100644
--- a/logilab/common/shellutils.py
+++ b/logilab/common/shellutils.py
@@ -38,7 +38,7 @@ from _io import StringIO
from typing import Any, Callable, Optional, List, Union, Iterator, Tuple
from logilab.common import STD_BLACKLIST, _handle_blacklist
-from logilab.common.deprecation import deprecated
+from logilab.common.deprecation import callable_deprecated
class tempdir(object):
@@ -238,7 +238,7 @@ def unzip(archive, destdir):
outfile.close()
-@deprecated("Use subprocess.Popen instead")
+@callable_deprecated("Use subprocess.Popen instead")
class Execute:
"""This is a deadlock safe version of popen2 (no stdin), that returns
an object with errorlevel, out and err.
diff --git a/logilab/common/testlib.py b/logilab/common/testlib.py
index fe5e3c4..4fb3221 100644
--- a/logilab/common/testlib.py
+++ b/logilab/common/testlib.py
@@ -58,7 +58,7 @@ from mypy_extensions import NoReturn
import builtins
import doctest
-from logilab.common.deprecation import class_deprecated, deprecated
+from logilab.common.deprecation import class_deprecated, callable_deprecated
import unittest as unittest_legacy
@@ -83,13 +83,15 @@ __all__ = ["unittest_main", "find_tests", "nocoverage", "pause_trace"]
DEFAULT_PREFIXES = ("test", "regrtest", "smoketest", "unittest", "func", "validation")
-is_generator = deprecated("[lgc 0.63] use inspect.isgeneratorfunction")(isgeneratorfunction)
+is_generator = callable_deprecated("[lgc 0.63] use inspect.isgeneratorfunction")(
+ isgeneratorfunction
+)
# used by unittest to count the number of relevant levels in the traceback
__unittest = 1
-@deprecated("with_tempdir is deprecated, use tempfile.TemporaryDirectory.")
+@callable_deprecated("with_tempdir is deprecated, use tempfile.TemporaryDirectory.")
def with_tempdir(callable: Callable) -> Callable:
"""A decorator ensuring no temporary file left when the function return
Work only for temporary file created with the tempfile module"""
@@ -556,9 +558,9 @@ class TestCase(unittest.TestCase):
assertCountEqual = unittest.TestCase.assertItemsEqual
-TestCase.assertItemsEqual = deprecated("assertItemsEqual is deprecated, use assertCountEqual")(
- TestCase.assertItemsEqual
-)
+TestCase.assertItemsEqual = callable_deprecated(
+ "assertItemsEqual is deprecated, use assertCountEqual"
+)(TestCase.assertItemsEqual)
class SkippedSuite(unittest.TestSuite):
diff --git a/logilab/common/textutils.py b/logilab/common/textutils.py
index b0f59d5..95464e5 100644
--- a/logilab/common/textutils.py
+++ b/logilab/common/textutils.py
@@ -56,7 +56,7 @@ try:
except ImportError:
linesep = "\n" # gae
-from logilab.common.deprecation import deprecated
+from logilab.common.deprecation import callable_deprecated
MANUAL_UNICODE_MAP = {
"\xa1": "!", # INVERTED EXCLAMATION MARK
@@ -282,7 +282,7 @@ def splitstrip(string: str, sep: str = ",") -> List[str]:
return [word.strip() for word in string.split(sep) if word.strip()]
-get_csv = deprecated("get_csv is deprecated, use splitstrip")(splitstrip)
+get_csv = callable_deprecated("get_csv is deprecated, use splitstrip")(splitstrip)
def split_url_or_path(url_or_path):