Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Improve usage section #314

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Nov 4, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
53 changes: 53 additions & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,59 @@ in our repository.

.. towncrier release notes start

Version 3.0.0-dev.2
===================

:Released: 2020-11-04
:Maintainer:


Improved Documentation
----------------------

* :gh:`312`: Rework "Usage" section.

* Mention the rename of :class:`~semver.version.VersionInfo` to
:class:`~semver.version.Version` class
* Remove semver. prefix in doctests to make examples shorter
* Correct some references to dunder methods like
:func:`~.semver.version.Version.__getitem__`,
:func:`~.semver.version.Version.__gt__` etc.
* Remove inconsistencies and mention module level function as
deprecated and discouraged from using
* Make empty :py:func:`super` call in :file:`semverwithvprefix.py` example



----


Version 3.0.0-dev.2
===================

:Released: 2020-11-04
:Maintainer:


Improved Documentation
----------------------

* :gh:`312`: Rework "Usage" section.

* Mention the rename of :class:`~semver.version.VersionInfo` to
:class:`~semver.version.Version` class
* Remove semver. prefix in doctests to make examples shorter
* Correct some references to dunder methods like :func:`__getitem__`,
:func:`__gt__` etc.
* Remove inconsistencies and mention module level function as
deprecated and discouraged from using
* Make empty :py:func:`super` call in :file:`semverwithvprefix.py` example



----


Version 3.0.0-dev.2
===================

Expand Down
1 change: 0 additions & 1 deletion changelog.d/213.improvement.rst

This file was deleted.

11 changes: 11 additions & 0 deletions changelog.d/312.doc.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
Rework "Usage" section.

* Mention the rename of :class:`~semver.version.VersionInfo` to
:class:`~semver.version.Version` class
* Remove semver. prefix in doctests to make examples shorter
* Correct some references to dunder methods like
:func:`~.semver.version.Version.__getitem__`,
:func:`~.semver.version.Version.__gt__` etc.
* Remove inconsistencies and mention module level function as
deprecated and discouraged from using
* Make empty :py:func:`super` call in :file:`semverwithvprefix.py` example
11 changes: 4 additions & 7 deletions docs/semverwithvprefix.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,25 +7,22 @@ class SemVerWithVPrefix(Version):
"""

@classmethod
def parse(cls, version):
def parse(cls, version: str) -> "SemVerWithVPrefix":
"""
Parse version string to a Version instance.

:param version: version string with "v" or "V" prefix
:type version: str
:raises ValueError: when version does not start with "v" or "V"
:return: a new instance
:rtype: :class:`SemVerWithVPrefix`
"""
if not version[0] in ("v", "V"):
raise ValueError(
"{v!r}: not a valid semantic version tag. Must start with 'v' or 'V'".format(
v=version
)
)
self = super(SemVerWithVPrefix, cls).parse(version[1:])
return self
return super().parse(version[1:])

def __str__(self):
def __str__(self) -> str:
# Reconstruct the tag
return "v" + super(SemVerWithVPrefix, self).__str__()
return "v" + super().__str__()
Loading