From: Dario Faccin Date: Fri, 21 Apr 2023 16:23:04 +0000 (+0200) Subject: Add type hint Database for all activity classes requiring it X-Git-Url: https://osm.etsi.org/gitweb/?a=commitdiff_plain;h=refs%2Fchanges%2F58%2F13258%2F1;p=osm%2FLCM.git Add type hint Database for all activity classes requiring it Change-Id: Ib1de26817a5ecff7f14080e45aa9b22829bd747c Signed-off-by: Dario Faccin --- diff --git a/osm_lcm/temporal/juju_paas_activities.py b/osm_lcm/temporal/juju_paas_activities.py index f964ea7..a22122d 100644 --- a/osm_lcm/temporal/juju_paas_activities.py +++ b/osm_lcm/temporal/juju_paas_activities.py @@ -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() diff --git a/osm_lcm/temporal/lcm_activities.py b/osm_lcm/temporal/lcm_activities.py index 32ebc29..5f360f1 100644 --- a/osm_lcm/temporal/lcm_activities.py +++ b/osm_lcm/temporal/lcm_activities.py @@ -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) diff --git a/osm_lcm/temporal/vim_activities.py b/osm_lcm/temporal/vim_activities.py index 4259fa8..4bd5514 100644 --- a/osm_lcm/temporal/vim_activities.py +++ b/osm_lcm/temporal/vim_activities.py @@ -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) diff --git a/osm_lcm/temporal/vnf_activities.py b/osm_lcm/temporal/vnf_activities.py index 95b4232..98fc86c 100644 --- a/osm_lcm/temporal/vnf_activities.py +++ b/osm_lcm/temporal/vnf_activities.py @@ -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)