mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/herbert/cryptodev-2.6.git
synced 2026-04-19 03:53:51 -04:00
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>
This commit is contained in:
committed by
Jonathan Corbet
parent
7ef684c9fd
commit
33220c1fc1
@@ -33,21 +33,31 @@ class PythonVersion:
|
||||
"""
|
||||
|
||||
def __init__(self, version):
|
||||
"""Ïnitialize self.version tuple from a version string"""
|
||||
"""
|
||||
Ïnitialize self.version tuple from a version string.
|
||||
"""
|
||||
self.version = self.parse_version(version)
|
||||
|
||||
@staticmethod
|
||||
def parse_version(version):
|
||||
"""Convert a major.minor.patch version into a tuple"""
|
||||
"""
|
||||
Convert a major.minor.patch version into a tuple.
|
||||
"""
|
||||
return tuple(int(x) for x in version.split("."))
|
||||
|
||||
@staticmethod
|
||||
def ver_str(version):
|
||||
"""Returns a version tuple as major.minor.patch"""
|
||||
"""
|
||||
Returns a version tuple as major.minor.patch.
|
||||
"""
|
||||
return ".".join([str(x) for x in version])
|
||||
|
||||
@staticmethod
|
||||
def cmd_print(cmd, max_len=80):
|
||||
"""
|
||||
Outputs a command line, repecting maximum width.
|
||||
"""
|
||||
|
||||
cmd_line = []
|
||||
|
||||
for w in cmd:
|
||||
@@ -66,7 +76,9 @@ class PythonVersion:
|
||||
return "\n ".join(cmd_line)
|
||||
|
||||
def __str__(self):
|
||||
"""Returns a version tuple as major.minor.patch from self.version"""
|
||||
"""
|
||||
Return a version tuple as major.minor.patch from self.version.
|
||||
"""
|
||||
return self.ver_str(self.version)
|
||||
|
||||
@staticmethod
|
||||
|
||||
Reference in New Issue
Block a user