chore: apply pre-commit hooks
This commit is contained in:
parent
747dd06be1
commit
eca68a8190
8 changed files with 26 additions and 49 deletions
|
@ -16,8 +16,8 @@ class Service:
|
|||
depends_on: List[str] = [],
|
||||
links: List[str] = [],
|
||||
extends: Optional[Extends] = None,
|
||||
cgroup_parent: str = None,
|
||||
container_name: str = None,
|
||||
cgroup_parent: Optional[str] = None,
|
||||
container_name: Optional[str] = None,
|
||||
devices: List[str] = [],
|
||||
env_file: List[str] = [],
|
||||
expose: List[str] = [],
|
||||
|
|
|
@ -176,7 +176,6 @@ class Parser:
|
|||
if service_data.links is not None:
|
||||
service_links = service_data.links
|
||||
|
||||
|
||||
cgroup_parent: Optional[str] = None
|
||||
if service_data.cgroup_parent is not None:
|
||||
cgroup_parent = service_data.cgroup_parent
|
||||
|
@ -185,26 +184,24 @@ class Parser:
|
|||
if service_data.container_name is not None:
|
||||
container_name = service_data.container_name
|
||||
|
||||
|
||||
env_file: List[str] = []
|
||||
if service_data.env_file is not None:
|
||||
if type(service_data.env_file) is spec.StringOrList:
|
||||
if(type(service_data.env_file.__root__) is spec.ListOfStrings):
|
||||
if type(service_data.env_file.__root__) is spec.ListOfStrings:
|
||||
env_file = service_data.env_file.__root__.__root__
|
||||
elif(type(service_data.env_file.__root__) is str):
|
||||
elif type(service_data.env_file.__root__) is str:
|
||||
env_file.append(service_data.env_file.__root__)
|
||||
|
||||
|
||||
expose: List[str] = []
|
||||
if service_data.expose is not None:
|
||||
expose = service_data.expose
|
||||
for port in service_data.expose:
|
||||
expose.append(str(port))
|
||||
|
||||
profiles: List[str] = []
|
||||
if service_data.profiles is not None:
|
||||
if type(service_data.profiles) is spec.ListOfStrings:
|
||||
profiles = service_data.profiles.__root__
|
||||
|
||||
|
||||
services.append(
|
||||
Service(
|
||||
name=service_name,
|
||||
|
|
|
@ -272,24 +272,17 @@ from compose_viz.parser import Parser
|
|||
Service(
|
||||
name="frontend",
|
||||
image="awesome/frontend",
|
||||
env_file=[
|
||||
"a.env"
|
||||
],
|
||||
env_file=["a.env"],
|
||||
),
|
||||
Service(
|
||||
name="backend",
|
||||
image="awesome/backend",
|
||||
env_file=[
|
||||
"b.env"
|
||||
],
|
||||
env_file=["b.env"],
|
||||
),
|
||||
Service(
|
||||
name="db",
|
||||
image="awesome/db",
|
||||
env_file=[
|
||||
"c.env",
|
||||
"d.env"
|
||||
],
|
||||
env_file=["c.env", "d.env"],
|
||||
),
|
||||
],
|
||||
),
|
||||
|
@ -301,17 +294,12 @@ from compose_viz.parser import Parser
|
|||
Service(
|
||||
name="frontend",
|
||||
image="awesome/frontend",
|
||||
expose=[
|
||||
"27118"
|
||||
],
|
||||
expose=["27118"],
|
||||
),
|
||||
Service(
|
||||
name="backend",
|
||||
image="awesome/backend",
|
||||
expose=[
|
||||
"27017",
|
||||
"27018"
|
||||
],
|
||||
expose=["27017", "27018"],
|
||||
),
|
||||
],
|
||||
),
|
||||
|
@ -323,24 +311,17 @@ from compose_viz.parser import Parser
|
|||
Service(
|
||||
name="frontend",
|
||||
image="awesome/frontend",
|
||||
profiles=[
|
||||
"frontend"
|
||||
],
|
||||
profiles=["frontend"],
|
||||
),
|
||||
Service(
|
||||
name="phpmyadmin",
|
||||
image="phpmyadmin",
|
||||
profiles=[
|
||||
"debug"
|
||||
],
|
||||
profiles=["debug"],
|
||||
),
|
||||
Service(
|
||||
name="db",
|
||||
image="awesome/db",
|
||||
profiles=[
|
||||
"db",
|
||||
"sql"
|
||||
],
|
||||
profiles=["db", "sql"],
|
||||
),
|
||||
],
|
||||
),
|
||||
|
@ -380,7 +361,6 @@ def test_parse_file(test_file_path: str, expected: Compose) -> None:
|
|||
assert actual_service.extends.service_name == expected_service.extends.service_name
|
||||
assert actual_service.extends.from_file == expected_service.extends.from_file
|
||||
|
||||
|
||||
assert actual_service.cgroup_parent == expected_service.cgroup_parent
|
||||
assert actual_service.container_name == expected_service.container_name
|
||||
|
||||
|
|
Loading…
Reference in a new issue