acecalisto3 commited on
Commit
c6cc621
1 Parent(s): a3f74af

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +8 -3
app.py CHANGED
@@ -3,7 +3,9 @@ import os
3
  import subprocess
4
  from transformers import pipeline, AutoModelForCausalLM, AutoTokenizer
5
  import black
6
- from pylint import epylint as lint
 
 
7
 
8
  PROJECT_ROOT = "projects"
9
 
@@ -87,8 +89,11 @@ def code_editor_interface(code):
87
 
88
  # Lint code using pylint
89
  try:
90
- (pylint_stdout, pylint_stderr) = lint.py_run(code, return_std=True)
91
- lint_message = pylint_stdout.getvalue()
 
 
 
92
  except Exception as e:
93
  lint_message = f"Pylint error: {e}"
94
 
 
3
  import subprocess
4
  from transformers import pipeline, AutoModelForCausalLM, AutoTokenizer
5
  import black
6
+ from pylint import lint
7
+ from io import StringIO
8
+ import sys
9
 
10
  PROJECT_ROOT = "projects"
11
 
 
89
 
90
  # Lint code using pylint
91
  try:
92
+ pylint_output = StringIO()
93
+ sys.stdout = pylint_output
94
+ lint.Run(["--from-stdin"], stdin=StringIO(formatted_code))
95
+ sys.stdout = sys.__stdout__
96
+ lint_message = pylint_output.getvalue()
97
  except Exception as e:
98
  lint_message = f"Pylint error: {e}"
99