Skip to content

Commit 2354ec1

Browse files
Merge pull request #1637 from gooddata/snapshot-master-a21f8547-to-rel/dev
[bot] Merge master/a21f8547 into rel/dev
2 parents 720b2a2 + a21f854 commit 2354ec1

6 files changed

Lines changed: 61 additions & 61 deletions

File tree

‎packages/gooddata-pandas/src/gooddata_pandas/series.py‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
from __future__ import annotations
33

44
import warnings
5-
from typing import Callable, Union
5+
from typing import Callable, Union, cast
66

77
import pandas
88
from gooddata_sdk import Attribute, Execution, Filter, GoodDataSdk, ObjId, SimpleMetric
@@ -156,7 +156,8 @@ def not_indexed(
156156
stacklevel=2,
157157
)
158158
if isinstance(granularity, list):
159-
_index: IndexDef | None = {str(idx): label for idx, label in enumerate(granularity)}
159+
granularity_items = cast("list[LabelItemDef]", granularity)
160+
_index: IndexDef | None = {str(idx): label for idx, label in enumerate(granularity_items)}
160161
else:
161162
_index = granularity
162163

‎packages/gooddata-pipelines/src/gooddata_pipelines/logger/logger.py‎

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,17 +9,18 @@
99
"""
1010

1111
from enum import Enum
12-
from typing import Any, Protocol
12+
from typing import Any, Protocol, TypeVar
13+
14+
_T = TypeVar("_T")
1315

1416

1517
class SingletonMeta(type):
16-
_instances: dict = {}
18+
_instances: dict[type, Any] = {}
1719

18-
def __call__(cls, *args: Any, **kwargs: Any) -> "SingletonMeta":
19-
if cls not in cls._instances:
20-
instance = super().__call__(*args, **kwargs)
21-
cls._instances[cls] = instance
22-
return cls._instances[cls]
20+
def __call__(cls: type[_T], *args: Any, **kwargs: Any) -> _T:
21+
if cls not in SingletonMeta._instances:
22+
SingletonMeta._instances[cls] = type.__call__(cls, *args, **kwargs)
23+
return SingletonMeta._instances[cls]
2324

2425

2526
class Severity(Enum):

‎packages/gooddata-sdk/src/gooddata_sdk/catalog/workspace/entity_model/content_objects/dataset.py‎

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -90,10 +90,7 @@ def primary_label(self) -> Union[CatalogLabel, None]:
9090

9191
def find_label(self, id_obj: IdObjType) -> Union[CatalogLabel, None]:
9292
obj_key = id_obj_to_key(id_obj)
93-
# use cast as mypy is not applying next, it claims, type is filter[CatalogLabel]
94-
return cast(
95-
Union[CatalogLabel, None], next(filter(lambda x: id_obj_to_key(x.obj_id) == obj_key, self.labels), None)
96-
)
93+
return next(filter(lambda x: id_obj_to_key(x.obj_id) == obj_key, self.labels), None)
9794

9895
# TODO add missing properties
9996

‎packages/gooddata-sdk/src/gooddata_sdk/compute/model/filter.py‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -326,7 +326,7 @@ def __init__(
326326
self._from_shift = from_shift
327327
self._to_shift = to_shift
328328
self._bounded_filter = bounded_filter
329-
self._empty_value_handling = empty_value_handling
329+
self._empty_value_handling: EmptyValueHandling | None = empty_value_handling
330330

331331
@property
332332
def dataset(self) -> ObjId:
@@ -435,7 +435,7 @@ def __init__(
435435

436436
self._dataset = dataset
437437
self._granularity = granularity
438-
self._empty_value_handling = empty_value_handling
438+
self._empty_value_handling: EmptyValueHandling | None = empty_value_handling
439439

440440
@property
441441
def dataset(self) -> ObjId:
@@ -490,7 +490,7 @@ def __init__(
490490
self._dataset = dataset
491491
self._from_date = from_date
492492
self._to_date = to_date
493-
self._empty_value_handling = empty_value_handling
493+
self._empty_value_handling: EmptyValueHandling | None = empty_value_handling
494494

495495
@property
496496
def dataset(self) -> ObjId:

‎pyproject.toml‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,10 +40,10 @@ dev = [
4040
"gitlint~=0.19.1",
4141
]
4242
lint = [
43-
"ruff~=0.15.1",
43+
"ruff~=0.15.15",
4444
]
4545
type = [
46-
"ty~=0.0.14",
46+
"ty~=0.0.40",
4747
]
4848
test = [
4949
# Common test dependencies used across all workspace packages

0 commit comments

Comments
 (0)