-
-
Notifications
You must be signed in to change notification settings - Fork 4
Typehints etc: Not yet the docstrings, but the base to create docstrings #161
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
2826db5
headers in proper format in tests
signedav ade3288
Converted reSt docstrings to google docstrings - yes, done by AI but …
signedav 0ecb6f5
Type hints for dbconnector
signedav b912aab
test current ltr
signedav fde828e
fix version string
signedav 628a5c7
fix wrong default
signedav 193efee
fixup
signedav f3c69a0
fix converted docstrings
signedav b245e56
fix wrong return type
signedav File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,4 +1,3 @@ | ||
| version: '3' | ||
| services: | ||
| postgres13: | ||
| image: postgis/postgis:13-3.4-alpine | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,21 +1,16 @@ | ||
| """ | ||
| /*************************************************************************** | ||
| ------------------- | ||
| begin : 2017-04-12 | ||
| git sha : :%H$ | ||
| copyright : (C) 2017 by OPENGIS.ch | ||
| email : [email protected] | ||
| ***************************************************************************/ | ||
| Metadata: | ||
| Creation Date: 2017-04-12 | ||
| Copyright: (C) 2017 by OPENGIS.ch | ||
| Contact: [email protected] | ||
|
|
||
| /*************************************************************************** | ||
| * * | ||
| * This program is free software; you can redistribute it and/or modify * | ||
| * it under the terms of the GNU General Public License as published by * | ||
| * the Free Software Foundation; either version 2 of the License, or * | ||
| * (at your option) any later version. * | ||
| * * | ||
| ***************************************************************************/ | ||
| License: | ||
| This program is free software; you can redistribute it and/or modify | ||
| it under the terms of the **GNU General Public License** as published by | ||
| the Free Software Foundation; either version 2 of the License, or | ||
| (at your option) any later version. | ||
| """ | ||
|
|
||
| from __future__ import annotations | ||
|
|
||
| from typing import TYPE_CHECKING | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,21 +1,16 @@ | ||
| """ | ||
| /*************************************************************************** | ||
| ------------------- | ||
| begin : 08/08/17 | ||
| git sha : :%H$ | ||
| copyright : (C) 2017 by OPENGIS.ch | ||
| email : [email protected] | ||
| ***************************************************************************/ | ||
|
|
||
| /*************************************************************************** | ||
| * * | ||
| * This program is free software; you can redistribute it and/or modify * | ||
| * it under the terms of the GNU General Public License as published by * | ||
| * the Free Software Foundation; either version 2 of the License, or * | ||
| * (at your option) any later version. * | ||
| * * | ||
| ***************************************************************************/ | ||
| Metadata: | ||
| Creation Date: 2017-08-08 | ||
| Copyright: (C) 2017 by OPENGIS.ch | ||
| Contact: [email protected] | ||
|
|
||
| License: | ||
| This program is free software; you can redistribute it and/or modify | ||
| it under the terms of the **GNU General Public License** as published by | ||
| the Free Software Foundation; either version 2 of the License, or | ||
| (at your option) any later version. | ||
| """ | ||
|
|
||
| from __future__ import annotations | ||
|
|
||
| from typing import TYPE_CHECKING, Optional, Union | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,21 +1,16 @@ | ||
| """ | ||
| /*************************************************************************** | ||
| ------------------- | ||
| begin : 2016-11-14 | ||
| git sha : :%H$ | ||
| copyright : (C) 2016 by OPENGIS.ch | ||
| email : [email protected] | ||
| ***************************************************************************/ | ||
|
|
||
| /*************************************************************************** | ||
| * * | ||
| * This program is free software; you can redistribute it and/or modify * | ||
| * it under the terms of the GNU General Public License as published by * | ||
| * the Free Software Foundation; either version 2 of the License, or * | ||
| * (at your option) any later version. * | ||
| * * | ||
| ***************************************************************************/ | ||
| Metadata: | ||
| Creation Date: 2016-11-14 | ||
| Copyright: (C) 2016 by OPENGIS.ch | ||
| Contact: [email protected] | ||
|
|
||
| License: | ||
| This program is free software; you can redistribute it and/or modify | ||
| it under the terms of the **GNU General Public License** as published by | ||
| the Free Software Foundation; either version 2 of the License, or | ||
| (at your option) any later version. | ||
| """ | ||
|
|
||
| from __future__ import annotations | ||
|
|
||
| import logging | ||
|
|
@@ -46,18 +41,18 @@ | |
| class Layer: | ||
| def __init__( | ||
| self, | ||
| provider: str = None, | ||
| uri: str = None, | ||
| name: str = None, | ||
| provider: Optional[str] = None, | ||
| uri: Optional[str] = None, | ||
| name: Optional[str] = None, | ||
| srid: Optional[int] = None, | ||
| extent: Optional[str] = None, | ||
| geometry_column: str = None, | ||
| geometry_column: Optional[str] = None, | ||
| wkb_type: QgsWkbTypes = QgsWkbTypes.Type.Unknown, | ||
| alias: Optional[str] = None, | ||
| is_domain: bool = False, # is enumeration or catalogue | ||
| is_structure: bool = False, | ||
| is_nmrel: bool = False, | ||
| display_expression: str = None, | ||
| display_expression: Optional[str] = None, | ||
| coordinate_precision: Optional[float] = None, | ||
| is_basket_table: bool = False, | ||
| is_dataset_table: bool = False, | ||
|
|
@@ -73,7 +68,7 @@ def __init__( | |
| qmlstylefile: Optional[str] = None, | ||
| styles: dict[str, dict[str, str]] = {}, | ||
| is_enum: bool = False, | ||
| base_class: str = None, | ||
| base_class: Optional[str] = None, | ||
| provider_names_map: dict[ | ||
| str, str | ||
| ] = {}, # provider specific column names (e.g. T_Id vs t_id) | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,21 +1,16 @@ | ||
| """ | ||
| /*************************************************************************** | ||
| ------------------- | ||
| begin : 2016-12-21 | ||
| git sha : :%H$ | ||
| copyright : (C) 2016 by OPENGIS.ch | ||
| email : [email protected] | ||
| ***************************************************************************/ | ||
|
|
||
| /*************************************************************************** | ||
| * * | ||
| * This program is free software; you can redistribute it and/or modify * | ||
| * it under the terms of the GNU General Public License as published by * | ||
| * the Free Software Foundation; either version 2 of the License, or * | ||
| * (at your option) any later version. * | ||
| * * | ||
| ***************************************************************************/ | ||
| Metadata: | ||
| Creation Date: 2021-12-16 | ||
| Copyright: (C) 2016 by OPENGIS.ch | ||
| Contact: [email protected] | ||
|
|
||
| License: | ||
| This program is free software; you can redistribute it and/or modify | ||
| it under the terms of the **GNU General Public License** as published by | ||
| the Free Software Foundation; either version 2 of the License, or | ||
| (at your option) any later version. | ||
| """ | ||
|
|
||
| from __future__ import annotations | ||
|
|
||
| from typing import Any, Optional, Union | ||
|
|
@@ -34,9 +29,9 @@ | |
| class LegendGroup: | ||
| def __init__( | ||
| self, | ||
| name: str = None, | ||
| name: Optional[str] = None, | ||
| expanded: bool = True, | ||
| ignore_node_names: bool = None, | ||
| ignore_node_names: Optional[list[str]] = [], | ||
| static_sorting: bool = False, | ||
| ) -> None: | ||
| self.name = name | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,21 +1,16 @@ | ||
| """ | ||
| /*************************************************************************** | ||
| ------------------- | ||
| begin : 2016-12-21 | ||
| git sha : :%H$ | ||
| copyright : (C) 2016 by OPENGIS.ch | ||
| email : [email protected] | ||
| ***************************************************************************/ | ||
|
|
||
| /*************************************************************************** | ||
| * * | ||
| * This program is free software; you can redistribute it and/or modify * | ||
| * it under the terms of the GNU General Public License as published by * | ||
| * the Free Software Foundation; either version 2 of the License, or * | ||
| * (at your option) any later version. * | ||
| * * | ||
| ***************************************************************************/ | ||
| Metadata: | ||
| Creation Date: 2021-12-16 | ||
| Copyright: (C) 2016 by OPENGIS.ch | ||
| Contact: [email protected] | ||
|
|
||
| License: | ||
| This program is free software; you can redistribute it and/or modify | ||
| it under the terms of the **GNU General Public License** as published by | ||
| the Free Software Foundation; either version 2 of the License, or | ||
| (at your option) any later version. | ||
| """ | ||
|
|
||
| from __future__ import annotations | ||
|
|
||
| from typing import Any, Optional | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,23 +1,20 @@ | ||
| """ | ||
| /*************************************************************************** | ||
| begin : 13/05/19 | ||
| git sha : :%H$ | ||
| copyright : (C) 2019 by Yesid Polania | ||
| email : [email protected] | ||
| ***************************************************************************/ | ||
|
|
||
| /*************************************************************************** | ||
| * * | ||
| * This program is free software; you can redistribute it and/or modify * | ||
| * it under the terms of the GNU General Public License as published by * | ||
| * the Free Software Foundation; either version 2 of the License, or * | ||
| * (at your option) any later version. * | ||
| * * | ||
| ***************************************************************************/ | ||
| Metadata: | ||
| Creation Date: 2019-05-13 | ||
| Copyright: (C) 2019 by Yesid Polania | ||
| Contact: [email protected] | ||
|
|
||
| License: | ||
| This program is free software; you can redistribute it and/or modify | ||
| it under the terms of the **GNU General Public License** as published by | ||
| the Free Software Foundation; either version 2 of the License, or | ||
| (at your option) any later version. | ||
| """ | ||
|
|
||
| from __future__ import annotations | ||
|
|
||
| from abc import ABC, abstractmethod | ||
| from typing import Optional | ||
|
|
||
| from ..iliwrapper.ili2dbconfig import ( | ||
| Ili2DbCommandConfiguration, | ||
|
|
@@ -30,55 +27,51 @@ class DbCommandConfigManager(ABC): | |
|
|
||
| Provides database uri, arguments to ili2db and a way to save and load configurations parameters | ||
| based on a object configuration. | ||
|
|
||
| :ivar configuration object that will be managed | ||
| """ | ||
|
|
||
| def __init__(self, configuration: Ili2DbCommandConfiguration) -> None: | ||
| """ | ||
| :param configuration: Configuration object that will be managed. | ||
| :type configuration: :class:`Ili2DbCommandConfiguration` | ||
| """ | ||
| self.configuration = configuration | ||
|
|
||
| @abstractmethod | ||
| def get_uri( | ||
| self, su: bool = False, qgis: bool = False, fallback_user: str = None | ||
| self, su: bool = False, qgis: bool = False, fallback_user: Optional[str] = None | ||
| ) -> str: | ||
| """Gets database uri (connection string) for db connectors (:class:`DBConnector`). | ||
| """Gets database uri (connection string) for db connectors (DBConnector). | ||
|
|
||
| :param bool su: *True* to use super user credentials, *False* otherwise. | ||
| :param bool qgis: *True* to use qgis specific credentials (e.g. authcfg), *False* otherwise. | ||
| :param str fallback_user: a username as fallback most possibly used when you want to pass your os account name to connect the database | ||
| :return: Database uri (connection string). | ||
| :rtype str | ||
| """ | ||
| Args: | ||
| su (bool): *True* to use super user credentials, *False* otherwise. | ||
| qgis (bool): *True* to use qgis specific credentials (e.g. authcfg), *False* otherwise. | ||
| fallback_user (str): a username as fallback most possibly used when you want to pass your os account name to connect the database | ||
|
|
||
| Returns: | ||
| str: Database uri (connection string).""" | ||
|
|
||
| @abstractmethod | ||
| def get_db_args(self, hide_password: bool = False, su: bool = False) -> list[str]: | ||
| """Gets a list of ili2db arguments related to database. | ||
|
|
||
| :param bool hide_password: *True* to mask the password, *False* otherwise. | ||
| :param bool su: *True* to use super user password, *False* otherwise. Default is False. | ||
| :return: ili2db arguments list. | ||
| :rtype: list | ||
| """ | ||
| Args: | ||
| hide_password (bool): *True* to mask the password, *False* otherwise. | ||
| su (bool): *True* to use super user password, *False* otherwise. Default is False. | ||
|
|
||
| Returns: | ||
| list: ili2db arguments list.""" | ||
|
|
||
| def get_schema_import_args(self) -> list[str]: | ||
| """Gets a list of ili2db arguments to use in operation schema import. | ||
|
|
||
| :return: ili2db arguments list. | ||
| :rtype: list | ||
| """ | ||
| Returns: | ||
| list: ili2db arguments list.""" | ||
| return list() | ||
|
|
||
| def get_ili2db_args(self, hide_password: bool = False) -> list[str]: | ||
| """Gets a complete list of ili2db arguments in order to execute the app. | ||
|
|
||
| :param bool hide_password: *True* to mask the password, *False* otherwise. | ||
| :return: ili2db arguments list. | ||
| :rtype: list | ||
| """ | ||
| Args: | ||
| hide_password (bool): *True* to mask the password, *False* otherwise. | ||
|
|
||
| Returns: | ||
| list: ili2db arguments list.""" | ||
| db_args = self.get_db_args(hide_password, self.configuration.db_use_super_login) | ||
|
|
||
| if type(self.configuration) is SchemaImportConfiguration: | ||
|
|
@@ -90,14 +83,8 @@ def get_ili2db_args(self, hide_password: bool = False) -> list[str]: | |
|
|
||
| @abstractmethod | ||
| def save_config_in_qsettings(self) -> None: | ||
| """Saves configuration values related to database in QSettings. | ||
|
|
||
| :return: None | ||
| """ | ||
| """Saves configuration values related to database in QSettings.""" | ||
|
|
||
| @abstractmethod | ||
| def load_config_from_qsettings(self) -> None: | ||
| """Loads configuration values related to database from Qsettings. | ||
|
|
||
| :return: None | ||
| """ | ||
| """Loads configuration values related to database from Qsettings.""" | ||
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.