File size: 841 Bytes
3b7f713
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
import os
import glob
import re

directory = "/home/user/PROGRAMY/DOTACJE/backend/core/search/sources"
files = glob.glob(os.path.join(directory, "*_source.py"))

for file_path in files:
    with open(file_path, "r", encoding="utf-8") as f:
        content = f.read()
    
    # We want to insert 'last_verified': '2026-05-23' and 'verified_by': 'manual'
    # before the "source": line in the dictionaries.
    # Pattern to find: "source": "something",
    pattern = r'("source":\s*"[^"]+",)'
    replacement = r'"last_verified": "2026-05-23",\n                "verified_by": "manual",\n                \1'
    
    new_content = re.sub(pattern, replacement, content)
    
    if new_content != content:
        with open(file_path, "w", encoding="utf-8") as f:
            f.write(new_content)
        print(f"Zaktualizowano: {file_path}")