19 lines
576 B
Python
19 lines
576 B
Python
|
|
#!/usr/bin/env python3
|
||
|
|
from pathlib import Path
|
||
|
|
p = Path(r"c:\Forgejo\Medios-Macina\CLI.py")
|
||
|
|
s = p.read_text(encoding='utf-8')
|
||
|
|
start = s.find('\nif False:')
|
||
|
|
if start == -1:
|
||
|
|
print('No if False found')
|
||
|
|
else:
|
||
|
|
after = s[start+1:]
|
||
|
|
idx = after.find('\nfrom rich.markdown import Markdown')
|
||
|
|
if idx == -1:
|
||
|
|
print('No subsequent import found')
|
||
|
|
else:
|
||
|
|
before = s[:start]
|
||
|
|
rest = after[idx+1:]
|
||
|
|
new = before + '\nfrom rich.markdown import Markdown\n' + rest
|
||
|
|
p.write_text(new, encoding='utf-8')
|
||
|
|
print('Removed legacy block')
|