Add some docstrings to the ArchPkgVersion class

This commit is contained in:
Stephen Seo 2023-02-04 17:04:56 +09:00
parent 913a3c2f5c
commit c811080e57

View file

@ -27,6 +27,8 @@ IS_DIGIT_REGEX = re.compile("^[0-9]+$")
class ArchPkgVersion: class ArchPkgVersion:
"""Holds a version (typically of an ArchLinux package) for comparison."""
def __init__(self, version_str): def __init__(self, version_str):
self.versions = [] self.versions = []
self.pkgver = 0 self.pkgver = 0
@ -72,6 +74,8 @@ class ArchPkgVersion:
self.versions = tuple(self.versions) self.versions = tuple(self.versions)
def compare_with(self, other_self): def compare_with(self, other_self):
"""Returns -1 if self is less than other_self, 0 if they are equal, and
1 if self is greater than other_self."""
self_count = len(self.versions) self_count = len(self.versions)
other_count = len(other_self.versions) other_count = len(other_self.versions)
if other_count < self_count: if other_count < self_count: