@@ -30,12 +30,12 @@ def _parse_version_tag(tag, config):
3030 if len (match .groups ()) == 1 :
3131 key = 1
3232 else :
33- key = ' version'
34-
33+ key = " version"
34+
3535 result = {
36- ' version' : match .group (key ),
37- ' prefix' : match .group (0 )[:match .start (key )],
38- ' suffix' : match .group (0 )[match .end (key ):],
36+ " version" : match .group (key ),
37+ " prefix" : match .group (0 )[:match .start (key )],
38+ " suffix" : match .group (0 )[match .end (key ):],
3939 }
4040
4141 trace ("tag '%s' parsed to %s" % (tag , result ))
@@ -88,20 +88,21 @@ def tag_to_version(tag, config=None):
8888 config = Configuration ()
8989
9090 tagdict = _parse_version_tag (tag , config )
91- if not isinstance (tagdict , dict ) or not tagdict .get (' version' , None ):
91+ if not isinstance (tagdict , dict ) or not tagdict .get (" version" , None ):
9292 warnings .warn ("tag %r no version found" % (tag ,))
9393 return None
9494
95- version = tagdict [' version' ]
95+ version = tagdict [" version" ]
9696 trace ("version pre parse" , version )
9797
98- if tagdict .get ('suffix' , '' ):
99- warnings .warn ("tag %r will be stripped of its suffix '%s'" % (tag , tagdict ['suffix' ]))
98+ if tagdict .get ("suffix" , "" ):
99+ warnings .warn (
100+ "tag %r will be stripped of its suffix '%s'" % (tag , tagdict ["suffix" ])
101+ )
100102
101103 if VERSION_CLASS is not None :
102104 version = pkg_parse_version (version )
103105 trace ("version" , repr (version ))
104-
105106 return version
106107
107108
@@ -111,7 +112,12 @@ def tags_to_versions(tags, config=None):
111112 :param tags: an iterable of tags
112113 :param config: optional configuration object
113114 """
114- return filter (None , map (lambda tag : tag_to_version (tag , config = config ), tags ))
115+ result = []
116+ for tag in tags :
117+ tag = tag_to_version (tag , config = config )
118+ if tag :
119+ result .append (tag )
120+ return result
115121
116122
117123class ScmVersion (object ):
@@ -176,9 +182,14 @@ def _parse_tag(tag, preformatted, config):
176182 return tag
177183
178184
179- def meta (tag , distance = None , dirty = False , node = None , preformatted = False , config = None , ** kw ):
185+ def meta (
186+ tag , distance = None , dirty = False , node = None , preformatted = False , config = None , ** kw
187+ ):
180188 if not config :
181- warnings .warn ("meta invoked without explicit configuration, will use defaults where required." )
189+ warnings .warn (
190+ "meta invoked without explicit configuration,"
191+ " will use defaults where required."
192+ )
182193 parsed_version = _parse_tag (tag , preformatted , config )
183194 trace ("version" , tag , "->" , parsed_version )
184195 assert parsed_version is not None , "cant parse version %s" % tag
0 commit comments