File tree Expand file tree Collapse file tree 3 files changed +7
-6
lines changed Expand file tree Collapse file tree 3 files changed +7
-6
lines changed Original file line number Diff line number Diff line change @@ -56,11 +56,12 @@ Reference
56
56
>>> is_normalized_name(" Django" )
57
57
False
58
58
59
- .. function :: canonicalize_version(version)
59
+ .. function :: canonicalize_version(version, strip_trailing_zero=True )
60
60
61
61
This function takes a string representing a package version (or a
62
62
:class: `~packaging.version.Version ` instance), and returns the
63
- normalized form of it.
63
+ normalized form of it. By default, it strips trailing zeros from
64
+ the release segment.
64
65
65
66
:param str version: The version to normalize.
66
67
Original file line number Diff line number Diff line change @@ -167,7 +167,7 @@ class RawMetadata(TypedDict, total=False):
167
167
168
168
169
169
def _parse_keywords (data : str ) -> list [str ]:
170
- """Split a string of comma-separate keyboards into a list of keywords."""
170
+ """Split a string of comma-separated keywords into a list of keywords."""
171
171
return [k .strip () for k in data .split ("," )]
172
172
173
173
Original file line number Diff line number Diff line change @@ -350,8 +350,8 @@ def public(self) -> str:
350
350
'1.2.3'
351
351
>>> Version("1.2.3+abc").public
352
352
'1.2.3'
353
- >>> Version("1.2.3 +abc.dev1 ").public
354
- '1.2.3'
353
+ >>> Version("1!1 .2.3dev1 +abc").public
354
+ '1!1 .2.3.dev1 '
355
355
"""
356
356
return str (self ).split ("+" , 1 )[0 ]
357
357
@@ -363,7 +363,7 @@ def base_version(self) -> str:
363
363
'1.2.3'
364
364
>>> Version("1.2.3+abc").base_version
365
365
'1.2.3'
366
- >>> Version("1!1.2.3 +abc.dev1 ").base_version
366
+ >>> Version("1!1.2.3dev1 +abc").base_version
367
367
'1!1.2.3'
368
368
369
369
The "base version" is the public version of the project without any pre or post
You can’t perform that action at this time.
0 commit comments