-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcleanup_docstrings.py
More file actions
26 lines (20 loc) · 847 Bytes
/
cleanup_docstrings.py
File metadata and controls
26 lines (20 loc) · 847 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
#!/usr/bin/env python3
import re
from pathlib import Path
modules = ['metadata_phantom.py', 'process_phantom.py', 'credential_phantom.py',
'event_phantom.py', 'av_phantom.py', 'usb_phantom.py', 'disk_phantom.py',
'registry_phantom.py', 'browser_phantom.py', 'panic_button.py']
base = Path('phantomtrace/modules')
for mod in modules:
filepath = base / mod
if filepath.exists():
with open(filepath, 'r') as f:
content = f.read()
content = re.sub(r'(def \w+\([^)]*\)[^:]*(?:\->[^:]*)?):\s*\n\s+"""[^"]*"""',
r'\1:', content, flags=re.MULTILINE | re.DOTALL)
with open(filepath, 'w') as f:
f.write(content)
print(f"✅ {mod}")
else:
print(f"⚠️ {mod} not found")
print("\n✅ All modules refactored!")