Python pylint.epylint.py_run() Examples
The following are 16
code examples of pylint.epylint.py_run().
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example.
You may also want to check out all available functions/classes of the module
pylint.epylint
, or try the search function
.
Example #1
Source File: lint.py From dynamic-training-with-apache-mxnet-on-aws with Apache License 2.0 | 6 votes |
def process_python(self, path): """Process a python file.""" (pylint_stdout, pylint_stderr) = epylint.py_run( ' '.join([str(path)] + self.pylint_opts), return_std=True) emap = {} err = pylint_stderr.read() if len(err): print(err) for line in pylint_stdout: sys.stderr.write(line) key = line.split(':')[-1].split('(')[0].strip() if key not in self.pylint_cats: continue if key not in emap: emap[key] = 1 else: emap[key] += 1 self.python_map[str(path)] = emap
Example #2
Source File: lint.py From dynamic-training-with-apache-mxnet-on-aws with Apache License 2.0 | 6 votes |
def process_python(self, path): """Process a python file.""" (pylint_stdout, pylint_stderr) = epylint.py_run( ' '.join([str(path)] + self.pylint_opts), return_std=True) emap = {} print pylint_stderr.read() for line in pylint_stdout: sys.stderr.write(line) key = line.split(':')[-1].split('(')[0].strip() if key not in self.pylint_cats: continue if key not in emap: emap[key] = 1 else: emap[key] += 1 sys.stderr.write('\n') self.python_map[str(path)] = emap
Example #3
Source File: lint.py From dynamic-training-with-apache-mxnet-on-aws with Apache License 2.0 | 6 votes |
def process_python(self, path): """Process a python file.""" (pylint_stdout, pylint_stderr) = epylint.py_run( ' '.join([str(path)] + self.pylint_opts), return_std=True) emap = {} print(pylint_stderr.read()) for line in pylint_stdout: sys.stderr.write(line) key = line.split(':')[-1].split('(')[0].strip() if key not in self.pylint_cats: continue if key not in emap: emap[key] = 1 else: emap[key] += 1 sys.stderr.write('\n') self.python_map[str(path)] = emap
Example #4
Source File: lint.py From gluon-cv with Apache License 2.0 | 6 votes |
def process_python(self, path): """Process a python file.""" (pylint_stdout, pylint_stderr) = epylint.py_run( ' '.join([str(path)] + self.pylint_opts), return_std=True) emap = {} err = pylint_stderr.read() if len(err): print(err) for line in pylint_stdout: sys.stderr.write(line) key = line.split(':')[-1].split('(')[0].strip() if key not in self.pylint_cats: continue if key not in emap: emap[key] = 1 else: emap[key] += 1 self.python_map[str(path)] = emap
Example #5
Source File: lint.py From PyTorch-Encoding with MIT License | 6 votes |
def process_python(self, path): """Process a python file.""" (pylint_stdout, pylint_stderr) = epylint.py_run( ' '.join([str(path)] + self.pylint_opts), return_std=True) emap = {} err = pylint_stderr.read() if len(err): print(err) for line in pylint_stdout: sys.stderr.write(line) key = line.split(':')[-1].split('(')[0].strip() if key not in self.pylint_cats: continue if key not in emap: emap[key] = 1 else: emap[key] += 1 self.python_map[str(path)] = emap
Example #6
Source File: lint.py From training_results_v0.6 with Apache License 2.0 | 6 votes |
def process_python(self, path): """Process a python file.""" (pylint_stdout, pylint_stderr) = epylint.py_run( ' '.join([str(path)] + self.pylint_opts), return_std=True) emap = {} err = pylint_stderr.read() if len(err): print(err) for line in pylint_stdout: sys.stderr.write(line) key = line.split(':')[-1].split('(')[0].strip() if key not in self.pylint_cats: continue if key not in emap: emap[key] = 1 else: emap[key] += 1 self.python_map[str(path)] = emap
Example #7
Source File: lint.py From training_results_v0.6 with Apache License 2.0 | 6 votes |
def process_python(self, path): """Process a python file.""" (pylint_stdout, pylint_stderr) = epylint.py_run( ' '.join([str(path)] + self.pylint_opts), return_std=True) emap = {} err = pylint_stderr.read() if len(err): print(err) for line in pylint_stdout: sys.stderr.write(line) key = line.split(':')[-1].split('(')[0].strip() if key not in self.pylint_cats: continue if key not in emap: emap[key] = 1 else: emap[key] += 1 self.python_map[str(path)] = emap
Example #8
Source File: lint.py From panoptic-fpn-gluon with Apache License 2.0 | 6 votes |
def process_python(self, path): """Process a python file.""" (pylint_stdout, pylint_stderr) = epylint.py_run( ' '.join([str(path)] + self.pylint_opts), return_std=True) emap = {} err = pylint_stderr.read() if len(err): print(err) for line in pylint_stdout: sys.stderr.write(line) key = line.split(':')[-1].split('(')[0].strip() if key not in self.pylint_cats: continue if key not in emap: emap[key] = 1 else: emap[key] += 1 self.python_map[str(path)] = emap
Example #9
Source File: coglint.py From Fox-V3 with GNU Affero General Public License v3.0 | 6 votes |
def lint_code(self, code): self.counter += 1 path = self.path + "/{}.py".format(self.counter) with open(path, "w") as codefile: codefile.write(code) future = await self.bot.loop.run_in_executor(None, lint.py_run, path, "return_std=True") if future: (pylint_stdout, pylint_stderr) = future else: (pylint_stdout, pylint_stderr) = None, None # print(pylint_stderr) # print(pylint_stdout) return pylint_stdout, pylint_stderr
Example #10
Source File: lint.py From cascade_rcnn_gluon with Apache License 2.0 | 6 votes |
def process_python(self, path): """Process a python file.""" (pylint_stdout, pylint_stderr) = epylint.py_run( ' '.join([str(path)] + self.pylint_opts), return_std=True) emap = {} err = pylint_stderr.read() if len(err): print(err) for line in pylint_stdout: sys.stderr.write(line) key = line.split(':')[-1].split('(')[0].strip() if key not in self.pylint_cats: continue if key not in emap: emap[key] = 1 else: emap[key] += 1 self.python_map[str(path)] = emap
Example #11
Source File: test_scripts.py From bifrost with BSD 3-Clause "New" or "Revised" License | 6 votes |
def _test_script(self, script): self.assertTrue(os.path.exists(script)) out, err = lint.py_run("%s -E --extension-pkg-whitelist=numpy,scipy.fftpack --init-hook='import sys; sys.path=[%s]; sys.path.insert(0, \"%s\")'" % (script, ",".join(['"%s"' % p for p in sys.path]), os.path.dirname(BIFROST_DIR)), return_std=True) out_lines = out.read().split('\n') err_lines = err.read().split('\n') out.close() err.close() for line in out_lines: #if line.find("Module 'numpy") != -1: # continue #if line.find("module 'scipy.fftpack") != -1: # continue mtch = _LINT_RE.match(line) if mtch is not None: line_no, type, info = mtch.group('line'), mtch.group('type'), mtch.group('info') self.assertEqual(type, None, "%s:%s - %s" % (os.path.basename(script), line_no, info))
Example #12
Source File: lint.py From SNIPER-mxnet with Apache License 2.0 | 6 votes |
def process_python(self, path): """Process a python file.""" (pylint_stdout, pylint_stderr) = epylint.py_run( ' '.join([str(path)] + self.pylint_opts), return_std=True) emap = {} print pylint_stderr.read() for line in pylint_stdout: sys.stderr.write(line) key = line.split(':')[-1].split('(')[0].strip() if key not in self.pylint_cats: continue if key not in emap: emap[key] = 1 else: emap[key] += 1 sys.stderr.write('\n') self.python_map[str(path)] = emap
Example #13
Source File: test_style.py From datacats with GNU Affero General Public License v3.0 | 5 votes |
def test_pylint(self): (stdout, _) = lint.py_run('datacats', return_std=True) stdout_str = stdout.read().strip() self.failIf(stdout_str, stdout_str)
Example #14
Source File: test_linting.py From kademlia with MIT License | 5 votes |
def test_pylint(self): (stdout, _) = lint.py_run('kademlia', return_std=True) errors = stdout.read() if errors.strip(): raise LintError(errors) # pylint: disable=no-self-use
Example #15
Source File: utils.py From scikit-multilearn with BSD 2-Clause "Simplified" License | 5 votes |
def lint(full=False): from pylint import epylint sources = [Config.root, Config.meka, Config.skmultilearn] if full: fullReport = 'y' else: fullReport = 'n' config = "--rcfile ./utils/pylint.config --msg-template=\"{C}:{msg_id}:{line:3d},{column:2d}:{msg}({symbol})\" -r %s %s" for dir in sources: print 'lint %s' %dir epylint.py_run(config % (fullReport, dir), script='pylint')
Example #16
Source File: app.py From PythonBuddy with BSD 3-Clause "New" or "Revised" License | 4 votes |
def evaluate_pylint(text): """Create temp files for pylint parsing on user code :param text: user code :return: dictionary of pylint errors: { { "code":..., "error": ..., "message": ..., "line": ..., "error_info": ..., } ... } """ # Open temp file for specific session. # IF it doesn't exist (aka the key doesn't exist), create one try: session["file_name"] f = open(session["file_name"], "w") for t in text: f.write(t) f.flush() except KeyError as e: with tempfile.NamedTemporaryFile(delete=False) as temp: session["file_name"] = temp.name for t in text: temp.write(t.encode("utf-8")) temp.flush() try: ARGS = " -r n --disable=R,C" (pylint_stdout, pylint_stderr) = lint.py_run( session["file_name"] + ARGS, return_std=True) except Exception as e: raise Exception(e) if pylint_stderr.getvalue(): raise Exception("Issue with pylint configuration") return format_errors(pylint_stdout.getvalue()) # def split_error_gen(error): # """Inspired by this Python discussion: https://bugs.python.org/issue17343 # Uses a generator to split error by token and save some space # # :param error: string to be split # :yield: next line split by new line # """ # for e in error.split(): # yield e