adityamanwatkar commited on
Commit
e3b5d4f
·
verified ·
1 Parent(s): 031ab5e

Upload 2 files

Browse files
app/services/code_tools.py CHANGED
@@ -0,0 +1,16 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import subprocess
2
+ import tempfile
3
+
4
+ def run_pylint(code):
5
+ with tempfile.NamedTemporaryFile(suffix=".py", delete=False) as f:
6
+ f.write(code.encode())
7
+ f.flush()
8
+ result = subprocess.run(["pylint", f.name], capture_output=True, text=True)
9
+ return result.stdout
10
+
11
+ def run_bandit(code):
12
+ with tempfile.NamedTemporaryFile(suffix=".py", delete=False) as f:
13
+ f.write(code.encode())
14
+ f.flush()
15
+ result = subprocess.run(["bandit", "-r", f.name], capture_output=True, text=True)
16
+ return result.stdout
app/services/llm_service.py ADDED
File without changes