Add type hint Database for all activity classes requiring it 58/13258/1
authorDario Faccin <dario.faccin@canonical.com>
Fri, 21 Apr 2023 16:23:04 +0000 (18:23 +0200)
committerDario Faccin <dario.faccin@canonical.com>
Fri, 21 Apr 2023 16:23:04 +0000 (18:23 +0200)
Change-Id: Ib1de26817a5ecff7f14080e45aa9b22829bd747c
Signed-off-by: Dario Faccin <dario.faccin@canonical.com>
osm_lcm/temporal/juju_paas_activities.py
osm_lcm/temporal/lcm_activities.py
osm_lcm/temporal/vim_activities.py
osm_lcm/temporal/vnf_activities.py

index f964ea7..a22122d 100644 (file)
@@ -33,6 +33,7 @@ from osm_common.temporal_constants import (
     ACTIVITY_DEPLOY_CHARM,
     ACTIVITY_CHECK_CHARM_STATUS,
 )
+from osm_lcm.data_utils.database.database import Database
 from temporalio import activity
 
 
@@ -40,11 +41,11 @@ class JujuPaasConnector:
     """Handles Juju Controller operations.
 
     Args:
-        db  (object):       Data Access Object
+        db  (Database):       Data Access Object
     """
 
-    def __init__(self, db):
-        self.db = db
+    def __init__(self, db: Database):
+        self.db: Database = db
         self.logger = logging.getLogger(f"lcm.act.{self.__class__.__name__}")
         self.config = EnvironConfig()
 
index 32ebc29..5f360f1 100644 (file)
@@ -24,17 +24,18 @@ from osm_common.temporal_constants import (
     ACTIVITY_UPDATE_LCM_OPERATION_STATE,
     ACTIVITY_NSLCM_NO_OP,
 )
+from osm_lcm.data_utils.database.database import Database
 
 
 class NsLcmActivity:
     """
     Handles NS Lifecycle Managment operations.
     Args:
-        db  (object):       Data Access Object
+        db  (Database):       Data Access Object
     """
 
-    def __init__(self, db):
-        self.db = db
+    def __init__(self, db: Database):
+        self.db: Database = db
         self.logger = logging.getLogger(f"lcm.act.{self.__class__.__name__}")
 
     @activity.defn(name=ACTIVITY_NSLCM_NO_OP)
index 4259fa8..4bd5514 100644 (file)
@@ -27,17 +27,18 @@ from osm_common.dataclasses.temporal_dataclasses import (
     UpdateVimOperationStateInput,
     UpdateVimStateInput,
 )
+from osm_lcm.data_utils.database.database import Database
 
 
 class VimDbActivity:
     """Perform Database operations for VIM accounts.
 
     Args:
-        db  (object):       Data Access Object
+        db  (Database):       Data Access Object
     """
 
-    def __init__(self, db):
-        self.db = db
+    def __init__(self, db: Database):
+        self.db: Database = db
         self.logger = logging.getLogger(f"lcm.act.{self.__class__.__name__}")
 
     @activity.defn(name=ACTIVITY_UPDATE_VIM_STATE)
index 95b4232..98fc86c 100644 (file)
@@ -34,11 +34,12 @@ from osm_common.dataclasses.temporal_dataclasses import (
     GetVnfDetailsOutput,
     VnfInstantiateInput,
 )
+from osm_lcm.data_utils.database.database import Database
 
 
 class VnfOperations:
-    def __init__(self, db):
-        self.db = db
+    def __init__(self, db: Database):
+        self.db: Database = db
         self.logger = logging.getLogger(f"lcm.act.{self.__class__.__name__}")
 
     @activity.defn(name=ACTIVITY_GET_TASK_QUEUE)
@@ -104,11 +105,11 @@ class VnfDbActivity:
     """Perform Database operations for NS accounts.
 
     Args:
-        db  (object):       Data Access Object
+        db  (Database):       Data Access Object
     """
 
-    def __init__(self, db):
-        self.db = db
+    def __init__(self, db: Database):
+        self.db: Database = db
         self.logger = logging.getLogger(f"lcm.act.{self.__class__.__name__}")
 
     @activity.defn(name=ACTIVITY_CHANGE_VNF_STATE)