2
2
from collections import OrderedDict
3
3
from itertools import zip_longest
4
4
from string import Template
5
- from typing import List , Optional , Union
5
+ from typing import List , Optional , Tuple , Union
6
6
7
7
from packaging .version import Version
8
8
@@ -167,7 +167,9 @@ def update_version_in_files(
167
167
file .write ("" .join (version_file ))
168
168
169
169
170
- def _bump_with_regex (version_file_contents , current_version , new_version , regex ):
170
+ def _bump_with_regex (
171
+ version_file_contents : str , current_version : str , new_version : str , regex : str
172
+ ) -> Tuple [bool , str ]:
171
173
current_version_found = False
172
174
# Bumping versions that change the string length move the offset on the file contents as finditer keeps a
173
175
# reference to the initial string that was used and calling search many times would lead in infinite loops
@@ -190,7 +192,7 @@ def _bump_with_regex(version_file_contents, current_version, new_version, regex)
190
192
return current_version_found , version_file_contents
191
193
192
194
193
- def _version_to_regex (version : str ):
195
+ def _version_to_regex (version : str ) -> re . Pattern :
194
196
clean_regex = version .replace ("." , r"\." ).replace ("+" , r"\+" )
195
197
return re .compile (f"{ clean_regex } " )
196
198
0 commit comments