summaryrefslogtreecommitdiffstats
path: root/lldb/packages/Python/lldbsuite/support
diff options
context:
space:
mode:
authorZachary Turner <zturner@google.com>2016-02-04 18:03:01 +0000
committerZachary Turner <zturner@google.com>2016-02-04 18:03:01 +0000
commit7a5382de8277d2fc8bb9850d5305de8ddcc30fc9 (patch)
tree9df28a1001d3dbfc39b28a7b3e99a74a1fbb0a99 /lldb/packages/Python/lldbsuite/support
parenta4859dfa46ef796976f023f505aae891722883b3 (diff)
downloadbcm5719-llvm-7a5382de8277d2fc8bb9850d5305de8ddcc30fc9.tar.gz
bcm5719-llvm-7a5382de8277d2fc8bb9850d5305de8ddcc30fc9.zip
Move some of the common decorators to decorators.py.
This doesn't attempt to move every decorator. The reason for this is that it requires touching every single test file to import decorators.py. I would like to do this in a followup patch, but in the interest of keeping the patches as bite-sized as possible, I've only attempted to move the underlying common decorators first. A few tests call these directly, so those tests are updated as part of this patch. llvm-svn: 259807
Diffstat (limited to 'lldb/packages/Python/lldbsuite/support')
-rw-r--r--lldb/packages/Python/lldbsuite/support/funcutils.py16
1 files changed, 16 insertions, 0 deletions
diff --git a/lldb/packages/Python/lldbsuite/support/funcutils.py b/lldb/packages/Python/lldbsuite/support/funcutils.py
new file mode 100644
index 00000000000..53dd1fb370b
--- /dev/null
+++ b/lldb/packages/Python/lldbsuite/support/funcutils.py
@@ -0,0 +1,16 @@
+from __future__ import print_function
+from __future__ import absolute_import
+
+# System modules
+import inspect
+
+# Third-party modules
+
+# LLDB modules
+
+def requires_self(func):
+ func_argc = len(inspect.getargspec(func).args)
+ if func_argc == 0 or (getattr(func,'im_self', None) is not None) or (hasattr(func, '__self__')):
+ return False
+ else:
+ return True
OpenPOWER on IntegriCloud