Spaces:
Sleeping
Sleeping
| import subprocess | |
| import tempfile | |
| def run_pylint(code): | |
| with tempfile.NamedTemporaryFile(suffix=".py", delete=False) as f: | |
| f.write(code.encode()) | |
| f.flush() | |
| result = subprocess.run(["pylint", f.name], capture_output=True, text=True) | |
| return result.stdout | |
| def run_bandit(code): | |
| with tempfile.NamedTemporaryFile(suffix=".py", delete=False) as f: | |
| f.write(code.encode()) | |
| f.flush() | |
| result = subprocess.run(["bandit", "-r", f.name], capture_output=True, text=True) | |
| return result.stdout |