Skip to content

Commit b88b2e7

Browse files
committed
Add docstrings to improve documentation
Change-Id: Ib41240574c887231af0abf4f23f062bd372938a8
1 parent 6eb24c8 commit b88b2e7

1 file changed

Lines changed: 14 additions & 0 deletions

File tree

linux-version-finder

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,9 @@ import typer
1414

1515

1616
def linux_version_finder_single(single_script_path: str, commit: str) -> list[str]:
17+
"""Retrieve Linux versions for a single commit
18+
19+
Find the Linux versions where a commit is present or was backported"""
1720
completedProcess = subprocess.run(
1821
[single_script_path, commit],
1922
capture_output=True,
@@ -24,13 +27,21 @@ def linux_version_finder_single(single_script_path: str, commit: str) -> list[st
2427

2528

2629
def get_minor_version(version: str) -> str:
30+
"""Retrieve the Linux minor/major version
31+
32+
Strip the suffix of "-rcX" or patch version ".X".
33+
E.g. "v5.9-rc2" -> "v5.9"
34+
E.g. "v3.2.1" -> "v3.2"."""
2735
m = re.match(r"^(v\d+\.\d+)", version)
2836
if not m:
2937
sys.exit("error: the " + version + " tag use an unexpected format")
3038
return m.group(1)
3139

3240

3341
def get_minor_versions() -> list[str]:
42+
"""Get complete list of minor/major versions
43+
44+
E.g. ["v3.0", "v3.1", "v3.2"]."""
3445
completedProcess = subprocess.run(
3546
"git tag -l 'v*' | cut -d. -f-2 | cut -d- -f1 | sort -u -V | xargs",
3647
capture_output=True,
@@ -41,6 +52,9 @@ def get_minor_versions() -> list[str]:
4152

4253

4354
def version_key(version: str) -> int:
55+
"""Transform the Linux version in a integer
56+
57+
This is done in order to compare the Linux versions."""
4458
m = re.match(r"^v\d+\.\d+\-rc(\d+)", version)
4559
if m:
4660
return int(m.group(1))

0 commit comments

Comments
 (0)