Determine if we should try to execute this program at all for safety reasons.
(program: str, tests: list[Any])
| 269 | |
| 270 | |
| 271 | def should_execute(program: str, tests: list[Any]) -> bool: |
| 272 | """Determine if we should try to execute this program at all for safety |
| 273 | reasons.""" |
| 274 | dangerous_commands = [ |
| 275 | "threading", |
| 276 | "multiprocess", |
| 277 | "multiprocessing", |
| 278 | "import os", |
| 279 | "from os", |
| 280 | "shutil", |
| 281 | "import torch", |
| 282 | "from torch", |
| 283 | "import sklearn", |
| 284 | "from sklearn", |
| 285 | ] |
| 286 | return all(comm not in program for comm in dangerous_commands) |
| 287 | |
| 288 | |
| 289 | # ------------------------------------------------------------- |
no outgoing calls
no test coverage detected