@@ -31,15 +31,17 @@ def find_increment(
3131
3232 for commit in commits :
3333 for message in commit .message .split ("\n " ):
34- result = select_pattern .search (message )
35-
36- if result :
34+ if result := select_pattern .search (message ):
3735 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+ )
4345
4446 if new_increment is None :
4547 logger .debug (
@@ -76,7 +78,7 @@ def update_version_in_files(
7678 """
7779 # TODO: separate check step and write step
7880 updated = []
79- for path , regex in files_and_regexs (files , current_version ):
81+ for path , regex in _files_and_regexes (files , current_version ):
8082 current_version_found , version_file = _bump_with_regex (
8183 path ,
8284 current_version ,
@@ -99,7 +101,7 @@ def update_version_in_files(
99101 return updated
100102
101103
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 ]]:
103105 """
104106 Resolve all distinct files with their regexp from a list of glob patterns with optional regexp
105107 """
0 commit comments