Skip to content

Commit c3e0167

Browse files
committed
Fix types
1 parent 9e18f8b commit c3e0167

3 files changed

Lines changed: 7 additions & 11 deletions

File tree

gha_utils/matrix.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ class Matrix:
4848
"""
4949

5050
def __init__(self, *args, **kwargs):
51-
self.variations: dict = {}
51+
self.variations: dict[str, tuple[str, ...]] = {}
5252

5353
# Tuples are used to keep track of the insertion order and force immutability.
5454
self.include: tuple[dict[str, str], ...] = tuple()
@@ -66,9 +66,9 @@ def matrix(
6666
"""
6767
dict_copy = self.variations.copy()
6868
if not ignore_includes and self.include:
69-
dict_copy["include"] = self.include
69+
dict_copy["include"] = self.include # type: ignore[assignment]
7070
if not ignore_excludes and self.exclude:
71-
dict_copy["exclude"] = self.exclude
71+
dict_copy["exclude"] = self.exclude # type: ignore[assignment]
7272
return FrozenDict(dict_copy)
7373

7474
def __repr__(self) -> str:

gha_utils/metadata.py

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -352,7 +352,7 @@ class TargetVersion(StrEnum):
352352
class JSONMetadata(json.JSONEncoder):
353353
"""Custom JSON encoder for metadata serialization."""
354354

355-
def default(self, o: Any) -> str:
355+
def default(self, o: Any) -> Any:
356356
if isinstance(o, Matrix):
357357
return o.matrix()
358358

@@ -661,11 +661,7 @@ def new_commits_matrix(self) -> Matrix | None:
661661
@cached_property
662662
def new_commits_hash(self) -> tuple[str, ...] | None:
663663
"""List all hashes of new commits."""
664-
return (
665-
cast(tuple[str, ...], self.new_commits_matrix["commit"])
666-
if self.new_commits_matrix
667-
else None
668-
)
664+
return self.new_commits_matrix["commit"] if self.new_commits_matrix else None
669665

670666
@cached_property
671667
def release_commits(self) -> tuple[Commit, ...] | None:
@@ -699,7 +695,7 @@ def release_commits_matrix(self) -> Matrix | None:
699695
def release_commits_hash(self) -> tuple[str, ...] | None:
700696
"""List all hashes of release commits."""
701697
return (
702-
cast(tuple[str, ...], self.release_commits_matrix["commit"])
698+
self.release_commits_matrix["commit"]
703699
if self.release_commits_matrix
704700
else None
705701
)

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ pretty = true
120120

121121
[[tool.mypy.overrides]]
122122
ignore_missing_imports = true
123-
module = ["boltons.*"]
123+
module = ["boltons.*", "gitignore_parser.*"]
124124

125125
[tool.pytest.ini_options]
126126
# https://docs.pytest.org/en/latest/customize.html#pyproject-toml

0 commit comments

Comments
 (0)