[cfe-commits] r143330 - /cfe/trunk/bindings/python/clang/cindex.py

Tobias Grosser grosser at fim.uni-passau.de
Sun Oct 30 19:06:50 PDT 2011


Author: grosser
Date: Sun Oct 30 21:06:50 2011
New Revision: 143330

URL: http://llvm.org/viewvc/llvm-project?rev=143330&view=rev
Log:
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)

Modified:
    cfe/trunk/bindings/python/clang/cindex.py

Modified: cfe/trunk/bindings/python/clang/cindex.py
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/bindings/python/clang/cindex.py?rev=143330&r1=143329&r2=143330&view=diff
==============================================================================
--- cfe/trunk/bindings/python/clang/cindex.py (original)
+++ cfe/trunk/bindings/python/clang/cindex.py Sun Oct 30 21:06:50 2011
@@ -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):
     """





More information about the cfe-commits mailing list