Skip to content

Commit 34f038d

Browse files
authored
Merge pull request #230 from tomschr/feature/minor-fix4docs
Add version information in some functions
2 parents 158f19f + 1e6a251 commit 34f038d

File tree

1 file changed

+28
-13
lines changed

1 file changed

+28
-13
lines changed

semver.py

Lines changed: 28 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -307,8 +307,12 @@ def parse(version):
307307
return parse_version_info(version)
308308

309309
def replace(self, **parts):
310-
"""Replace one or more parts of a version and return a new
311-
:class:`semver.VersionInfo` object, but leave self untouched
310+
"""
311+
Replace one or more parts of a version and return a new
312+
:class:`semver.VersionInfo` object, but leave self untouched
313+
314+
.. versionadded:: 2.9.0
315+
Added :func:`VersionInfo.replace`
312316
313317
:param dict parts: the parts to be updated. Valid keys are:
314318
``major``, ``minor``, ``patch``, ``prerelease``, or ``build``
@@ -333,6 +337,8 @@ def isvalid(cls, version):
333337
"""
334338
Check if the string is a valid semver version.
335339
340+
.. versionadded:: 2.9.1
341+
336342
:param str version: the version string to check
337343
:return: True if the version string is a valid semver version, False
338344
otherwise.
@@ -357,6 +363,9 @@ def parse_version_info(version):
357363
"""
358364
Parse version string to a VersionInfo instance.
359365
366+
.. versionadded:: 2.7.2
367+
Added :func:`parse_version_info`
368+
360369
:param version: version string
361370
:return: a :class:`VersionInfo` instance
362371
:rtype: :class:`VersionInfo`
@@ -433,7 +442,7 @@ def _compare_by_keys(d1, d2):
433442

434443
def compare(ver1, ver2):
435444
"""
436-
Compare two versions.
445+
Compare two versions strings.
437446
438447
:param ver1: version string 1
439448
:param ver2: version string 2
@@ -456,7 +465,7 @@ def compare(ver1, ver2):
456465

457466
def match(version, match_expr):
458467
"""
459-
Compare two versions through a comparison.
468+
Compare two versions strings through a comparison.
460469
461470
:param str version: a version string
462471
:param str match_expr: operator and version; valid operators are
@@ -505,7 +514,7 @@ def match(version, match_expr):
505514

506515
def max_ver(ver1, ver2):
507516
"""
508-
Returns the greater version of two versions.
517+
Returns the greater version of two versions strings.
509518
510519
:param ver1: version string 1
511520
:param ver2: version string 2
@@ -524,7 +533,7 @@ def max_ver(ver1, ver2):
524533

525534
def min_ver(ver1, ver2):
526535
"""
527-
Returns the smaller version of two versions.
536+
Returns the smaller version of two versions strings.
528537
529538
:param ver1: version string 1
530539
:param ver2: version string 2
@@ -543,7 +552,7 @@ def min_ver(ver1, ver2):
543552

544553
def format_version(major, minor, patch, prerelease=None, build=None):
545554
"""
546-
Format a version according to the Semantic Versioning specification.
555+
Format a version string according to the Semantic Versioning specification.
547556
548557
:param int major: the required major part of a version
549558
:param int minor: the required minor part of a version
@@ -582,7 +591,7 @@ def _increment_string(string):
582591

583592
def bump_major(version):
584593
"""
585-
Raise the major part of the version.
594+
Raise the major part of the version string.
586595
587596
:param: version string
588597
:return: the raised version string
@@ -597,7 +606,7 @@ def bump_major(version):
597606

598607
def bump_minor(version):
599608
"""
600-
Raise the minor part of the version.
609+
Raise the minor part of the version string.
601610
602611
:param: version string
603612
:return: the raised version string
@@ -612,7 +621,7 @@ def bump_minor(version):
612621

613622
def bump_patch(version):
614623
"""
615-
Raise the patch part of the version.
624+
Raise the patch part of the version string.
616625
617626
:param: version string
618627
:return: the raised version string
@@ -627,7 +636,7 @@ def bump_patch(version):
627636

628637
def bump_prerelease(version, token="rc"):
629638
"""
630-
Raise the prerelease part of the version.
639+
Raise the prerelease part of the version string.
631640
632641
:param version: version string
633642
:param token: defaults to 'rc'
@@ -648,7 +657,7 @@ def bump_prerelease(version, token="rc"):
648657

649658
def bump_build(version, token="build"):
650659
"""
651-
Raise the build part of the version.
660+
Raise the build part of the version string.
652661
653662
:param version: version string
654663
:param token: defaults to 'build'
@@ -671,7 +680,10 @@ def bump_build(version, token="build"):
671680

672681
def finalize_version(version):
673682
"""
674-
Remove any prerelease and build metadata from the version.
683+
Remove any prerelease and build metadata from the version string.
684+
685+
.. versionadded:: 2.7.9
686+
Added :func:`finalize_version`
675687
676688
:param version: version string
677689
:return: the finalized version string
@@ -830,6 +842,9 @@ def replace(version, **parts):
830842
"""
831843
Replace one or more parts of a version and return the new string.
832844
845+
.. versionadded:: 2.9.0
846+
Added :func:`replace`
847+
833848
:param str version: the version string to replace
834849
:param dict parts: the parts to be updated. Valid keys are:
835850
``major``, ``minor``, ``patch``, ``prerelease``, or ``build``

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