25 lines
688 B
Python
25 lines
688 B
Python
|
|
import re
|
||
|
|
|
||
|
|
file_path = 'server/src/app/models/__init__.py'
|
||
|
|
with open(file_path, 'r', encoding='utf-8') as f:
|
||
|
|
content = f.read()
|
||
|
|
|
||
|
|
# Add imports
|
||
|
|
imports_to_add = "from app.models.hermes_config import HermesTaskConfig, HermesTaskExecutionLog\nfrom app.models.hermes_report import HermesRiskReport\n"
|
||
|
|
content = re.sub(
|
||
|
|
r'(from app\.models\.organization import OrganizationUnit)',
|
||
|
|
imports_to_add + r'\1',
|
||
|
|
content
|
||
|
|
)
|
||
|
|
|
||
|
|
# Add to __all__
|
||
|
|
content = re.sub(
|
||
|
|
r'(\s*"OrganizationUnit",)',
|
||
|
|
r'\n "HermesTaskConfig",\n "HermesTaskExecutionLog",\n "HermesRiskReport",\1',
|
||
|
|
content
|
||
|
|
)
|
||
|
|
|
||
|
|
with open(file_path, 'w', encoding='utf-8') as f:
|
||
|
|
f.write(content)
|
||
|
|
print('Done.')
|