промежуточный этап. Работает.
This commit is contained in:
+3
-3
@@ -19,7 +19,7 @@ def update_file_imports(filepath):
|
||||
for mod in service_modules:
|
||||
new_content = new_content.replace(f"from modules.{mod}", f"from services.{mod}")
|
||||
new_content = new_content.replace(f"import modules.{mod}", f"import services.{mod}")
|
||||
# Также на случай относительных или прямых импортов внутри сервисов друг на друга
|
||||
# Замена для прямых импортов между модулями внутри папки services/
|
||||
new_content = new_content.replace(f"from {mod}", f"from services.{mod}")
|
||||
|
||||
if content != new_content:
|
||||
@@ -33,9 +33,9 @@ def run_update():
|
||||
if "venv" in root or ".git" in root:
|
||||
continue
|
||||
for file in files:
|
||||
if file.endswith(".py") and file != "migrate_structure.py" and file != "update_imports.py":
|
||||
if file.endswith(".py") and file not in ["migrate_structure.py", "update_imports.py"]:
|
||||
update_file_imports(os.path.join(root, file))
|
||||
print("=== Обновление завершено ===")
|
||||
print("=== Обновление импортов успешно завершено ===")
|
||||
|
||||
if __name__ == "__main__":
|
||||
run_update()
|
||||
Reference in New Issue
Block a user