From f9f508567da1c4aab9abb42a61132c22603b593a Mon Sep 17 00:00:00 2001 From: Guille Date: Tue, 2 Apr 2024 08:21:13 +0200 Subject: [PATCH] Correct cerc_persistence autodocumentation --- cerc_persistence/configuration.py | 5 ----- cerc_persistence/db_control.py | 18 +++++++++--------- cerc_persistence/db_setup.py | 8 -------- cerc_persistence/models/application.py | 2 +- cerc_persistence/models/city.py | 3 ++- cerc_persistence/models/city_object.py | 2 +- cerc_persistence/models/simulation_results.py | 2 +- cerc_persistence/models/user.py | 2 +- cerc_persistence/repositories/application.py | 5 +---- cerc_persistence/repositories/city.py | 5 +---- cerc_persistence/repositories/city_object.py | 5 +---- .../repositories/simulation_results.py | 5 +---- cerc_persistence/repositories/user.py | 5 +---- 13 files changed, 20 insertions(+), 47 deletions(-) diff --git a/cerc_persistence/configuration.py b/cerc_persistence/configuration.py index a71ca59..9250116 100644 --- a/cerc_persistence/configuration.py +++ b/cerc_persistence/configuration.py @@ -20,11 +20,6 @@ class Configuration: """ def __init__(self, db_name: str, dotenv_path: str, app_env='TEST'): - """ - :param db_name: database name - :param app_env: application environment, test or production - :param dotenv_path: the absolute path to dotenv file - """ try: # load environmental variables if not Path(dotenv_path).exists(): diff --git a/cerc_persistence/db_control.py b/cerc_persistence/db_control.py index 49c187b..de48562 100644 --- a/cerc_persistence/db_control.py +++ b/cerc_persistence/db_control.py @@ -148,27 +148,27 @@ class DBControl: def update_city(self, city_id, city): """ - Update an existing city in the database - :param city_id: the id of the city to update - :param city: the updated city object + Update an existing city in the database + :param city_id: the id of the city to update + :param city: the updated city object """ return self._city.update(city_id, city) def persist_application(self, name: str, description: str, application_uuid: str): """ Creates information for an application in the database - :param name: name of application - :param description: the description of the application - :param application_uuid: the uuid of the application to be created + :param name: name of application + :param description: the description of the application + :param application_uuid: the uuid of the application to be created """ return self._application.insert(name, description, application_uuid) def update_application(self, name: str, description: str, application_uuid: str): """ Update the application information stored in the database - :param name: name of application - :param description: the description of the application - :param application_uuid: the uuid of the application to be created + :param name: name of application + :param description: the description of the application + :param application_uuid: the uuid of the application to be created """ return self._application.update(application_uuid, name, description) diff --git a/cerc_persistence/db_setup.py b/cerc_persistence/db_setup.py index 3b76fe1..f28118f 100644 --- a/cerc_persistence/db_setup.py +++ b/cerc_persistence/db_setup.py @@ -23,14 +23,6 @@ class DBSetup: """ def __init__(self, db_name, app_env, dotenv_path, admin_password, application_uuid): - """ - Creates database tables a default admin user and a default admin app with the given password and uuid - :param db_name: database name - :param app_env: application environment type [TEST|PROD] - :param dotenv_path: .env file path - :param admin_password: administrator password for the application uuid - :application_uuid: application uuid - """ repository = Repository(db_name=db_name, app_env=app_env, dotenv_path=dotenv_path) # Create the tables using the models diff --git a/cerc_persistence/models/application.py b/cerc_persistence/models/application.py index eca21b2..4f1d3fb 100644 --- a/cerc_persistence/models/application.py +++ b/cerc_persistence/models/application.py @@ -16,7 +16,7 @@ from cerc_persistence.configuration import Models class Application(Models): """ - A model representation of an application + Application(Models) class """ __tablename__ = 'application' id = Column(Integer, Sequence('application_id_seq'), primary_key=True) diff --git a/cerc_persistence/models/city.py b/cerc_persistence/models/city.py index cb138ac..f54c0b9 100644 --- a/cerc_persistence/models/city.py +++ b/cerc_persistence/models/city.py @@ -14,7 +14,8 @@ from cerc_persistence.configuration import Models class City(Models): - """A model representation of a city + """ + City(Models) class """ __tablename__ = 'city' id = Column(Integer, Sequence('city_id_seq'), primary_key=True) diff --git a/cerc_persistence/models/city_object.py b/cerc_persistence/models/city_object.py index 662deb0..7e79cc9 100644 --- a/cerc_persistence/models/city_object.py +++ b/cerc_persistence/models/city_object.py @@ -17,7 +17,7 @@ from cerc_persistence.configuration import Models class CityObject(Models): """ - A model representation of an application + CityObject(Models) class """ __tablename__ = 'city_object' id = Column(Integer, Sequence('city_object_id_seq'), primary_key=True) diff --git a/cerc_persistence/models/simulation_results.py b/cerc_persistence/models/simulation_results.py index 5a5551f..7b3c52b 100644 --- a/cerc_persistence/models/simulation_results.py +++ b/cerc_persistence/models/simulation_results.py @@ -15,7 +15,7 @@ from cerc_persistence.configuration import Models class SimulationResults(Models): """ - A model representation of an application + SimulationResults(Models) class """ __tablename__ = 'simulation_results' id = Column(Integer, Sequence('simulation_results_id_seq'), primary_key=True) diff --git a/cerc_persistence/models/user.py b/cerc_persistence/models/user.py index 89c6c26..2b470e8 100644 --- a/cerc_persistence/models/user.py +++ b/cerc_persistence/models/user.py @@ -24,7 +24,7 @@ class UserRoles(enum.Enum): class User(Models): """ - A model representation of a city + User(Models) class """ __tablename__ = 'user' id = Column(Integer, Sequence('user_id_seq'), primary_key=True) diff --git a/cerc_persistence/repositories/application.py b/cerc_persistence/repositories/application.py index a3c3597..773ddb4 100644 --- a/cerc_persistence/repositories/application.py +++ b/cerc_persistence/repositories/application.py @@ -18,7 +18,7 @@ from cerc_persistence.models import Application as Model class Application(Repository): """ - Application repository + Application(Repository) class """ _instance = None @@ -26,9 +26,6 @@ class Application(Repository): super().__init__(db_name, dotenv_path, app_env) def __new__(cls, db_name, dotenv_path, app_env): - """ - Implemented for a singleton pattern - """ if cls._instance is None: cls._instance = super(Application, cls).__new__(cls) return cls._instance diff --git a/cerc_persistence/repositories/city.py b/cerc_persistence/repositories/city.py index bc9bdab..5737b69 100644 --- a/cerc_persistence/repositories/city.py +++ b/cerc_persistence/repositories/city.py @@ -20,7 +20,7 @@ from cerc_persistence.models import CityObject class City(Repository): """ - City repository + City(Repository) class """ _instance = None @@ -28,9 +28,6 @@ class City(Repository): super().__init__(db_name, dotenv_path, app_env) def __new__(cls, db_name, dotenv_path, app_env): - """ - Implemented for a singleton pattern - """ if cls._instance is None: cls._instance = super(City, cls).__new__(cls) return cls._instance diff --git a/cerc_persistence/repositories/city_object.py b/cerc_persistence/repositories/city_object.py index 2521d8e..255f59d 100644 --- a/cerc_persistence/repositories/city_object.py +++ b/cerc_persistence/repositories/city_object.py @@ -19,7 +19,7 @@ from cerc_persistence.repository import Repository class CityObject(Repository): """ - City object repository + CityObject(Repository) class """ _instance = None @@ -27,9 +27,6 @@ class CityObject(Repository): super().__init__(db_name, dotenv_path, app_env) def __new__(cls, db_name, dotenv_path, app_env): - """ - Implemented for a singleton pattern - """ if cls._instance is None: cls._instance = super(CityObject, cls).__new__(cls) return cls._instance diff --git a/cerc_persistence/repositories/simulation_results.py b/cerc_persistence/repositories/simulation_results.py index f87e0be..c42c562 100644 --- a/cerc_persistence/repositories/simulation_results.py +++ b/cerc_persistence/repositories/simulation_results.py @@ -20,7 +20,7 @@ from cerc_persistence.models import SimulationResults as Model class SimulationResults(Repository): """ - Simulation results repository + SimulationResults(Repository) class """ _instance = None @@ -28,9 +28,6 @@ class SimulationResults(Repository): super().__init__(db_name, dotenv_path, app_env) def __new__(cls, db_name, dotenv_path, app_env): - """ - Implemented for a singleton pattern - """ if cls._instance is None: cls._instance = super(SimulationResults, cls).__new__(cls) return cls._instance diff --git a/cerc_persistence/repositories/user.py b/cerc_persistence/repositories/user.py index 75d3a0e..ec80814 100644 --- a/cerc_persistence/repositories/user.py +++ b/cerc_persistence/repositories/user.py @@ -18,7 +18,7 @@ from cerc_persistence.models import User as Model, Application as ApplicationMod class User(Repository): """ - User class + User(Repository) class """ _instance = None @@ -26,9 +26,6 @@ class User(Repository): super().__init__(db_name, dotenv_path, app_env) def __new__(cls, db_name, dotenv_path, app_env): - """ - Implemented for a singleton pattern - """ if cls._instance is None: cls._instance = super(User, cls).__new__(cls) return cls._instance