|
8 | 8 | import logging
|
9 | 9 | import re
|
10 | 10 | from functools import reduce
|
| 11 | +from itertools import zip_longest |
11 | 12 | from re import compile as regexp
|
12 | 13 | from typing import TYPE_CHECKING, Tuple
|
13 | 14 |
|
@@ -71,11 +72,16 @@ class AngularParserOptions(ParserOptions):
|
71 | 72 | default_bump_level: LevelBump = LevelBump.NO_RELEASE
|
72 | 73 |
|
73 | 74 | def __post_init__(self) -> None:
|
74 |
| - self.tag_to_level = {tag: self.default_bump_level for tag in self.allowed_tags} |
75 |
| - for tag in self.patch_tags: |
76 |
| - self.tag_to_level[tag] = LevelBump.PATCH |
77 |
| - for tag in self.minor_tags: |
78 |
| - self.tag_to_level[tag] = LevelBump.MINOR |
| 75 | + self.tag_to_level: dict[str, LevelBump] = dict( |
| 76 | + [ |
| 77 | + # we have to do a type ignore as zip_longest provides a type that is not specific enough |
| 78 | + # for our expected output. Due to the empty second array, we know the first is always longest |
| 79 | + # and that means no values in the first entry of the tuples will ever be a LevelBump. |
| 80 | + *zip_longest(self.allowed_tags, (), fillvalue=self.default_bump_level), # type: ignore[list-item] |
| 81 | + *zip_longest(self.patch_tags, (), fillvalue=LevelBump.PATCH), # type: ignore[list-item] |
| 82 | + *zip_longest(self.minor_tags, (), fillvalue=LevelBump.MINOR), # type: ignore[list-item] |
| 83 | + ] |
| 84 | + ) |
79 | 85 |
|
80 | 86 |
|
81 | 87 | class AngularCommitParser(CommitParser[ParseResult, AngularParserOptions]):
|
|
0 commit comments