From da872af76e28e1b5832835f3be7f97483ae549fb Mon Sep 17 00:00:00 2001 From: Michael Jerger Date: Fri, 26 May 2023 15:38:12 +0200 Subject: [PATCH] fix linting --- .../ddadevops/application/terraform_service.py | 4 ++-- src/main/python/ddadevops/domain/init_service.py | 14 ++++++++++---- .../ddadevops/domain/provider_digitalocean.py | 4 ++-- .../python/ddadevops/domain/provider_hetzner.py | 7 +++---- src/main/python/ddadevops/domain/terraform.py | 2 +- 5 files changed, 18 insertions(+), 13 deletions(-) diff --git a/src/main/python/ddadevops/application/terraform_service.py b/src/main/python/ddadevops/application/terraform_service.py index 5dc3c74..815a62f 100644 --- a/src/main/python/ddadevops/application/terraform_service.py +++ b/src/main/python/ddadevops/application/terraform_service.py @@ -2,7 +2,7 @@ from pathlib import Path from dda_python_terraform import Terraform, IsFlagged from packaging import version -from ..domain import Devops, TerraformDomain, BuildType +from ..domain import Devops, BuildType from ..infrastructure import FileApi, ResourceApi, TerraformApi @@ -76,7 +76,7 @@ class TerraformService: # TODO: internal? def init_client(self, devops: Devops): - terraform_domain: TerraformDomain = devops.specialized_builds[ + terraform_domain = devops.specialized_builds[ BuildType.TERRAFORM ] terraform = Terraform( diff --git a/src/main/python/ddadevops/domain/init_service.py b/src/main/python/ddadevops/domain/init_service.py index 702dd76..1261b8e 100644 --- a/src/main/python/ddadevops/domain/init_service.py +++ b/src/main/python/ddadevops/domain/init_service.py @@ -38,9 +38,15 @@ class InitService: ) def initialize(self, inp: dict) -> Devops: - build_types = self.devops_factory.__parse_build_types__(inp.get("build_types", [])) - mixin_types = self.devops_factory.__parse_mixin_types__(inp.get("mixin_types", [])) - provider_types = TerraformDomain.parse_provider_types(inp.get("tf_provider_types", [])) + build_types = self.devops_factory.__parse_build_types__( + inp.get("build_types", []) + ) + mixin_types = self.devops_factory.__parse_mixin_types__( + inp.get("mixin_types", []) + ) + provider_types = TerraformDomain.parse_provider_types( + inp.get("tf_provider_types", []) + ) version = None default_mappings = [] @@ -50,7 +56,7 @@ class InitService: if BuildType.IMAGE in build_types: default_mappings += Image.get_mapping_default() if BuildType.TERRAFORM in build_types: - if ProviderType.DIGITALOCEAN in provider_types: + if ProviderType.DIGITALOCEAN in provider_types: default_mappings += Digitalocean.get_mapping_default() if ProviderType.HETZNER in provider_types: default_mappings += Hetzner.get_mapping_default() diff --git a/src/main/python/ddadevops/domain/provider_digitalocean.py b/src/main/python/ddadevops/domain/provider_digitalocean.py index bbfefa4..491d93b 100644 --- a/src/main/python/ddadevops/domain/provider_digitalocean.py +++ b/src/main/python/ddadevops/domain/provider_digitalocean.py @@ -1,4 +1,4 @@ -from typing import List, Dict, Set +from typing import List, Dict, Set, Any from .common import Validateable, CredentialMappingDefault @@ -61,7 +61,7 @@ class Digitalocean(Validateable, CredentialMappingDefault): ) return result - def backend_config(self) -> map: + def backend_config(self) -> Dict[str, Any]: result = {} if self.do_as_backend: result = { diff --git a/src/main/python/ddadevops/domain/provider_hetzner.py b/src/main/python/ddadevops/domain/provider_hetzner.py index 078117e..bd532ab 100644 --- a/src/main/python/ddadevops/domain/provider_hetzner.py +++ b/src/main/python/ddadevops/domain/provider_hetzner.py @@ -1,6 +1,7 @@ from typing import List, Dict, Set from .common import Validateable, CredentialMappingDefault + class Hetzner(Validateable, CredentialMappingDefault): def __init__( self, @@ -17,10 +18,8 @@ class Hetzner(Validateable, CredentialMappingDefault): return {"provider_registry.tf", "hetzner_provider.tf", "hetzner_mixin_vars.tf"} def project_vars(self): - return { - "hetzner_api_key": self.hetzner_api_key - } - + return {"hetzner_api_key": self.hetzner_api_key} + def is_local_state(self): return True diff --git a/src/main/python/ddadevops/domain/terraform.py b/src/main/python/ddadevops/domain/terraform.py index 6c4b8ea..8df506f 100644 --- a/src/main/python/ddadevops/domain/terraform.py +++ b/src/main/python/ddadevops/domain/terraform.py @@ -83,7 +83,7 @@ class TerraformDomain(Validateable): result = result and provider.is_local_state() return result - def backend_config(self) -> map: + def backend_config(self) -> Dict[str, Any]: result = {} for provider in self.providers.values(): result.update(provider.backend_config())