summaryrefslogtreecommitdiffstats
path: root/lldb/packages/Python/lldbsuite/support
diff options
context:
space:
mode:
authorKate Stone <katherine.stone@apple.com>2016-09-06 20:57:50 +0000
committerKate Stone <katherine.stone@apple.com>2016-09-06 20:57:50 +0000
commitb9c1b51e45b845debb76d8658edabca70ca56079 (patch)
treedfcb5a13ef2b014202340f47036da383eaee74aa /lldb/packages/Python/lldbsuite/support
parentd5aa73376966339caad04013510626ec2e42c760 (diff)
downloadbcm5719-llvm-b9c1b51e45b845debb76d8658edabca70ca56079.tar.gz
bcm5719-llvm-b9c1b51e45b845debb76d8658edabca70ca56079.zip
*** This commit represents a complete reformatting of the LLDB source code
*** to conform to clang-format’s LLVM style. This kind of mass change has *** two obvious implications: Firstly, merging this particular commit into a downstream fork may be a huge effort. Alternatively, it may be worth merging all changes up to this commit, performing the same reformatting operation locally, and then discarding the merge for this particular commit. The commands used to accomplish this reformatting were as follows (with current working directory as the root of the repository): find . \( -iname "*.c" -or -iname "*.cpp" -or -iname "*.h" -or -iname "*.mm" \) -exec clang-format -i {} + find . -iname "*.py" -exec autopep8 --in-place --aggressive --aggressive {} + ; The version of clang-format used was 3.9.0, and autopep8 was 1.2.4. Secondly, “blame” style tools will generally point to this commit instead of a meaningful prior commit. There are alternatives available that will attempt to look through this change and find the appropriate prior commit. YMMV. llvm-svn: 280751
Diffstat (limited to 'lldb/packages/Python/lldbsuite/support')
-rw-r--r--lldb/packages/Python/lldbsuite/support/encoded_file.py23
-rw-r--r--lldb/packages/Python/lldbsuite/support/fs.py5
-rw-r--r--lldb/packages/Python/lldbsuite/support/funcutils.py10
-rw-r--r--lldb/packages/Python/lldbsuite/support/gmodules.py5
-rw-r--r--lldb/packages/Python/lldbsuite/support/optional_with.py2
-rw-r--r--lldb/packages/Python/lldbsuite/support/seven.py9
-rw-r--r--lldb/packages/Python/lldbsuite/support/sockutil.py1
7 files changed, 44 insertions, 11 deletions
diff --git a/lldb/packages/Python/lldbsuite/support/encoded_file.py b/lldb/packages/Python/lldbsuite/support/encoded_file.py
index 7581564f7e3..2c2fef383f7 100644
--- a/lldb/packages/Python/lldbsuite/support/encoded_file.py
+++ b/lldb/packages/Python/lldbsuite/support/encoded_file.py
@@ -14,6 +14,7 @@ import io
# Third party modules
import six
+
def _encoded_read(old_read, encoding):
def impl(size):
result = old_read(size)
@@ -24,6 +25,7 @@ def _encoded_read(old_read, encoding):
return result
return impl
+
def _encoded_write(old_write, encoding):
def impl(s):
# If we were asked to write a `str` (in Py2) or a `bytes` (in Py3) decode it
@@ -38,9 +40,24 @@ Create a Text I/O file object that can be written to with either unicode strings
under Python 2 and Python 3, and automatically encodes and decodes as necessary to return the
native string type for the current Python version
'''
-def open(file, encoding, mode='r', buffering=-1, errors=None, newline=None, closefd=True):
- wrapped_file = io.open(file, mode=mode, buffering=buffering, encoding=encoding,
- errors=errors, newline=newline, closefd=closefd)
+
+
+def open(
+ file,
+ encoding,
+ mode='r',
+ buffering=-1,
+ errors=None,
+ newline=None,
+ closefd=True):
+ wrapped_file = io.open(
+ file,
+ mode=mode,
+ buffering=buffering,
+ encoding=encoding,
+ errors=errors,
+ newline=newline,
+ closefd=closefd)
new_read = _encoded_read(getattr(wrapped_file, 'read'), encoding)
new_write = _encoded_write(getattr(wrapped_file, 'write'), encoding)
setattr(wrapped_file, 'read', new_read)
diff --git a/lldb/packages/Python/lldbsuite/support/fs.py b/lldb/packages/Python/lldbsuite/support/fs.py
index 9a56808369d..30388596ea1 100644
--- a/lldb/packages/Python/lldbsuite/support/fs.py
+++ b/lldb/packages/Python/lldbsuite/support/fs.py
@@ -31,6 +31,7 @@ def _find_file_in_paths(paths, exe_basename):
return os.path.normcase(trial_exe_path)
return None
+
def find_executable(executable):
"""Finds the specified executable in the PATH or known good locations."""
@@ -59,6 +60,6 @@ def find_executable(executable):
if not result or len(result) < 1:
raise os.OSError(
- "failed to find exe='%s' in paths='%s'" % (executable, paths_to_check))
+ "failed to find exe='%s' in paths='%s'" %
+ (executable, paths_to_check))
return result
-
diff --git a/lldb/packages/Python/lldbsuite/support/funcutils.py b/lldb/packages/Python/lldbsuite/support/funcutils.py
index 53dd1fb370b..2fa10097d43 100644
--- a/lldb/packages/Python/lldbsuite/support/funcutils.py
+++ b/lldb/packages/Python/lldbsuite/support/funcutils.py
@@ -8,9 +8,17 @@ import inspect
# 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__')):
+ if func_argc == 0 or (
+ getattr(
+ func,
+ 'im_self',
+ None) is not None) or (
+ hasattr(
+ func,
+ '__self__')):
return False
else:
return True
diff --git a/lldb/packages/Python/lldbsuite/support/gmodules.py b/lldb/packages/Python/lldbsuite/support/gmodules.py
index 4f2fd9643b1..5d66bd14896 100644
--- a/lldb/packages/Python/lldbsuite/support/gmodules.py
+++ b/lldb/packages/Python/lldbsuite/support/gmodules.py
@@ -22,9 +22,8 @@ def is_compiler_clang_with_gmodules(compiler_path):
else:
# Check the compiler help for the -gmodules option.
clang_help = os.popen("%s --help" % compiler_path).read()
- return GMODULES_HELP_REGEX.search(clang_help, re.DOTALL) is not None
+ return GMODULES_HELP_REGEX.search(
+ clang_help, re.DOTALL) is not None
GMODULES_SUPPORT_MAP[compiler_path] = _gmodules_supported_internal()
return GMODULES_SUPPORT_MAP[compiler_path]
-
-
diff --git a/lldb/packages/Python/lldbsuite/support/optional_with.py b/lldb/packages/Python/lldbsuite/support/optional_with.py
index 41342288bc6..f91b3c6fdeb 100644
--- a/lldb/packages/Python/lldbsuite/support/optional_with.py
+++ b/lldb/packages/Python/lldbsuite/support/optional_with.py
@@ -2,6 +2,7 @@
# Provides a with-style resource handler for optionally-None resources
# ====================================================================
+
class optional_with(object):
# pylint: disable=too-few-public-methods
# This is a wrapper - it is not meant to provide any extra methods.
@@ -39,6 +40,7 @@ class optional_with(object):
forget the try/finally using optional_with(), since
the with syntax can be used.
"""
+
def __init__(self, wrapped_object):
self.wrapped_object = wrapped_object
diff --git a/lldb/packages/Python/lldbsuite/support/seven.py b/lldb/packages/Python/lldbsuite/support/seven.py
index 56ddd8db3f6..e04f48308b7 100644
--- a/lldb/packages/Python/lldbsuite/support/seven.py
+++ b/lldb/packages/Python/lldbsuite/support/seven.py
@@ -10,11 +10,16 @@ else:
def get_command_status_output(command):
try:
import subprocess
- return (0, subprocess.check_output(command, shell=True, universal_newlines=True))
+ return (
+ 0,
+ subprocess.check_output(
+ command,
+ shell=True,
+ universal_newlines=True))
except subprocess.CalledProcessError as e:
return (e.returncode, e.output)
def get_command_output(command):
return get_command_status_output(command)[1]
- cmp_ = lambda x, y: (x > y) - (x < y) \ No newline at end of file
+ cmp_ = lambda x, y: (x > y) - (x < y)
diff --git a/lldb/packages/Python/lldbsuite/support/sockutil.py b/lldb/packages/Python/lldbsuite/support/sockutil.py
index b3d81d14884..789deed8017 100644
--- a/lldb/packages/Python/lldbsuite/support/sockutil.py
+++ b/lldb/packages/Python/lldbsuite/support/sockutil.py
@@ -14,6 +14,7 @@ import socket
# LLDB modules
import use_lldb_suite
+
def recvall(sock, size):
bytes = io.BytesIO()
while size > 0:
OpenPOWER on IntegriCloud