Skip to content

Commit 0ecb6f5

Browse files
committed
Type hints for dbconnector
Type hints for iliwrapper Typehints for generator Type hints for utils Type hints for ilitoppingmaker
1 parent ade3288 commit 0ecb6f5

35 files changed

+523
-356
lines changed

.docker/docker-compose.gh.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
version: '3'
21
services:
32
postgres13:
43
image: postgis/postgis:13-3.4-alpine

modelbaker/dataobjects/layers.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -41,18 +41,18 @@
4141
class Layer:
4242
def __init__(
4343
self,
44-
provider: str = None,
45-
uri: str = None,
46-
name: str = None,
44+
provider: Optional[str] = None,
45+
uri: Optional[str] = None,
46+
name: Optional[str] = None,
4747
srid: Optional[int] = None,
4848
extent: Optional[str] = None,
49-
geometry_column: str = None,
49+
geometry_column: Optional[str] = None,
5050
wkb_type: QgsWkbTypes = QgsWkbTypes.Type.Unknown,
5151
alias: Optional[str] = None,
5252
is_domain: bool = False, # is enumeration or catalogue
5353
is_structure: bool = False,
5454
is_nmrel: bool = False,
55-
display_expression: str = None,
55+
display_expression: Optional[str] = None,
5656
coordinate_precision: Optional[float] = None,
5757
is_basket_table: bool = False,
5858
is_dataset_table: bool = False,
@@ -68,7 +68,7 @@ def __init__(
6868
qmlstylefile: Optional[str] = None,
6969
styles: dict[str, dict[str, str]] = {},
7070
is_enum: bool = False,
71-
base_class: str = None,
71+
base_class: Optional[str] = None,
7272
provider_names_map: dict[
7373
str, str
7474
] = {}, # provider specific column names (e.g. T_Id vs t_id)

modelbaker/dataobjects/legend.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,9 @@
2929
class LegendGroup:
3030
def __init__(
3131
self,
32-
name: str = None,
32+
name: Optional[str] = None,
3333
expanded: bool = True,
34-
ignore_node_names: bool = None,
34+
ignore_node_names: bool = False,
3535
static_sorting: bool = False,
3636
) -> None:
3737
self.name = name

modelbaker/db_factory/db_command_config_manager.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
from __future__ import annotations
1515

1616
from abc import ABC, abstractmethod
17+
from typing import Optional
1718

1819
from ..iliwrapper.ili2dbconfig import (
1920
Ili2DbCommandConfiguration,
@@ -38,7 +39,7 @@ def __init__(self, configuration: Ili2DbCommandConfiguration) -> None:
3839

3940
@abstractmethod
4041
def get_uri(
41-
self, su: bool = False, qgis: bool = False, fallback_user: str = None
42+
self, su: bool = False, qgis: bool = False, fallback_user: Optional[str] = None
4243
) -> str:
4344
"""Gets database uri (connection string) for db connectors (:class:`DBConnector`).
4445

modelbaker/db_factory/db_factory.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,9 @@ def pre_generate_project(
7373

7474
@abstractmethod
7575
def post_generate_project_validations(
76-
self, configuration: Ili2DbCommandConfiguration, fallback_user: str = None
76+
self,
77+
configuration: Ili2DbCommandConfiguration,
78+
fallback_user: Optional[str] = None,
7779
) -> tuple[bool, str]:
7880
"""This method will be called after an operation of generate project is executed.
7981

modelbaker/db_factory/gpkg_command_config_manager.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@
1313

1414
from __future__ import annotations
1515

16+
from typing import Optional
17+
1618
from qgis.PyQt.QtCore import QSettings
1719

1820
from ..iliwrapper.ili2dbconfig import Ili2DbCommandConfiguration
@@ -33,7 +35,7 @@ def __init__(self, configuration: Ili2DbCommandConfiguration) -> None:
3335
DbCommandConfigManager.__init__(self, configuration)
3436

3537
def get_uri(
36-
self, su: bool = False, qgis: bool = False, fallback_user: str = None
38+
self, su: bool = False, qgis: bool = False, fallback_user: Optional[str] = None
3739
) -> str:
3840
return self.configuration.dbfile
3941

modelbaker/db_factory/gpkg_factory.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,9 @@ def pre_generate_project(
4242
return True, ""
4343

4444
def post_generate_project_validations(
45-
self, configuration: Ili2DbCommandConfiguration, fallback_user: str = None
45+
self,
46+
configuration: Ili2DbCommandConfiguration,
47+
fallback_user: Optional[str] = None,
4648
) -> tuple[bool, str]:
4749
return True, ""
4850

modelbaker/db_factory/mssql_command_config_manager.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@
1313

1414
from __future__ import annotations
1515

16+
from typing import Optional
17+
1618
from qgis.PyQt.QtCore import QSettings
1719

1820
from ..iliwrapper.ili2dbconfig import Ili2DbCommandConfiguration
@@ -27,7 +29,7 @@ def __init__(self, configuration: Ili2DbCommandConfiguration) -> None:
2729
DbCommandConfigManager.__init__(self, configuration)
2830

2931
def get_uri(
30-
self, su: bool = False, qgis: bool = False, fallback_user: str = None
32+
self, su: bool = False, qgis: bool = False, fallback_user: Optional[str] = None
3133
) -> str:
3234
separator = ";"
3335
uri = []

modelbaker/db_factory/mssql_factory.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,9 @@ def pre_generate_project(
4141
return True, ""
4242

4343
def post_generate_project_validations(
44-
self, configuration: Ili2DbCommandConfiguration, fallback_user: str = None
44+
self,
45+
configuration: Ili2DbCommandConfiguration,
46+
fallback_user: Optional[str] = None,
4547
) -> tuple[bool, str]:
4648
return True, ""
4749

modelbaker/db_factory/pg_command_config_manager.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@
1313

1414
from __future__ import annotations
1515

16+
from typing import Optional
17+
1618
from qgis.PyQt.QtCore import QSettings
1719

1820
from ..iliwrapper.ili2dbconfig import Ili2DbCommandConfiguration
@@ -34,7 +36,7 @@ def __init__(self, configuration: Ili2DbCommandConfiguration) -> None:
3436
DbCommandConfigManager.__init__(self, configuration)
3537

3638
def get_uri(
37-
self, su: bool = False, qgis: bool = False, fallback_user: str = None
39+
self, su: bool = False, qgis: bool = False, fallback_user: Optional[str] = None
3840
) -> str:
3941
uri = []
4042

0 commit comments

Comments
 (0)