Skip to content

Commit 5013472

Browse files
committed
style(tags): improve types
1 parent a3919c9 commit 5013472

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

commitizen/tags.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
import re
44
import warnings
5-
from collections.abc import Sequence
5+
from collections.abc import Iterable, Sequence
66
from dataclasses import dataclass, field
77
from functools import cached_property
88
from string import Template
@@ -89,14 +89,14 @@ class TagRules:
8989
merge_prereleases: bool = False
9090

9191
@cached_property
92-
def version_regexes(self) -> Sequence[re.Pattern]:
92+
def version_regexes(self) -> list[re.Pattern]:
9393
"""Regexes for all legit tag formats, current and legacy"""
9494
tag_formats = [self.tag_format, *self.legacy_tag_formats]
9595
regexes = (self._format_regex(p) for p in tag_formats)
9696
return [re.compile(r) for r in regexes]
9797

9898
@cached_property
99-
def ignored_regexes(self) -> Sequence[re.Pattern]:
99+
def ignored_regexes(self) -> list[re.Pattern]:
100100
"""Regexes for known but ignored tag formats"""
101101
regexes = (self._format_regex(p, star=True) for p in self.ignored_tag_formats)
102102
return [re.compile(r) for r in regexes]
@@ -135,8 +135,8 @@ def is_ignored_tag(self, tag: str | GitTag) -> bool:
135135
return any(regex.match(tag) for regex in self.ignored_regexes)
136136

137137
def get_version_tags(
138-
self, tags: Sequence[GitTag], warn: bool = False
139-
) -> Sequence[GitTag]:
138+
self, tags: Iterable[GitTag], warn: bool = False
139+
) -> list[GitTag]:
140140
"""Filter in version tags and warn on unexpected tags"""
141141
return [tag for tag in tags if self.is_version_tag(tag, warn)]
142142

@@ -236,7 +236,7 @@ def normalize_tag(
236236
)
237237

238238
def find_tag_for(
239-
self, tags: Sequence[GitTag], version: Version | str
239+
self, tags: Iterable[GitTag], version: Version | str
240240
) -> GitTag | None:
241241
"""Find the first matching tag for a given version."""
242242
version = self.scheme(version) if isinstance(version, str) else version

0 commit comments

Comments
 (0)