@@ -31,15 +31,17 @@ def find_increment(
31
31
32
32
for commit in commits :
33
33
for message in commit .message .split ("\n " ):
34
- result = select_pattern .search (message )
35
-
36
- if result :
34
+ if result := select_pattern .search (message ):
37
35
found_keyword = result .group (1 )
38
- new_increment = None
39
- for match_pattern in increments_map .keys ():
40
- if re .match (match_pattern , found_keyword ):
41
- new_increment = increments_map [match_pattern ]
42
- break
36
+
37
+ new_increment = next (
38
+ (
39
+ increment_type
40
+ for match_pattern , increment_type in increments_map .items ()
41
+ if re .match (match_pattern , found_keyword )
42
+ ),
43
+ None ,
44
+ )
43
45
44
46
if new_increment is None :
45
47
logger .debug (
@@ -76,7 +78,7 @@ def update_version_in_files(
76
78
"""
77
79
# TODO: separate check step and write step
78
80
updated = []
79
- for path , regex in files_and_regexs (files , current_version ):
81
+ for path , regex in _files_and_regexes (files , current_version ):
80
82
current_version_found , version_file = _bump_with_regex (
81
83
path ,
82
84
current_version ,
@@ -99,7 +101,7 @@ def update_version_in_files(
99
101
return updated
100
102
101
103
102
- def files_and_regexs (patterns : list [str ], version : str ) -> list [tuple [str , str ]]:
104
+ def _files_and_regexes (patterns : list [str ], version : str ) -> list [tuple [str , str ]]:
103
105
"""
104
106
Resolve all distinct files with their regexp from a list of glob patterns with optional regexp
105
107
"""
0 commit comments