Spaces:
Paused
Paused
Update app.py
Browse files
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
|
|
|
|
|
|
|
| 7 |
|
| 8 |
PROJECT_ROOT = "projects"
|
| 9 |
|
|
@@ -87,8 +89,11 @@ def code_editor_interface(code):
|
|
| 87 |
|
| 88 |
# Lint code using pylint
|
| 89 |
try:
|
| 90 |
-
|
| 91 |
-
|
|
|
|
|
|
|
|
|
|
| 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 |
|