diff options
author | Tobias Grosser <grosser@fim.uni-passau.de> | 2011-10-31 02:06:50 +0000 |
---|---|---|
committer | Tobias Grosser <grosser@fim.uni-passau.de> | 2011-10-31 02:06:50 +0000 |
commit | ba5d10b82b3cc00b4d71b273a18c051a1f38f22f (patch) | |
tree | 4a8f359a736afa5e9c7e1c80957e953b970459c9 | |
parent | 625b80755b603d28f36fb4212c81484d87ad08d3 (diff) |
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
-rw-r--r-- | bindings/python/clang/cindex.py | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/bindings/python/clang/cindex.py b/bindings/python/clang/cindex.py index 1c62cc9555..cd6ab45496 100644 --- a/bindings/python/clang/cindex.py +++ b/bindings/python/clang/cindex.py @@ -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): """ |