Skip to content

Commit ef6aa11

Browse files
mchehabJonathan Corbet
authored andcommitted
docs: parse_features: make documentation more consistent
Do some changes to: - add missing documentation strings to vars; - add a missing docstring; - ensure that phases will end with a period. Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org> Signed-off-by: Jonathan Corbet <corbet@lwn.net> Message-ID: <3722f10361638561a5ced18cf4f409930c88270b.1768838938.git.mchehab+huawei@kernel.org>
1 parent cb472bb commit ef6aa11

1 file changed

Lines changed: 20 additions & 7 deletions

File tree

tools/lib/python/feat/parse_features.py

Lines changed: 20 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -21,14 +21,25 @@ class ParseFeature:
2121
from it.
2222
"""
2323

24+
#: feature header string.
2425
h_name = "Feature"
26+
27+
#: Kernel config header string.
2528
h_kconfig = "Kconfig"
29+
30+
#: description header string.
2631
h_description = "Description"
32+
33+
#: subsystem header string.
2734
h_subsys = "Subsystem"
35+
36+
#: status header string.
2837
h_status = "Status"
38+
39+
#: architecture header string.
2940
h_arch = "Architecture"
3041

31-
# Sort order for status. Others will be mapped at the end.
42+
#: Sort order for status. Others will be mapped at the end.
3243
status_map = {
3344
"ok": 0,
3445
"TODO": 1,
@@ -40,7 +51,7 @@ class ParseFeature:
4051

4152
def __init__(self, prefix, debug=0, enable_fname=False):
4253
"""
43-
Sets internal variables
54+
Sets internal variables.
4455
"""
4556

4657
self.prefix = prefix
@@ -63,11 +74,13 @@ def __init__(self, prefix, debug=0, enable_fname=False):
6374
self.msg = ""
6475

6576
def emit(self, msg="", end="\n"):
77+
"""Helper function to append a new message for feature output."""
78+
6679
self.msg += msg + end
6780

6881
def parse_error(self, fname, ln, msg, data=None):
6982
"""
70-
Displays an error message, printing file name and line
83+
Displays an error message, printing file name and line.
7184
"""
7285

7386
if ln:
@@ -82,7 +95,7 @@ def parse_error(self, fname, ln, msg, data=None):
8295
print("", file=sys.stderr)
8396

8497
def parse_feat_file(self, fname):
85-
"""Parses a single arch-support.txt feature file"""
98+
"""Parses a single arch-support.txt feature file."""
8699

87100
if os.path.isdir(fname):
88101
return
@@ -204,7 +217,7 @@ def parse_feat_file(self, fname):
204217
self.max_size_arch_with_header = self.max_size_arch + len(self.h_arch)
205218

206219
def parse(self):
207-
"""Parses all arch-support.txt feature files inside self.prefix"""
220+
"""Parses all arch-support.txt feature files inside self.prefix."""
208221

209222
path = os.path.expanduser(self.prefix)
210223

@@ -281,7 +294,7 @@ def output_arch_table(self, arch, feat=None):
281294

282295
def output_feature(self, feat):
283296
"""
284-
Output a feature on all architectures
297+
Output a feature on all architectures.
285298
"""
286299

287300
title = f"Feature {feat}"
@@ -331,7 +344,7 @@ def output_feature(self, feat):
331344

332345
def matrix_lines(self, desc_size, max_size_status, header):
333346
"""
334-
Helper function to split element tables at the output matrix
347+
Helper function to split element tables at the output matrix.
335348
"""
336349

337350
if header:

0 commit comments

Comments
 (0)