]> granicus.if.org Git - clang/commitdiff
cindex.py: Remove more ternary operator + whitespace fixes
authorTobias Grosser <grosser@fim.uni-passau.de>
Mon, 31 Oct 2011 02:06:50 +0000 (02:06 +0000)
committerTobias Grosser <grosser@fim.uni-passau.de>
Mon, 31 Oct 2011 02:06:50 +0000 (02:06 +0000)
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

bindings/python/clang/cindex.py

index 1c62cc95554cfafde4433c2b1dfb606ea0d48750..cd6ab454965970845300da9fcad4e24844b59b7d 100644 (file)
@@ -230,8 +230,8 @@ class Diagnostic(object):
                 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 @@ class Index(ClangObject):
     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 @@ class Index(ClangObject):
         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 @@ class TranslationUnit(ClangObject):
                                            unsaved_files_array,
                                            len(unsaved_files),
                                            options)
-        return CodeCompletionResults(ptr) if ptr else None
-
+        if ptr:
+            return CodeCompletionResults(ptr)
+        return None
 
 class File(ClangObject):
     """