[compat] Remove callable (related to #264017)

It's a builtin since at least python 2.0.

authorRémi Cardona <remi.cardona@free.fr>
changesetee0548a2abbe
branchdefault
phasepublic
hiddenno
parent revision#c401854d203b [test] replace assertTrue(a == b) with assertEqual(a, b)
child revision#f62e21c83b08 [py3k] Fix raise with embedded traceback
files modified by this revision
compat.py
configuration.py
decorators.py
testlib.py
# HG changeset patch
# User Rémi Cardona <remi.cardona@free.fr>
# Date 1410993613 -7200
# Thu Sep 18 00:40:13 2014 +0200
# Node ID ee0548a2abbe96b99a4da1e57bf8489cfa8afc75
# Parent c401854d203b30433b701008d97b13a3395de60d
[compat] Remove callable (related to #264017)

It's a builtin since at least python 2.0.

diff --git a/compat.py b/compat.py
@@ -48,19 +48,10 @@
1      # we have to ignore the encoding in py3k to be able to write a string into a
2      # TextIOWrapper or like object (which expect an unicode string)
3      def str_encode(string, encoding):
4          return str(string)
5 
6 -# XXX callable built-in seems back in all python versions
7 -try:
8 -    callable = builtins.callable
9 -except AttributeError:
10 -    from collections import Callable
11 -    def callable(something):
12 -        return isinstance(something, Callable)
13 -    del Callable
14 -
15  # See also http://bugs.python.org/issue11776
16  if sys.version_info[0] == 3:
17      def method_type(callable, instance, klass):
18          # api change. klass is no more considered
19          return types.MethodType(callable, instance)
diff --git a/configuration.py b/configuration.py
@@ -118,11 +118,11 @@
20  from os.path import exists, expanduser
21  from copy import copy
22  from ConfigParser import ConfigParser
23  from warnings import warn
24 
25 -from logilab.common.compat import callable, raw_input, str_encode as _encode
26 +from logilab.common.compat import raw_input, str_encode as _encode
27  from logilab.common.deprecation import deprecated
28  from logilab.common.textutils import normalize_text, unquote
29  from logilab.common import optik_ext
30 
31  OptionError = optik_ext.OptionError
diff --git a/decorators.py b/decorators.py
@@ -21,11 +21,11 @@
32  import sys
33  import types
34  from time import clock, time
35  from inspect import isgeneratorfunction, getargspec
36 
37 -from logilab.common.compat import callable, method_type
38 +from logilab.common.compat import method_type
39 
40  # XXX rewrite so we can use the decorator syntax when keyarg has to be specified
41 
42  class cached_decorator(object):
43      def __init__(self, cacheattr=None, keyarg=None):
diff --git a/testlib.py b/testlib.py
@@ -85,13 +85,10 @@
44      class TestSupport:
45          def unload(self, test):
46              pass
47      test_support = TestSupport()
48 
49 -# pylint: disable=W0622
50 -from logilab.common.compat import callable
51 -# pylint: enable=W0622
52  from logilab.common.debugger import Debugger, colorize_source
53  from logilab.common.decorators import cached, classproperty
54  from logilab.common import textutils
55 
56