Skip to content

Commit 539d723

Browse files
committed
Fix #312: Rework Usage section
* Correct :class: directive and use :class:`~semver.version.Version` * Mention the rename of VersionInfo -> Version class * Remove semver. prefix in doctests to make examples shorter * Correct some references to dunder methods like __getitem__, __gt__ etc. * Use :py:exec: reference to Python exceptions. * Remove inconsistencies and mention module level function as deprecated and discouraged from using * Make empty super() call in semverwithvprefix.py example * Add changelog.d file
1 parent ff204d7 commit 539d723

File tree

3 files changed

+115
-142
lines changed

3 files changed

+115
-142
lines changed

changelog.d/312.doc.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Correct Usage section.

docs/semverwithvprefix.py

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,25 +7,22 @@ class SemVerWithVPrefix(Version):
77
"""
88

99
@classmethod
10-
def parse(cls, version):
10+
def parse(cls, version: str) -> "SemVerWithVPrefix":
1111
"""
1212
Parse version string to a Version instance.
1313
1414
:param version: version string with "v" or "V" prefix
15-
:type version: str
1615
:raises ValueError: when version does not start with "v" or "V"
1716
:return: a new instance
18-
:rtype: :class:`SemVerWithVPrefix`
1917
"""
2018
if not version[0] in ("v", "V"):
2119
raise ValueError(
2220
"{v!r}: not a valid semantic version tag. Must start with 'v' or 'V'".format(
2321
v=version
2422
)
2523
)
26-
self = super(SemVerWithVPrefix, cls).parse(version[1:])
27-
return self
24+
return super().parse(version[1:])
2825

29-
def __str__(self):
26+
def __str__(self) -> str:
3027
# Reconstruct the tag
31-
return "v" + super(SemVerWithVPrefix, self).__str__()
28+
return "v" + super().__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