Skip to content

Commit 33220c1

Browse files
mchehabJonathan Corbet
authored andcommitted
docs: kdoc: python_version: Improve docstrings and comments
In preparation to document kernel-doc module, improve its documentation. Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org> Signed-off-by: Jonathan Corbet <corbet@lwn.net> Message-ID: <2153afaeb496e1bb8d3cc318fff26c3f99d99486.1768838938.git.mchehab+huawei@kernel.org>
1 parent 7ef684c commit 33220c1

1 file changed

Lines changed: 16 additions & 4 deletions

File tree

tools/lib/python/kdoc/python_version.py

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,21 +33,31 @@ class PythonVersion:
3333
"""
3434

3535
def __init__(self, version):
36-
"""Ïnitialize self.version tuple from a version string"""
36+
"""
37+
Ïnitialize self.version tuple from a version string.
38+
"""
3739
self.version = self.parse_version(version)
3840

3941
@staticmethod
4042
def parse_version(version):
41-
"""Convert a major.minor.patch version into a tuple"""
43+
"""
44+
Convert a major.minor.patch version into a tuple.
45+
"""
4246
return tuple(int(x) for x in version.split("."))
4347

4448
@staticmethod
4549
def ver_str(version):
46-
"""Returns a version tuple as major.minor.patch"""
50+
"""
51+
Returns a version tuple as major.minor.patch.
52+
"""
4753
return ".".join([str(x) for x in version])
4854

4955
@staticmethod
5056
def cmd_print(cmd, max_len=80):
57+
"""
58+
Outputs a command line, repecting maximum width.
59+
"""
60+
5161
cmd_line = []
5262

5363
for w in cmd:
@@ -66,7 +76,9 @@ def cmd_print(cmd, max_len=80):
6676
return "\n ".join(cmd_line)
6777

6878
def __str__(self):
69-
"""Returns a version tuple as major.minor.patch from self.version"""
79+
"""
80+
Return a version tuple as major.minor.patch from self.version.
81+
"""
7082
return self.ver_str(self.version)
7183

7284
@staticmethod

0 commit comments

Comments
 (0)