def _getindent(self, source): # figure out indent for given source try: s = str(source.getstatement(len(source)-1)) except KeyboardInterrupt: raise except: try: s = str(source[-1]) except KeyboardInterrupt: raise except: return 0 return 4 + (len(s) - len(s.lstrip()))
def _getindent(self, source): # figure out indent for given source try: s = str(source.getstatement(len(source) - 1)) except KeyboardInterrupt: raise except: try: s = str(source[-1]) except KeyboardInterrupt: raise except: return 0 return 4 + (len(s) - len(s.lstrip()))
def statement(self): """ py.code.Source object for the current statement """ source = self.frame.code.fullsource return source.getstatement(self.lineno)