Python 3: Convert uses of `callable(x)` to `six.callable(x)`.
llvm-svn: 251329
diff --git a/lldb/test/dotest.py b/lldb/test/dotest.py
index bec967a..c42cdac 100755
--- a/lldb/test/dotest.py
+++ b/lldb/test/dotest.py
@@ -860,12 +860,12 @@
#print("config:", config)
if "pre_flight" in config:
pre_flight = config["pre_flight"]
- if not callable(pre_flight):
+ if not six.callable(pre_flight):
print("fatal error: pre_flight is not callable, exiting.")
sys.exit(1)
if "post_flight" in config:
post_flight = config["post_flight"]
- if not callable(post_flight):
+ if not six.callable(post_flight):
print("fatal error: post_flight is not callable, exiting.")
sys.exit(1)
if "lldbtest_remote_sandbox" in config:
diff --git a/lldb/test/lldbcurses.py b/lldb/test/lldbcurses.py
index 81ad92a..f68577c 100644
--- a/lldb/test/lldbcurses.py
+++ b/lldb/test/lldbcurses.py
@@ -176,7 +176,7 @@
def set_first_responder(self, window):
if window.can_become_first_responder:
- if callable(getattr(window, "hidden", None)) and window.hidden():
+ if six.callable(getattr(window, "hidden", None)) and window.hidden():
return False
if not window in self.children:
self.add_child(window)
@@ -386,7 +386,7 @@
return True
# Check if the window delegate wants to handle this key press
if self.delegate:
- if callable(getattr(self.delegate, "handle_key", None)):
+ if six.callable(getattr(self.delegate, "handle_key", None)):
if self.delegate.handle_key(self, key):
return True
if self.delegate(self, key):
diff --git a/lldb/test/lldbtest.py b/lldb/test/lldbtest.py
index 8fbb0e9..95e676f 100644
--- a/lldb/test/lldbtest.py
+++ b/lldb/test/lldbtest.py
@@ -54,6 +54,8 @@
from six import add_metaclass
from six import StringIO as SixStringIO
from six.moves.urllib import parse as urlparse
+import six
+import collections
# dosep.py starts lots and lots of dotest instances
# This option helps you find if two (or more) dotest instances are using the same
@@ -622,7 +624,7 @@
return wrapper
# if bugnumber is not-callable(incluing None), that means decorator function is called with optional arguments
# return decorator in this case, so it will be used to decorating original method
- if callable(bugnumber):
+ if six.callable(bugnumber):
return expectedFailure_impl(bugnumber)
else:
return expectedFailure_impl
@@ -762,7 +764,7 @@
return wrapper
# if bugnumber is not-callable(incluing None), that means decorator function is called with optional arguments
# return decorator in this case, so it will be used to decorating original method
- if callable(bugnumber):
+ if six.callable(bugnumber):
return expectedFailure_impl(bugnumber)
else:
return expectedFailure_impl
@@ -1088,7 +1090,7 @@
else:
func(*args, **kwargs)
return wrapper
- if callable(bugnumber):
+ if six.callable(bugnumber):
return skipTestIfFn_impl(bugnumber)
else:
return skipTestIfFn_impl
@@ -1606,7 +1608,7 @@
Hooks are executed in a first come first serve manner.
"""
- if callable(hook):
+ if six.callable(hook):
with recording(self, traceAlways) as sbuf:
print("Adding tearDown hook:", getsource_if_available(hook), file=sbuf)
self.hooks.append(hook)
diff --git a/lldb/test/lldbutil.py b/lldb/test/lldbutil.py
index f51d6e2..c7c8f22 100644
--- a/lldb/test/lldbutil.py
+++ b/lldb/test/lldbutil.py
@@ -13,6 +13,8 @@
import re
from six import StringIO as SixStringIO
+import six
+import collections
# ===================================================
# Utilities for locating/checking executable programs
@@ -979,7 +981,7 @@
return "re.compile(%s) -> %s" % (self.text, self.regex)
def skip_if_callable(test, callable, reason):
- if callable(test) == True:
+ if six.callable(test):
test.skipTest(reason)
return True
return False