Skip to content
Merged
Show file tree
Hide file tree
Changes from 7 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion .docker/docker-compose.gh.yml
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
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/continuous_integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:
strategy:
fail-fast: false # keep for now, since 3.22 and 3.28 have different bases than 3.34+
matrix:
qgis_version: [release-3_22, release-3_28, 3.34, latest]
qgis_version: [release-3_22, release-3_28, '3.34', '3.40', latest]
env:
QGIS_TEST_VERSION: ${{ matrix.qgis_version }}
steps:
Expand Down
25 changes: 10 additions & 15 deletions modelbaker/dataobjects/fields.py
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: 2012-04-17
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
Expand Down
27 changes: 11 additions & 16 deletions modelbaker/dataobjects/form.py
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
Expand Down
39 changes: 17 additions & 22 deletions modelbaker/dataobjects/layers.py
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: 2014-11-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

import logging
Expand Down Expand Up @@ -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,
Expand All @@ -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)
Expand Down
31 changes: 13 additions & 18 deletions modelbaker/dataobjects/legend.py
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
Expand All @@ -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
Expand Down
27 changes: 11 additions & 16 deletions modelbaker/dataobjects/project.py
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
Expand Down
88 changes: 43 additions & 45 deletions modelbaker/db_factory/db_command_config_manager.py
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,
Expand All @@ -28,57 +25,58 @@
class DbCommandConfigManager(ABC):
"""Manages a configuration object to return specific information of some database. This is a abstract class.

Provides database uri, arguments to ili2db and a way to save and load configurations parameters
based on a object configuration.
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
"""
configuration object that will be managed"""

def __init__(self, configuration: Ili2DbCommandConfiguration) -> None:
"""
:param configuration: Configuration object that will be managed.
:type configuration: :class:`Ili2DbCommandConfiguration`
"""

Args:
configuration (:class:`Ili2DbCommandConfiguration`): Configuration object that will be managed."""
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`).

: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:
fallback_user (str): a username as fallback most possibly used when you want to pass your os account name to connect the database
qgis (bool): *True* to use qgis specific credentials (e.g. authcfg), *False* otherwise.
su (bool): *True* to use super user credentials, *False* otherwise.

Returns:
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:
Expand All @@ -92,12 +90,12 @@ def get_ili2db_args(self, hide_password: bool = False) -> list[str]:
def save_config_in_qsettings(self) -> None:
"""Saves configuration values related to database in QSettings.

:return: None
"""
Returns:
None"""

@abstractmethod
def load_config_from_qsettings(self) -> None:
"""Loads configuration values related to database from Qsettings.

:return: None
"""
Returns:
None"""
Loading
Loading