|
2 | 2 |
|
3 | 3 | import re |
4 | 4 | import warnings |
5 | | -from collections.abc import Sequence |
| 5 | +from collections.abc import Iterable, Sequence |
6 | 6 | from dataclasses import dataclass, field |
7 | 7 | from functools import cached_property |
8 | 8 | from string import Template |
@@ -89,14 +89,14 @@ class TagRules: |
89 | 89 | merge_prereleases: bool = False |
90 | 90 |
|
91 | 91 | @cached_property |
92 | | - def version_regexes(self) -> Sequence[re.Pattern]: |
| 92 | + def version_regexes(self) -> list[re.Pattern]: |
93 | 93 | """Regexes for all legit tag formats, current and legacy""" |
94 | 94 | tag_formats = [self.tag_format, *self.legacy_tag_formats] |
95 | 95 | regexes = (self._format_regex(p) for p in tag_formats) |
96 | 96 | return [re.compile(r) for r in regexes] |
97 | 97 |
|
98 | 98 | @cached_property |
99 | | - def ignored_regexes(self) -> Sequence[re.Pattern]: |
| 99 | + def ignored_regexes(self) -> list[re.Pattern]: |
100 | 100 | """Regexes for known but ignored tag formats""" |
101 | 101 | regexes = (self._format_regex(p, star=True) for p in self.ignored_tag_formats) |
102 | 102 | return [re.compile(r) for r in regexes] |
@@ -135,8 +135,8 @@ def is_ignored_tag(self, tag: str | GitTag) -> bool: |
135 | 135 | return any(regex.match(tag) for regex in self.ignored_regexes) |
136 | 136 |
|
137 | 137 | 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]: |
140 | 140 | """Filter in version tags and warn on unexpected tags""" |
141 | 141 | return [tag for tag in tags if self.is_version_tag(tag, warn)] |
142 | 142 |
|
@@ -236,7 +236,7 @@ def normalize_tag( |
236 | 236 | ) |
237 | 237 |
|
238 | 238 | def find_tag_for( |
239 | | - self, tags: Sequence[GitTag], version: Version | str |
| 239 | + self, tags: Iterable[GitTag], version: Version | str |
240 | 240 | ) -> GitTag | None: |
241 | 241 | """Find the first matching tag for a given version.""" |
242 | 242 | version = self.scheme(version) if isinstance(version, str) else version |
|
0 commit comments