Skip to content

Commit bdd7075

Browse files
committed
feat: adapt ty findings
JIRA: TRIVIAL risk: low
1 parent 3995f46 commit bdd7075

File tree

42 files changed

+105
-78
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

42 files changed

+105
-78
lines changed

packages/gooddata-dbt/src/gooddata_dbt/dbt/cloud.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -291,12 +291,12 @@ def dict_camel_to_snake(self, data: Union[dict, list]) -> Union[dict, list]:
291291
else:
292292
return record
293293
else:
294-
result = {} # type: ignore
294+
result = {}
295295
for key, value in data.items():
296296
if isinstance(value, dict):
297-
result[self.string_camel_to_snake(key)] = self.dict_camel_to_snake(value) # type: ignore
297+
result[self.string_camel_to_snake(key)] = self.dict_camel_to_snake(value)
298298
else:
299-
result[self.string_camel_to_snake(key)] = value # type: ignore
299+
result[self.string_camel_to_snake(key)] = value
300300
return result
301301

302302
def get_last_execution(self, environment_id: str, model_count: int) -> list[DbtExecution]:

packages/gooddata-dbt/src/gooddata_dbt/gooddata/config.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,15 +36,15 @@ class GoodDataConfigProduct(Base):
3636
id: str
3737
name: str
3838
environment_setup_id: str
39-
model_ids: list[str] = attr.field(default=list)
39+
model_ids: list[str] = attr.field(factory=list)
4040
localization: Optional[GoodDataConfigLocalization] = None
4141
skip_tests: Optional[list[str]] = None
4242

4343

4444
@attrs.define(auto_attribs=True, kw_only=True)
4545
class GoodDataConfigOrganization(Base):
4646
gooddata_profile: str
47-
data_product_ids: list[str] = attr.field(default=list)
47+
data_product_ids: list[str] = attr.field(factory=list)
4848

4949

5050
@attrs.define(auto_attribs=True, kw_only=True)

packages/gooddata-dbt/tests/test_tables.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,5 +46,6 @@ def test_make_ldm():
4646
declarative_datasets = tables.make_declarative_datasets(data_source_id, [MODEL_ID])
4747
ldm = CatalogDeclarativeModel.from_dict({"ldm": declarative_datasets}, camel_case=False)
4848

49+
assert ldm.ldm is not None
4950
assert len(ldm.ldm.datasets) == 4
5051
assert len(ldm.ldm.date_instances) == 4

packages/gooddata-fdw/src/gooddata_fdw/environment.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -67,18 +67,18 @@ class TableDefinitionStub:
6767
def __init__(
6868
self,
6969
table_name: str,
70-
columns: list[ColumnDefinition], # type: ignore
71-
options: dict[str, str], # type: ignore
70+
columns: list[ColumnDefinition],
71+
options: dict[str, str],
7272
) -> None:
7373
self.table_name = table_name
7474
self.columns = columns
7575
self.options = options
76-
self.col_idx = dict([(c.column_name, c) for c in columns]) # type: ignore
76+
self.col_idx = dict([(c.column_name, c) for c in columns])
7777

7878
TableDefinition = TableDefinitionStub
7979

8080
class ForeignDataWrapperStub:
81-
def __init__(self, options: dict[str, str], columns: dict[str, ColumnDefinition]) -> None: # type: ignore
81+
def __init__(self, options: dict[str, str], columns: dict[str, ColumnDefinition]) -> None:
8282
self.options = options
8383
self.columns = columns
8484

@@ -90,10 +90,10 @@ def import_schema(
9090
options: dict[str, str],
9191
restriction_type: Optional[str],
9292
restricts: list[str],
93-
) -> list[TableDefinition]: # type: ignore
93+
) -> list[TableDefinition]:
9494
return NotImplemented
9595

96-
def execute(self, quals: list[Qual], columns: list[str], sortkeys: Optional[list[Any]] = None): # type: ignore
96+
def execute(self, quals: list[Qual], columns: list[str], sortkeys: Optional[list[Any]] = None):
9797
pass
9898

9999
ForeignDataWrapper = ForeignDataWrapperStub

packages/gooddata-fdw/src/gooddata_fdw/fdw.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ def __init__(self, options: dict[str, str], columns: dict[str, ColumnDefinition]
3434
self._executor = ExecutorFactory.create(InitData(gd_sdk, self._server_options, self._table_options, columns))
3535
self._executor.validate_columns_def()
3636

37-
def execute(self, quals: list[Qual], columns: list[str], sortkeys: Optional[list[Any]] = None): # type: ignore
37+
def execute(self, quals: list[Qual], columns: list[str], sortkeys: Optional[list[Any]] = None):
3838
_log_debug(f"query in fdw with {self._server_options}; {self._table_options}; columns {columns}; quals={quals}")
3939
try:
4040
return self._executor.execute(quals, columns, sortkeys)
@@ -50,7 +50,7 @@ def import_schema(
5050
options: dict[str, str],
5151
restriction_type: Optional[str],
5252
restricts: list[str],
53-
) -> list[TableDefinition]: # type: ignore
53+
) -> list[TableDefinition]:
5454
_log_info(
5555
f"import fdw {schema} (srv_options={srv_options}, "
5656
f"options={options}, restriction_type={restriction_type}, restricts={restricts})"
@@ -76,14 +76,14 @@ def import_schema(
7676
raise e
7777

7878
@property
79-
def rowid_column(self): # type: ignore
79+
def rowid_column(self):
8080
return super().rowid_column
8181

82-
def insert(self, values): # type: ignore
82+
def insert(self, values):
8383
return super().insert(values)
8484

85-
def update(self, oldvalues, newvalues): # type: ignore
85+
def update(self, oldvalues, newvalues):
8686
return super().update(oldvalues, newvalues)
8787

88-
def delete(self, oldvalues): # type: ignore
88+
def delete(self, oldvalues):
8989
return super().delete(oldvalues)

packages/gooddata-fdw/src/gooddata_fdw/naming.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ class InsightColumnNamingStrategy:
6060
def col_name_for_attribute(self, attr: sdk.VisualizationAttribute) -> str:
6161
raise NotImplementedError()
6262

63-
def col_name_for_metric(self, attr: sdk.VisualizationMetric) -> str:
63+
def col_name_for_metric(self, metric: sdk.VisualizationMetric) -> str:
6464
raise NotImplementedError()
6565

6666

packages/gooddata-flexconnect/tests/function/test_flex_fun_execution_context.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ def test_report_execution_context_deser(sample_report_execution_context_dict):
2222
"""
2323
deserialized = ExecutionContext.from_dict(sample_report_execution_context_dict)
2424

25+
assert deserialized is not None
2526
assert deserialized.execution_type == ExecutionType.REPORT
2627
assert deserialized.organization_id == "default"
2728
assert deserialized.label_elements_execution_request is None
@@ -42,14 +43,17 @@ def test_label_elements_execution_context_deser(sample_label_execution_context_d
4243
"""
4344
deserialized = ExecutionContext.from_dict(sample_label_execution_context_dict)
4445

46+
assert deserialized is not None
4547
assert deserialized.execution_type == ExecutionType.LABEL_ELEMENTS
4648
assert deserialized.organization_id == "default"
4749
assert deserialized.report_execution_request is None
4850

4951
assert deserialized.label_elements_execution_request is not None
5052
assert isinstance(deserialized.label_elements_execution_request.filter_by, CatalogFilterBy)
5153
assert deserialized.label_elements_execution_request.filter_by.label_type == "REQUESTED"
54+
assert deserialized.label_elements_execution_request.depends_on is not None
5255
assert isinstance(deserialized.label_elements_execution_request.depends_on[0], CatalogDependsOn)
56+
assert deserialized.label_elements_execution_request.validate_by is not None
5357
assert isinstance(deserialized.label_elements_execution_request.validate_by[0], CatalogValidateByItem)
5458

5559
assert isinstance(deserialized.attributes[0], ExecutionContextAttribute)

packages/gooddata-flexconnect/tests/function/test_registry.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,11 @@ def fake_ctx():
1515
# need to ensure that the functions are registered correctly and that
1616
# their on_load() initializers are called
1717
return ServerContext(
18-
config=None,
18+
config=None, # type: ignore[arg-type]
1919
location=pyarrow.flight.Location.for_grpc_tcp("localhost", 6666),
20-
settings=None,
21-
task_executor=None,
22-
health=None,
20+
settings=None, # type: ignore[arg-type]
21+
task_executor=None, # type: ignore[arg-type]
22+
health=None, # type: ignore[arg-type]
2323
)
2424

2525

packages/gooddata-flexconnect/tests/function/testing_funs.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
# (C) 2024 GoodData Corporation
2+
from typing import Optional
23

34
import pyarrow
45
from gooddata_flexconnect.function.function import FlexConnectFunction
@@ -12,7 +13,7 @@ class Fun1(FlexConnectFunction):
1213
def call(
1314
self,
1415
parameters: dict,
15-
columns: tuple[str, ...],
16+
columns: Optional[tuple[str, ...]],
1617
headers: dict[str, list[str]],
1718
) -> ArrowData:
1819
pass
@@ -27,7 +28,7 @@ class Fun2(FlexConnectFunction):
2728
def call(
2829
self,
2930
parameters: dict,
30-
columns: tuple[str, ...],
31+
columns: Optional[tuple[str, ...]],
3132
headers: dict[str, list[str]],
3233
) -> ArrowData:
3334
pass

packages/gooddata-flexconnect/tests/json_schemas/conftest.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@
22
from pathlib import Path
33
from typing import Any
44

5+
import orjson
56
import pytest
67
from jsonschema.validators import Draft202012Validator
7-
from orjson import orjson
88
from referencing import Registry, Resource
99

1010
SCHEMAS = Path("json_schemas")

0 commit comments

Comments
 (0)