Spaces:
Paused
Paused
Update app.py
Browse files
app.py
CHANGED
|
@@ -3,7 +3,7 @@ import os
|
|
| 3 |
import subprocess
|
| 4 |
from transformers import pipeline, AutoModelForCausalLM, AutoTokenizer
|
| 5 |
import black
|
| 6 |
-
from pylint import
|
| 7 |
from io import StringIO
|
| 8 |
import sys
|
| 9 |
|
|
@@ -98,7 +98,11 @@ def code_editor_interface(code):
|
|
| 98 |
# Lint code using pylint
|
| 99 |
try:
|
| 100 |
pylint_output = StringIO()
|
| 101 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 102 |
lint_message = pylint_output.getvalue()
|
| 103 |
except Exception as e:
|
| 104 |
lint_message = f"Pylint error: {e}"
|
|
|
|
| 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 |
|
|
|
|
| 98 |
# Lint code using pylint
|
| 99 |
try:
|
| 100 |
pylint_output = StringIO()
|
| 101 |
+
sys.stdout = pylint_output
|
| 102 |
+
sys.stderr = pylint_output
|
| 103 |
+
lint.Run(['--from-stdin'], stdin=StringIO(formatted_code))
|
| 104 |
+
sys.stdout = sys.__stdout__
|
| 105 |
+
sys.stderr = sys.__stderr__
|
| 106 |
lint_message = pylint_output.getvalue()
|
| 107 |
except Exception as e:
|
| 108 |
lint_message = f"Pylint error: {e}"
|