def run(self): self.sleep(1) exts = settings.SYNTAX.get('python')['extension'] file_ext = file_manager.get_file_extension(self._path) if file_ext in exts: self.reset() source = self._editor.get_text() tempData = pep8mod.run_check(self._path, source) i = 0 while i < len(tempData): lineno = -1 try: offset = 2 + len(file_ext) startPos = tempData[i].find('.%s:' % file_ext) + offset endPos = tempData[i].find(':', startPos) lineno = int(tempData[i][startPos:endPos]) - 1 error = tempData[i][tempData[i].find( ':', endPos + 1) + 2:] line = '\n'.join( [error, tempData[i + 1], tempData[i + 2]]) except Exception: line = '' finally: i += 3 if line and lineno > -1: if lineno not in self.pep8checks: self.pep8checks[lineno] = [line] else: message = self.pep8checks[lineno] message += [line] self.pep8checks[lineno] = message else: self.reset()
def run(self): self.sleep(1) exts = settings.SYNTAX.get('python')['extension'] file_ext = file_manager.get_file_extension(self._path) if file_ext in exts: self.reset() source = self._editor.get_text() if self._encoding is not None: source = source.encode(self._encoding) tempData = pep8mod.run_check(self._path, source) i = 0 while i < len(tempData): lineno = -1 try: offset = 2 + len(file_ext) startPos = tempData[i].find('.%s:' % file_ext) + offset endPos = tempData[i].find(':', startPos) lineno = int(tempData[i][startPos:endPos]) - 1 error = unicode(tempData[i][tempData[i].find( ':', endPos + 1) + 2:]) line = u'\n'.join( [error, tempData[i + 1], tempData[i + 2]]) except: line = '' finally: i += 3 if line and lineno > -1: if lineno not in self.pep8checks: self.pep8checks[lineno] = [line] else: message = self.pep8checks[lineno] message += [line] self.pep8checks[lineno] = message else: self.reset()
def run(self): if file_manager.get_file_extension(self._editor.ID) == 'py': self.reset() tempData = pep8mod.run_check(self._editor.ID) i = 0 while i < len(tempData): lineno = -1 try: startPos = tempData[i].find('.py:') + 4 endPos = tempData[i].find(':', startPos) lineno = int(tempData[i][startPos:endPos]) error = unicode(tempData[i][tempData[i].find( ':', endPos + 1) + 2:]) line = u'\n'.join( [error, tempData[i + 1], tempData[i + 2]]) except: line = '' finally: i += 3 if line and lineno > -1: if lineno not in self.pep8checks: self.pep8checks[lineno] = [line] else: message = self.pep8checks[lineno] message += [line] self.pep8checks[lineno] = message else: self.reset()
def run(self): if file_manager.get_file_extension(self._editor.ID) == 'py': self.reset() tempData = pep8mod.run_check(self._editor.ID) i = 0 while i < len(tempData): lineno = -1 try: startPos = tempData[i].find('.py:') + 4 endPos = tempData[i].find(':', startPos) lineno = int(tempData[i][startPos:endPos]) error = unicode( tempData[i][tempData[i].find(':', endPos + 1) + 2:]) line = u'\n'.join( [error, tempData[i + 1], tempData[i + 2]]) except: line = '' finally: i += 3 if line and lineno > -1: if lineno not in self.pep8checks: self.pep8checks[lineno] = [line] else: message = self.pep8checks[lineno] message += [line] self.pep8checks[lineno] = message else: self.reset()
def run(self): if file_manager.get_file_extension(self._editor.ID) == 'py': self.reset() tempChecks = [] self.pep8checks = pep8mod.run_check(self._editor.ID) line = u'' repeated = False addLine = True for p in self.pep8checks: if p.find('.py:') > 0: if len(line) != 0: tempChecks.append(line) line = '' addLine = True startPos = p.find('.py:') + 4 endPos = p.find(':', startPos) lineno = p[startPos:endPos] if lineno.isdigit(): if int(lineno) in self.pep8lines: repeated = True else: self.pep8lines.append(int(lineno)) else: continue line += unicode(p[p.find(':', endPos + 1) + 2:]) + '\n' elif addLine: line += p + '\n' addLine = False else: line += p if len(line) != 0: if repeated: repeated = False previousLine = tempChecks[-1] previousLine += '\n' + line tempChecks[-1] = previousLine else: tempChecks.append(line) self.pep8checks = tempChecks else: self.reset()
def run(self): self.sleep(1) exts = settings.SYNTAX.get('python')['extension'] file_ext = file_manager.get_file_extension(self._path) if file_ext in exts: self.reset() source = self._editor.get_text() tempData = pep8mod.run_check(self._path, source) for result in tempData: message = "\n".join(("%s %s" % (result["code"], result["text"]), result["line"], result["pointer"])) if result["line_number"] not in self.checks: self.checks[result["line_number"]] = [message] else: original = self.checks[result["line_number"]] original += [message] self.checks[result["line_number"]] = original else: self.reset() self.refresh_display()
def run(self): self.sleep(1) exts = settings.SYNTAX.get('python')['extension'] file_ext = file_manager.get_file_extension(self._path) if file_ext in exts: self.reset() source = self._editor.text() tempData = pep8mod.run_check(self._path, source) for result in tempData: message = "\n".join( ("%s %s" % (result["code"], result["text"]), result["line"], result["pointer"])) if result["line_number"] not in self.checks: self.checks[result["line_number"]] = [message] else: original = self.checks[result["line_number"]] original += [message] self.checks[result["line_number"]] = original else: self.reset() self.emit(SIGNAL("checkerCompleted()"))