Skip to content

Commit de2b747

Browse files
committed
Converted reSt docstrings to google docstrings - yes, done by AI but checked by real code monkey
1 parent 14026d9 commit de2b747

File tree

13 files changed

+145
-135
lines changed

13 files changed

+145
-135
lines changed

modelbaker/db_factory/db_command_config_manager.py

Lines changed: 30 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -24,17 +24,16 @@
2424
class DbCommandConfigManager(ABC):
2525
"""Manages a configuration object to return specific information of some database. This is a abstract class.
2626
27-
Provides database uri, arguments to ili2db and a way to save and load configurations parameters
28-
based on a object configuration.
27+
Provides database uri, arguments to ili2db and a way to save and load configurations parameters
28+
based on a object configuration.
2929
30-
:ivar configuration object that will be managed
31-
"""
30+
configuration object that will be managed"""
3231

3332
def __init__(self, configuration: Ili2DbCommandConfiguration) -> None:
3433
"""
35-
:param configuration: Configuration object that will be managed.
36-
:type configuration: :class:`Ili2DbCommandConfiguration`
37-
"""
34+
35+
Args:
36+
configuration (:class:`Ili2DbCommandConfiguration`): Configuration object that will be managed."""
3837
self.configuration = configuration
3938

4039
@abstractmethod
@@ -43,38 +42,40 @@ def get_uri(
4342
) -> str:
4443
"""Gets database uri (connection string) for db connectors (:class:`DBConnector`).
4544
46-
:param bool su: *True* to use super user credentials, *False* otherwise.
47-
:param bool qgis: *True* to use qgis specific credentials (e.g. authcfg), *False* otherwise.
48-
:param str fallback_user: a username as fallback most possibly used when you want to pass your os account name to connect the database
49-
:return: Database uri (connection string).
50-
:rtype str
51-
"""
45+
Args:
46+
fallback_user (str): a username as fallback most possibly used when you want to pass your os account name to connect the database
47+
qgis (bool): *True* to use qgis specific credentials (e.g. authcfg), *False* otherwise.
48+
su (bool): *True* to use super user credentials, *False* otherwise.
49+
50+
Returns:
51+
Database uri (connection string)."""
5252

5353
@abstractmethod
5454
def get_db_args(self, hide_password: bool = False, su: bool = False) -> list[str]:
5555
"""Gets a list of ili2db arguments related to database.
5656
57-
:param bool hide_password: *True* to mask the password, *False* otherwise.
58-
:param bool su: *True* to use super user password, *False* otherwise. Default is False.
59-
:return: ili2db arguments list.
60-
:rtype: list
61-
"""
57+
Args:
58+
hide_password (bool): *True* to mask the password, *False* otherwise.
59+
su (bool): *True* to use super user password, *False* otherwise. Default is False.
60+
61+
Returns:
62+
list: ili2db arguments list."""
6263

6364
def get_schema_import_args(self) -> list[str]:
6465
"""Gets a list of ili2db arguments to use in operation schema import.
6566
66-
:return: ili2db arguments list.
67-
:rtype: list
68-
"""
67+
Returns:
68+
list: ili2db arguments list."""
6969
return list()
7070

7171
def get_ili2db_args(self, hide_password: bool = False) -> list[str]:
7272
"""Gets a complete list of ili2db arguments in order to execute the app.
7373
74-
:param bool hide_password: *True* to mask the password, *False* otherwise.
75-
:return: ili2db arguments list.
76-
:rtype: list
77-
"""
74+
Args:
75+
hide_password (bool): *True* to mask the password, *False* otherwise.
76+
77+
Returns:
78+
list: ili2db arguments list."""
7879
db_args = self.get_db_args(hide_password, self.configuration.db_use_super_login)
7980

8081
if type(self.configuration) is SchemaImportConfiguration:
@@ -88,12 +89,12 @@ def get_ili2db_args(self, hide_password: bool = False) -> list[str]:
8889
def save_config_in_qsettings(self) -> None:
8990
"""Saves configuration values related to database in QSettings.
9091
91-
:return: None
92-
"""
92+
Returns:
93+
None"""
9394

9495
@abstractmethod
9596
def load_config_from_qsettings(self) -> None:
9697
"""Loads configuration values related to database from Qsettings.
9798
98-
:return: None
99-
"""
99+
Returns:
100+
None"""

modelbaker/db_factory/db_factory.py

Lines changed: 32 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -30,72 +30,71 @@ class DbFactory(ABC):
3030
def get_db_connector(self, uri: str, schema: Optional[str]) -> DBConnector:
3131
"""Returns an instance of connector to database (:class:`DBConnector`).
3232
33-
:param str uri: Database connection string.
34-
:param str schema: Database schema.
35-
:return: A connector to specific database.
36-
:rtype: :class:`DBConnector`
37-
:raises :class:`DBConnectorError`: when the connection fails.
38-
"""
33+
Args:
34+
schema (str): Database schema.
35+
uri (str): Database connection string.
36+
37+
Returns:
38+
:class:`DBConnector`: A connector to specific database."""
3939

4040
@abstractmethod
4141
def get_db_command_config_manager(
4242
self, configuration: Ili2DbCommandConfiguration
4343
) -> DbCommandConfigManager:
4444
"""Returns an instance of a database command config manager.
4545
46-
:param configuration: Configuration object that will be managed.
47-
:type configuration: :class:`Ili2DbCommandConfiguration`
48-
:return: Object that manages a configuration object to return specific information of some database.
49-
:rtype :class:`DbCommandConfigManager`
50-
"""
46+
Args:
47+
configuration (:class:`Ili2DbCommandConfiguration`): Configuration object that will be managed.
48+
49+
Returns:
50+
Object that manages a configuration object to return specific information of some database."""
5151

5252
@abstractmethod
5353
def get_layer_uri(self, uri: str) -> LayerUri:
5454
"""Returns an instance of a layer uri.
5555
56-
:param str uri: Database connection string.
57-
:return: A object that provides layer uri.
58-
:rtype :class:`LayerUri`
59-
"""
56+
Args:
57+
uri (str): Database connection string.
58+
59+
Returns:
60+
A object that provides layer uri."""
6061

6162
@abstractmethod
6263
def pre_generate_project(
6364
self, configuration: Ili2DbCommandConfiguration
6465
) -> tuple[bool, str]:
6566
"""This method will be called before an operation of generate project is executed.
6667
67-
:param configuration: Configuration parameters with which will be executed the operation of generate project.
68-
:type configuration: :class:`Ili2DbCommandConfiguration`
69-
:return: *True* and an empty message if the called method was succeeded, *False* and a warning message otherwise.
70-
"""
68+
Args:
69+
configuration (:class:`Ili2DbCommandConfiguration`): Configuration parameters with which will be executed the operation of generate project.
70+
71+
Returns:
72+
*True* and an empty message if the called method was succeeded, *False* and a warning message otherwise."""
7173

7274
@abstractmethod
7375
def post_generate_project_validations(
7476
self, configuration: Ili2DbCommandConfiguration, fallback_user: str = None
7577
) -> tuple[bool, str]:
7678
"""This method will be called after an operation of generate project is executed.
7779
78-
:param class:`Ili2DbCommandConfiguration` configuration: Configuration parameters with which were executed the operation of generate project.
79-
:param str fallback_user: a username as fallback most possibly used when you want to pass your os account name to connect the database
80-
:return: *True* and an empty message if the called method was succeeded, *False* and a warning message otherwise.
81-
"""
80+
Args:
81+
class: `Ili2DbCommandConfiguration` configuration: Configuration parameters with which were executed the operation of generate project.
82+
fallback_user (str): a username as fallback most possibly used when you want to pass your os account name to connect the database
8283
83-
def get_specific_messages(self) -> dict[str, str]:
84-
"""Returns specific words that will be used in warning and error messages.
84+
Returns:
85+
*True* and an empty message if the called method was succeeded, *False* and a warning message otherwise."""
8586

86-
:rtype dict
87-
"""
87+
def get_specific_messages(self) -> dict[str, str]:
88+
"""Returns specific words that will be used in warning and error messages."""
8889
messages = {"db_or_schema": "schema", "layers_source": "schema"}
8990

9091
return messages
9192

9293
def customize_widget_editor(self, field: Field, data_type: str) -> None:
9394
"""Allows customizing the way a field is shown in the widget editor.
9495
95-
For instance, a boolean field can be shown as a checkbox.
96+
For instance, a boolean field can be shown as a checkbox.
9697
97-
:param field: The field that will be customized
98-
:type field: :class:`Field`
99-
:param data_type: The type of field
100-
:return None
101-
"""
98+
Args:
99+
data_type: The type of field
100+
field (:class:`Field`): The field that will be customized"""

modelbaker/db_factory/db_simple_factory.py

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -46,10 +46,11 @@ class DbSimpleFactory:
4646
def create_factory(self, ili_mode: DbIliMode) -> Optional[DbFactory]:
4747
"""Creates an instance of :class:`DbFactory` based on ili_mode parameter.
4848
49-
:param ili_mode: Value specifying which factory will be instantiated.
50-
:type ili_mode: :class:`DbIliMode`
51-
:return: A database factory
52-
"""
49+
Args:
50+
ili_mode (:class:`DbIliMode`): Value specifying which factory will be instantiated.
51+
52+
Returns:
53+
A database factory"""
5354
if not ili_mode:
5455
return None
5556

@@ -69,13 +70,14 @@ def create_factory(self, ili_mode: DbIliMode) -> Optional[DbFactory]:
6970
def get_db_list(self, is_schema_import: bool = False) -> list[DbIliMode]:
7071
"""Gets a list containing the databases available in modelbaker.
7172
72-
This list can be used to show the available databases in GUI, for example, **QComboBox source**
73-
in **Import Data Dialog**.
73+
This list can be used to show the available databases in GUI, for example, **QComboBox source**
74+
in **Import Data Dialog**.
75+
76+
Args:
77+
is_schema_import (bool): *True* to include interlis operation values, *False* otherwise.
7478
75-
:param bool is_schema_import: *True* to include interlis operation values, *False* otherwise.
76-
:return: A list containing the databases available.
77-
:rtype: list
78-
"""
79+
Returns:
80+
list: A list containing the databases available."""
7981
ili = []
8082
result = available_database_factories.keys()
8183

@@ -91,7 +93,6 @@ def get_db_list(self, is_schema_import: bool = False) -> list[DbIliMode]:
9193
def default_database(self) -> DbIliMode:
9294
"""Gets a default database for modelbaker.
9395
94-
:return: Default database for modelbaker.
95-
:rtype: :class:`DbIliMode`
96-
"""
96+
Returns:
97+
:class:`DbIliMode`: Default database for modelbaker."""
9798
return list(available_database_factories.keys())[0]

modelbaker/db_factory/gpkg_command_config_manager.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,11 +22,10 @@
2222
class GpkgCommandConfigManager(DbCommandConfigManager):
2323
"""Manages a configuration object to return specific information of Geopackage.
2424
25-
Provides database uri, arguments to ili2db and a way to save and load configurations parameters
26-
based on a object configuration.
25+
Provides database uri, arguments to ili2db and a way to save and load configurations parameters
26+
based on a object configuration.
2727
28-
:ivar configuration object that will be managed
29-
"""
28+
configuration object that will be managed"""
3029

3130
_settings_base_path = "ili2gpkg/"
3231

modelbaker/db_factory/gpkg_layer_uri.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,9 @@
1717
class GpkgLayerUri(LayerUri):
1818
"""Provides layer uri based on database uri (connection string) and specific information of the data source.
1919
20-
This **layer uri** is used to create a Qgis layer.
20+
This **layer uri** is used to create a Qgis layer.
2121
22-
:ivar str uri: Database uri.
23-
"""
22+
str uri: Database uri."""
2423

2524
def __init__(self, uri: str) -> None:
2625
LayerUri.__init__(self, uri)

modelbaker/db_factory/layer_uri.py

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -17,24 +17,24 @@
1717
class LayerUri(ABC):
1818
"""Provides layer uri based on database uri (connection string) and specific information of the data source. This is a abstract class.
1919
20-
This **layer uri** is used to create a Qgis layer.
20+
This **layer uri** is used to create a Qgis layer.
2121
22-
:ivar str uri: Database uri.
23-
:ivar str provider: Database provider.
24-
"""
22+
str provider: Database provider."""
2523

2624
def __init__(self, uri: str) -> None:
2725
"""
28-
:param str uri: Database uri. This is the same database uri of the db connectors.
29-
"""
26+
27+
Args:
28+
uri (str): Database uri. This is the same database uri of the db connectors."""
3029
self.uri = uri
3130
self.provider = None
3231

3332
@abstractmethod
3433
def get_data_source_uri(self, record: dict) -> str:
3534
"""Provides layer uri based on database uri and specific information of the data source.
3635
37-
:param str record: Dictionary containing specific information of the data source.
38-
:return: Layer uri.
39-
:rtype: str
40-
"""
36+
Args:
37+
record (str): Dictionary containing specific information of the data source.
38+
39+
Returns:
40+
str: Layer uri."""

modelbaker/db_factory/pg_command_config_manager.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,11 +23,10 @@
2323
class PgCommandConfigManager(DbCommandConfigManager):
2424
"""Manages a configuration object to return specific information of Postgres/Postgis.
2525
26-
Provides database uri, arguments to ili2db and a way to save and load configurations parameters
27-
based on a object configuration.
26+
Provides database uri, arguments to ili2db and a way to save and load configurations parameters
27+
based on a object configuration.
2828
29-
:ivar configuration object that will be managed
30-
"""
29+
configuration object that will be managed"""
3130

3231
_settings_base_path = "ili2pg/"
3332

modelbaker/db_factory/pg_layer_uri.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,9 @@
1717
class PgLayerUri(LayerUri):
1818
"""Provides layer uri based on database uri (connection string) and specific information of the data source.
1919
20-
This **layer uri** is used to create a Qgis layer.
20+
This **layer uri** is used to create a Qgis layer.
2121
22-
:ivar str uri: Database uri.
23-
"""
22+
str uri: Database uri."""
2423

2524
def __init__(self, uri: str) -> None:
2625
LayerUri.__init__(self, uri)

modelbaker/generator/generator.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -52,11 +52,11 @@ def __init__(
5252
raw_naming=False,
5353
) -> None:
5454
"""
55-
Creates a new Generator objects.
56-
:param uri: The uri that should be used in the resulting project. If authcfg is used, make sure the mgmt_uri is set as well.
57-
:param mgmt_uri: The uri that should be used to create schemas, tables and query meta information. Does not support authcfg but a fallback username.
58-
:consider_basket_handling: Makes the specific handling of basket tables depending if schema is created with createBasketCol.
59-
"""
55+
Creates a new Generator objects.
56+
57+
Args:
58+
mgmt_uri: The uri that should be used to create schemas, tables and query meta information. Does not support authcfg but a fallback username.
59+
uri: The uri that should be used in the resulting project. If authcfg is used, make sure the mgmt_uri is set as well."""
6060
QObject.__init__(self, parent)
6161
self.tool = tool
6262
self.uri = uri

modelbaker/iliwrapper/ili2dbargs.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,11 @@
2323
def get_ili2db_args(configuration, hide_password=False):
2424
"""Gets a complete list of ili2db arguments in order to execute the app.
2525
26-
:param bool hide_password: *True* to mask the password, *False* otherwise.
27-
:return: ili2db arguments list.
28-
:rtype: list
29-
"""
26+
Args:
27+
hide_password (bool): *True* to mask the password, *False* otherwise.
28+
29+
Returns:
30+
list: ili2db arguments list."""
3031
db_args = _get_db_args(configuration, hide_password)
3132

3233
if type(configuration) is SchemaImportConfiguration:

0 commit comments

Comments
 (0)