cindex.py: Remove more ternary operator + whitespace fixes
Another batch of ternary operators and some whitespace fixes
(Getting in sync with the clang_complete version of this file)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@143330 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/bindings/python/clang/cindex.py b/bindings/python/clang/cindex.py
index 1c62cc9..cd6ab45 100644
--- a/bindings/python/clang/cindex.py
+++ b/bindings/python/clang/cindex.py
@@ -230,8 +230,8 @@
return int(_clang_getDiagnosticNumRanges(self.diag))
def __getitem__(self, key):
- if (key >= len(self)):
- raise IndexError
+ if (key >= len(self)):
+ raise IndexError
return _clang_getDiagnosticRange(self.diag, key)
return RangeIterator(self)
@@ -1381,7 +1381,9 @@
def read(self, path):
"""Load the translation unit from the given AST file."""
ptr = TranslationUnit_read(self, path)
- return TranslationUnit(ptr) if ptr else None
+ if ptr:
+ return TranslationUnit(ptr)
+ return None
def parse(self, path, args = [], unsaved_files = [], options = 0):
"""
@@ -1414,7 +1416,9 @@
ptr = TranslationUnit_parse(self, path, arg_array, len(args),
unsaved_files_array, len(unsaved_files),
options)
- return TranslationUnit(ptr) if ptr else None
+ if ptr:
+ return TranslationUnit(ptr)
+ return None
class TranslationUnit(ClangObject):
@@ -1533,8 +1537,9 @@
unsaved_files_array,
len(unsaved_files),
options)
- return CodeCompletionResults(ptr) if ptr else None
-
+ if ptr:
+ return CodeCompletionResults(ptr)
+ return None
class File(ClangObject):
"""