Skip to content

Commit bd9a17f

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 bd9a17f

34 files changed

+499
-365
lines changed

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: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ def __init__(self, configuration: Ili2DbCommandConfiguration) -> None:
3838

3939
@abstractmethod
4040
def get_uri(
41-
self, su: bool = False, qgis: bool = False, fallback_user: str = None
41+
self, su: bool = False, qgis: bool = False, fallback_user: Optional[str] = None
4242
) -> str:
4343
"""Gets database uri (connection string) for db connectors (:class:`DBConnector`).
4444

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: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ def __init__(self, configuration: Ili2DbCommandConfiguration) -> None:
3333
DbCommandConfigManager.__init__(self, configuration)
3434

3535
def get_uri(
36-
self, su: bool = False, qgis: bool = False, fallback_user: str = None
36+
self, su: bool = False, qgis: bool = False, fallback_user: Optional[str] = None
3737
) -> str:
3838
return self.configuration.dbfile
3939

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: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ def __init__(self, configuration: Ili2DbCommandConfiguration) -> None:
2727
DbCommandConfigManager.__init__(self, configuration)
2828

2929
def get_uri(
30-
self, su: bool = False, qgis: bool = False, fallback_user: str = None
30+
self, su: bool = False, qgis: bool = False, fallback_user: Optional[str] = None
3131
) -> str:
3232
separator = ";"
3333
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: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ def __init__(self, configuration: Ili2DbCommandConfiguration) -> None:
3434
DbCommandConfigManager.__init__(self, configuration)
3535

3636
def get_uri(
37-
self, su: bool = False, qgis: bool = False, fallback_user: str = None
37+
self, su: bool = False, qgis: bool = False, fallback_user: Optional[str] = None
3838
) -> str:
3939
uri = []
4040

modelbaker/db_factory/pg_factory.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,9 @@ def pre_generate_project(
6767
return result, message
6868

6969
def post_generate_project_validations(
70-
self, configuration: Ili2DbCommandConfiguration, fallback_user: str = None
70+
self,
71+
configuration: Ili2DbCommandConfiguration,
72+
fallback_user: Optional[str] = None,
7173
) -> tuple[bool, str]:
7274
result = False
7375
message = ""

0 commit comments

Comments
 (0)