|
2 | 2 | # This file is dual licensed under the terms of the Apache License, Version |
3 | 3 | # 2.0, and the BSD License. See the LICENSE file in the root of this repository |
4 | 4 | # for complete details. |
5 | | -""" |
| 5 | +"""Backport of the ``packaging.version`` module from Python 3.8. |
| 6 | +
|
6 | 7 | .. testsetup:: |
7 | 8 |
|
8 | 9 | from packaging.version import parse, Version |
@@ -159,7 +160,7 @@ def __ne__(self, other: object) -> bool: |
159 | 160 |
|
160 | 161 |
|
161 | 162 | class Version(_BaseVersion): |
162 | | - """This class abstracts handling of a project's versions. |
| 163 | + """Class abstracts handling of a project's versions. |
163 | 164 |
|
164 | 165 | A :class:`Version` instance is comparison aware and can be compared and |
165 | 166 | sorted using the standard Python interfaces. |
@@ -194,7 +195,6 @@ def __init__(self, version: str) -> None: |
194 | 195 | If the ``version`` does not conform to PEP 440 in any way then this |
195 | 196 | exception will be raised. |
196 | 197 | """ |
197 | | - |
198 | 198 | # Validate the version and parse it into pieces |
199 | 199 | match = self._regex.search(version) |
200 | 200 | if not match: |
@@ -223,15 +223,15 @@ def __init__(self, version: str) -> None: |
223 | 223 | ) |
224 | 224 |
|
225 | 225 | def __repr__(self) -> str: |
226 | | - """A representation of the Version that shows all internal state. |
| 226 | + """Return representation of the Version that shows all internal state. |
227 | 227 |
|
228 | 228 | >>> Version('1.0.0') |
229 | 229 | <Version('1.0.0')> |
230 | 230 | """ |
231 | 231 | return f"<Version('{self}')>" |
232 | 232 |
|
233 | 233 | def __str__(self) -> str: |
234 | | - """A string representation of the version that can be rounded-tripped. |
| 234 | + """Return string representation of the version that can be rounded-tripped. |
235 | 235 |
|
236 | 236 | >>> str(Version("1.0a5")) |
237 | 237 | '1.0a5' |
@@ -492,9 +492,7 @@ def _parse_letter_version( |
492 | 492 |
|
493 | 493 |
|
494 | 494 | def _parse_local_version(local: str) -> Optional[LocalType]: |
495 | | - """ |
496 | | - Takes a string like abc.1.twelve and turns it into ("abc", 1, "twelve"). |
497 | | - """ |
| 495 | + """Take a string like abc.1.twelve and turns it into ("abc", 1, "twelve").""" |
498 | 496 | if local is not None: |
499 | 497 | return tuple( |
500 | 498 | part.lower() if not part.isdigit() else int(part) |
|
0 commit comments