Skip to content
Open
Show file tree
Hide file tree
Changes from all 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
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 : info@opengis.ch
***************************************************************************/
Metadata:
Creation Date: 2012-04-17
Copyright: (C) 2017 by OPENGIS.ch
Contact: info@opengis.ch

/***************************************************************************
* *
* 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 : info@opengis.ch
***************************************************************************/

/***************************************************************************
* *
* 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: info@opengis.ch

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 : info@opengis.ch
***************************************************************************/

/***************************************************************************
* *
* 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: info@opengis.ch

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 : info@opengis.ch
***************************************************************************/

/***************************************************************************
* *
* 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: info@opengis.ch

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: bool = False,
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 : info@opengis.ch
***************************************************************************/

/***************************************************************************
* *
* 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: info@opengis.ch

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
87 changes: 42 additions & 45 deletions modelbaker/db_factory/db_command_config_manager.py
Original file line number Diff line number Diff line change
@@ -1,20 +1,16 @@
"""
/***************************************************************************
begin : 13/05/19
git sha : :%H$
copyright : (C) 2019 by Yesid Polania
email : yesidpol.3@gmail.com
***************************************************************************/

/***************************************************************************
* *
* 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: yesidpol.3@gmail.com

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
Expand All @@ -28,57 +24,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 +89,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