11"""
2- /***************************************************************************
3- begin : 13/05/19
4- git sha : :%H$
5- copyright : (C) 2019 by Yesid Polania
6- 7- ***************************************************************************/
8-
9- /***************************************************************************
10- * *
11- * This program is free software; you can redistribute it and/or modify *
12- * it under the terms of the GNU General Public License as published by *
13- * the Free Software Foundation; either version 2 of the License, or *
14- * (at your option) any later version. *
15- * *
16- ***************************************************************************/
2+ Metadata:
3+ Creation Date: 2019-05-13
4+ Copyright: (C) 2019 by Yesid Polania
5+ 6+
7+ License:
8+ This program is free software; you can redistribute it and/or modify
9+ it under the terms of the **GNU General Public License** as published by
10+ the Free Software Foundation; either version 2 of the License, or
11+ (at your option) any later version.
1712"""
13+
1814from __future__ import annotations
1915
2016from abc import ABC , abstractmethod
17+ from typing import Optional
2118
2219from ..iliwrapper .ili2dbconfig import (
2320 Ili2DbCommandConfiguration ,
@@ -30,55 +27,51 @@ class DbCommandConfigManager(ABC):
3027
3128 Provides database uri, arguments to ili2db and a way to save and load configurations parameters
3229 based on a object configuration.
33-
34- :ivar configuration object that will be managed
3530 """
3631
3732 def __init__ (self , configuration : Ili2DbCommandConfiguration ) -> None :
38- """
39- :param configuration: Configuration object that will be managed.
40- :type configuration: :class:`Ili2DbCommandConfiguration`
41- """
4233 self .configuration = configuration
4334
4435 @abstractmethod
4536 def get_uri (
46- self , su : bool = False , qgis : bool = False , fallback_user : str = None
37+ self , su : bool = False , qgis : bool = False , fallback_user : Optional [ str ] = None
4738 ) -> str :
48- """Gets database uri (connection string) for db connectors (:class:` DBConnector` ).
39+ """Gets database uri (connection string) for db connectors (DBConnector).
4940
50- :param bool su: *True* to use super user credentials, *False* otherwise.
51- :param bool qgis: *True* to use qgis specific credentials (e.g. authcfg), *False* otherwise.
52- :param str fallback_user: a username as fallback most possibly used when you want to pass your os account name to connect the database
53- :return: Database uri (connection string).
54- :rtype str
55- """
41+ Args:
42+ su (bool): *True* to use super user credentials, *False* otherwise.
43+ qgis (bool): *True* to use qgis specific credentials (e.g. authcfg), *False* otherwise.
44+ fallback_user (str): a username as fallback most possibly used when you want to pass your os account name to connect the database
45+
46+ Returns:
47+ str: Database uri (connection string)."""
5648
5749 @abstractmethod
5850 def get_db_args (self , hide_password : bool = False , su : bool = False ) -> list [str ]:
5951 """Gets a list of ili2db arguments related to database.
6052
61- :param bool hide_password: *True* to mask the password, *False* otherwise.
62- :param bool su: *True* to use super user password, *False* otherwise. Default is False.
63- :return: ili2db arguments list.
64- :rtype: list
65- """
53+ Args:
54+ hide_password (bool): *True* to mask the password, *False* otherwise.
55+ su (bool): *True* to use super user password, *False* otherwise. Default is False.
56+
57+ Returns:
58+ list: ili2db arguments list."""
6659
6760 def get_schema_import_args (self ) -> list [str ]:
6861 """Gets a list of ili2db arguments to use in operation schema import.
6962
70- :return: ili2db arguments list.
71- :rtype: list
72- """
63+ Returns:
64+ list: ili2db arguments list."""
7365 return list ()
7466
7567 def get_ili2db_args (self , hide_password : bool = False ) -> list [str ]:
7668 """Gets a complete list of ili2db arguments in order to execute the app.
7769
78- :param bool hide_password: *True* to mask the password, *False* otherwise.
79- :return: ili2db arguments list.
80- :rtype: list
81- """
70+ Args:
71+ hide_password (bool): *True* to mask the password, *False* otherwise.
72+
73+ Returns:
74+ list: ili2db arguments list."""
8275 db_args = self .get_db_args (hide_password , self .configuration .db_use_super_login )
8376
8477 if type (self .configuration ) is SchemaImportConfiguration :
@@ -90,14 +83,8 @@ def get_ili2db_args(self, hide_password: bool = False) -> list[str]:
9083
9184 @abstractmethod
9285 def save_config_in_qsettings (self ) -> None :
93- """Saves configuration values related to database in QSettings.
94-
95- :return: None
96- """
86+ """Saves configuration values related to database in QSettings."""
9787
9888 @abstractmethod
9989 def load_config_from_qsettings (self ) -> None :
100- """Loads configuration values related to database from Qsettings.
101-
102- :return: None
103- """
90+ """Loads configuration values related to database from Qsettings."""
0 commit comments