From 45fc16c132dfbaa8a47fda05aaeea7f10067c415 Mon Sep 17 00:00:00 2001 From: ldericher <40151420+ldericher@users.noreply.github.com> Date: Thu, 2 Dec 2021 17:12:30 +0100 Subject: [PATCH] Resolve import cycle --- kiwi_scp/project.py | 8 +++++--- kiwi_scp/service.py | 8 +++++--- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/kiwi_scp/project.py b/kiwi_scp/project.py index b6154a4..47e0699 100644 --- a/kiwi_scp/project.py +++ b/kiwi_scp/project.py @@ -1,17 +1,19 @@ import functools from pathlib import Path -from typing import Optional, Dict, Any +from typing import TYPE_CHECKING, Optional, Dict, Any import attr from ruamel.yaml import CommentedMap from ._constants import COMPOSE_FILE_NAME, CONF_DIRECTORY_NAME from .config import ProjectConfig -from .instance import Instance from .service import Service from .services import Services from .yaml import YAML +if TYPE_CHECKING: + from .instance import Instance + @attr.s class Project: @@ -66,4 +68,4 @@ class Project: content=content, parent=self, ) for name, content in yml["services"].items() - ]) \ No newline at end of file + ]) diff --git a/kiwi_scp/service.py b/kiwi_scp/service.py index ae282b1..f7e81a5 100644 --- a/kiwi_scp/service.py +++ b/kiwi_scp/service.py @@ -1,13 +1,15 @@ import re import subprocess from pathlib import Path -from typing import Generator +from typing import TYPE_CHECKING, Generator import attr from ruamel.yaml import CommentedMap from .executable import COMPOSE_EXE -from .project import Project + +if TYPE_CHECKING: + from .project import Project @attr.s @@ -41,4 +43,4 @@ class Service: return True except subprocess.CalledProcessError: - return False \ No newline at end of file + return False