20 lines
711 B
Python
20 lines
711 B
Python
import re
|
|
from pathlib import Path
|
|
p = Path(r'c:\Forgejo\Medios-Macina\CLI.py')
|
|
s = p.read_text(encoding='utf-8')
|
|
pattern = re.compile(r'(?s)if False:\s*class _OldPipelineExecutor:.*?from rich\\.markdown import Markdown\\s*')
|
|
m = pattern.search(s)
|
|
print('found', bool(m))
|
|
if m:
|
|
print('start', m.start(), 'end', m.end())
|
|
print('snippet:', s[m.start():m.start()+120])
|
|
else:
|
|
# print a slice around the if False for debugging
|
|
i = s.find('if False:')
|
|
print('if False index', i)
|
|
print('around if False:', s[max(0,i-50):i+200])
|
|
j = s.find('from rich.markdown import Markdown', i)
|
|
print('next from rich index after if False', j)
|
|
if j!=-1:
|
|
print('around that:', s[j-50:j+80])
|