From 236e542f4dee09cf2d608c4770c1b06497e4d7a4 Mon Sep 17 00:00:00 2001 From: Martin Bajanik Date: Mon, 29 Jul 2019 10:36:06 +0200 Subject: [PATCH] Fix black --- test/datacenters/test_gcp.py | 9 ++++----- zoo/datacenters/gcp.py | 2 +- zoo/datacenters/utils/gcloud.py | 12 +++++++++--- zoo/datacenters/utils/kube.py | 4 +++- 4 files changed, 17 insertions(+), 10 deletions(-) diff --git a/test/datacenters/test_gcp.py b/test/datacenters/test_gcp.py index fb0d611f..dadeea67 100644 --- a/test/datacenters/test_gcp.py +++ b/test/datacenters/test_gcp.py @@ -1,4 +1,3 @@ - from unittest.mock import MagicMock import pytest @@ -34,7 +33,9 @@ def test_gcp_map_to_nodes(mocker): "zoo.datacenters.utils.GCPClient.get_all_clusters", return_value=[{"name": "test", "zone": "europe-test"}], ) - mocker.patch("zoo.datacenters.utils.kube.KubernetesClient.__init__", return_value=None) + mocker.patch( + "zoo.datacenters.utils.kube.KubernetesClient.__init__", return_value=None + ) workload = MagicMock() image1 = MagicMock() @@ -48,9 +49,7 @@ def test_gcp_map_to_nodes(mocker): mocker.patch( "zoo.datacenters.utils.kube.KubernetesClient.iter_workloads", - return_value={ - "test-type": [workload] - }, + return_value={"test-type": [workload]}, ) uut.map_to_nodes() diff --git a/zoo/datacenters/gcp.py b/zoo/datacenters/gcp.py index 2e9f89dc..e3df456c 100644 --- a/zoo/datacenters/gcp.py +++ b/zoo/datacenters/gcp.py @@ -68,4 +68,4 @@ def map_to_nodes(): kind=NodeKind.DOCKER_IMAGE_UUID, value=container.image, source=workload_node, - ) + ) diff --git a/zoo/datacenters/utils/gcloud.py b/zoo/datacenters/utils/gcloud.py index 63f2f8bf..adacda9e 100644 --- a/zoo/datacenters/utils/gcloud.py +++ b/zoo/datacenters/utils/gcloud.py @@ -19,8 +19,12 @@ def __init__(self): self.projectService = discovery.build( "cloudresourcemanager", "v1", credentials=self.credentials ) - self.computeService = discovery.build("compute", "v1", credentials=self.credentials) - self.containerService = discovery.build("container", "v1", credentials=self.credentials) + self.computeService = discovery.build( + "compute", "v1", credentials=self.credentials + ) + self.containerService = discovery.build( + "container", "v1", credentials=self.credentials + ) def get_all_projects(self): request = self.projectService.projects().list() @@ -72,7 +76,9 @@ def get_project_owners(self, project_id): for binding in bindings: if binding["role"] == "roles/owner": return [ - member for member in binding["members"] if member.endswith("@kiwi.com") + member + for member in binding["members"] + if member.endswith("@kiwi.com") ] def get_clusters_by_name(self, cluster): diff --git a/zoo/datacenters/utils/kube.py b/zoo/datacenters/utils/kube.py index ed00865f..74121bcc 100644 --- a/zoo/datacenters/utils/kube.py +++ b/zoo/datacenters/utils/kube.py @@ -15,7 +15,9 @@ def __init__(self, cluster): config.host = f"https://{cluster['endpoint']}" config.api_key_prefix["authorization"] = "Bearer" - config.api_key["authorization"] = _token(gcloud._get_credentials(), "cloud-platform") + config.api_key["authorization"] = _token( + gcloud._get_credentials(), "cloud-platform" + ) with NamedTemporaryFile(delete=False) as cert: cert.write(