Fix typing issues detected by pylance 15/14915/2
authorgarciadeblas <gerardo.garciadeblas@telefonica.com>
Sat, 8 Feb 2025 10:30:39 +0000 (11:30 +0100)
committergarciadeblas <gerardo.garciadeblas@telefonica.com>
Sun, 9 Feb 2025 12:25:04 +0000 (13:25 +0100)
Change-Id: Id5dbc01e34e83abccb7dbbaba8edc6f7ec658ddd
Signed-off-by: garciadeblas <gerardo.garciadeblas@telefonica.com>
osm_lcm/lcm_helm_conn.py
osm_lcm/n2vc/k8s_conn.py
osm_lcm/n2vc/kubectl.py

index d2fa2df..d7cd5fa 100644 (file)
@@ -26,7 +26,7 @@ from grpclib.client import Channel
 
 from osm_lcm.data_utils.lcm_config import VcaConfig
 from osm_lcm.frontend_pb2 import PrimitiveRequest
-from osm_lcm.frontend_pb2 import SshKeyRequest, SshKeyReply
+from osm_lcm.frontend_pb2 import SshKeyRequest
 from osm_lcm.frontend_grpc import FrontendExecutorStub
 from osm_lcm.lcm_utils import LcmBase, get_ee_id_parts
 
@@ -149,7 +149,7 @@ class LCMHelmConn(N2VCConnector, LcmBase):
         vca_type: str = None,
         *kargs,
         **kwargs,
-    ) -> (str, dict):
+    ) -> tuple[str, dict]:
         """
         Creates a new helm execution environment deploying the helm-chat indicated in the
         artifact_path
@@ -266,7 +266,7 @@ class LCMHelmConn(N2VCConnector, LcmBase):
         vca_type: str = None,
         *kargs,
         **kwargs,
-    ) -> (str, dict):
+    ) -> tuple[str, dict]:
         """
         Creates a new helm execution environment deploying the helm-chat indicated in the
         attifact_path
@@ -730,7 +730,7 @@ class LCMHelmConn(N2VCConnector, LcmBase):
             stub = FrontendExecutorStub(channel)
             if primitive_name == "_get_ssh_key":
                 self.log.debug("get ssh key, ip_addr: {}".format(ip_addr))
-                reply: SshKeyReply = await stub.GetSshKey(SshKeyRequest())
+                reply = await stub.GetSshKey(SshKeyRequest())
                 return reply.message
             # For any other primitives
             async with stub.RunPrimitive.open() as stream:
index 33e868a..092a6fa 100644 (file)
@@ -61,7 +61,7 @@ class K8sConnector(abc.ABC, Loggable):
     @abc.abstractmethod
     async def init_env(
         self, k8s_creds: str, namespace: str = "kube-system", reuse_cluster_uuid=None
-    ) -> (str, bool):
+    ) -> tuple[str, bool]:
         """
         It prepares a given K8s cluster environment to run Charts or juju Bundles on
         both sides:
index eee63dc..4402f11 100644 (file)
@@ -17,7 +17,6 @@
 
 import base64
 import logging
-from typing import Dict
 import typing
 import uuid
 import json
@@ -167,7 +166,7 @@ class Kubectl:
     def create_cluster_role(
         self,
         name: str,
-        labels: Dict[str, str],
+        labels: typing.Dict[str, str],
         namespace: str = "kube-system",
     ):
         """
@@ -200,7 +199,7 @@ class Kubectl:
     async def create_role(
         self,
         name: str,
-        labels: Dict[str, str],
+        labels: typing.Dict[str, str],
         api_groups: list,
         resources: list,
         verbs: list,
@@ -303,7 +302,7 @@ class Kubectl:
     def create_service_account(
         self,
         name: str,
-        labels: Dict[str, str],
+        labels: typing.Dict[str, str],
         namespace: str = "kube-system",
     ):
         """
@@ -356,7 +355,7 @@ class Kubectl:
         self.clients[CORE_CLIENT].delete_namespaced_service_account(name, namespace)
 
     def create_cluster_role_binding(
-        self, name: str, labels: Dict[str, str], namespace: str = "kube-system"
+        self, name: str, labels: typing.Dict[str, str], namespace: str = "kube-system"
     ):
         """
         Create a cluster role binding
@@ -386,7 +385,7 @@ class Kubectl:
         name: str,
         role_name: str,
         sa_name: str,
-        labels: Dict[str, str],
+        labels: typing.Dict[str, str],
         namespace: str,
     ):
         """
@@ -484,7 +483,7 @@ class Kubectl:
         self,
         name: str,
         namespace: str,
-    ) -> dict:
+    ) -> typing.Dict:
         """
         Get secret data