File tree Expand file tree Collapse file tree 1 file changed +8
-6
lines changed
Expand file tree Collapse file tree 1 file changed +8
-6
lines changed Original file line number Diff line number Diff line change 33import os
44import re
55from collections import OrderedDict
6+ from collections .abc import Iterable
67from glob import iglob
78from logging import getLogger
89from string import Template
@@ -61,7 +62,7 @@ def find_increment(
6162def update_version_in_files (
6263current_version : str ,
6364new_version : str ,
64- files : list [str ],
65+ files : Iterable [str ],
6566* ,
6667check_consistency : bool = False ,
6768encoding : str = ENCODING ,
@@ -99,21 +100,22 @@ def update_version_in_files(
99100return updated
100101
101102
102- def _files_and_regexes (patterns : list [str ], version : str ) -> list [tuple [str , str ]]:
103+ def _files_and_regexes (patterns : Iterable [str ], version : str ) -> list [tuple [str , str ]]:
103104"""
104105 Resolve all distinct files with their regexp from a list of glob patterns with optional regexp
105106 """
106- out : list [tuple [str , str ]] = []
107+ out : set [tuple [str , str ]] = set ()
107108for pattern in patterns :
108109drive , tail = os .path .splitdrive (pattern )
109110path , _ , regex = tail .partition (":" )
110111filepath = drive + path
111112if not regex :
112113regex = re .escape (version )
113114
114- for path in iglob (filepath ):
115- out .append ((path , regex ))
116- return sorted (list (set (out )))
115+ for file in iglob (filepath ):
116+ out .add ((file , regex ))
117+
118+ return sorted (out )
117119
118120
119121def _bump_with_regex (
You can’t perform that action at this time.
0 commit comments