Skip to content

Commit f4d0921

Browse files
committed
Rename VersionInfo to Version
1 parent 81a8509 commit f4d0921

16 files changed

+268
-247
lines changed

changelog.d/305.feature.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Rename :class:`VersionInfo` to :class:`Version` but keep an alias for compatibility

docs/coerce.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,18 +17,18 @@
1717

1818
def coerce(version):
1919
"""
20-
Convert an incomplete version string into a semver-compatible VersionInfo
20+
Convert an incomplete version string into a semver-compatible Version
2121
object
2222
2323
* Tries to detect a "basic" version string (``major.minor.patch``).
2424
* If not enough components can be found, missing components are
2525
set to zero to obtain a valid semver version.
2626
2727
:param str version: the version string to convert
28-
:return: a tuple with a :class:`VersionInfo` instance (or ``None``
28+
:return: a tuple with a :class:`Version` instance (or ``None``
2929
if it's not a version) and the rest of the string which doesn't
3030
belong to a basic version.
31-
:rtype: tuple(:class:`VersionInfo` | None, str)
31+
:rtype: tuple(:class:`Version` | None, str)
3232
"""
3333
match = BASEVERSION.search(version)
3434
if not match:
@@ -37,6 +37,6 @@ def coerce(version):
3737
ver = {
3838
key: 0 if value is None else value for key, value in match.groupdict().items()
3939
}
40-
ver = semver.VersionInfo(**ver)
40+
ver = semver.Version(**ver)
4141
rest = match.string[match.end() :] # noqa:E203
4242
return ver, rest

docs/semverwithvprefix.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
1-
from semver import VersionInfo
1+
from semver import Version
22

33

4-
class SemVerWithVPrefix(VersionInfo):
4+
class SemVerWithVPrefix(Version):
55
"""
6-
A subclass of VersionInfo which allows a "v" prefix
6+
A subclass of Version which allows a "v" prefix
77
"""
88

99
@classmethod
1010
def parse(cls, version):
1111
"""
12-
Parse version string to a VersionInfo instance.
12+
Parse version string to a Version instance.
1313
1414
:param version: version string with "v" or "V" prefix
1515
:type version: str

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy