Skip to content

Commit 8d08c7c

Browse files
mchehabJonathan Corbet
authored andcommitted
docs: kdoc_files: 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: <75d58878ad6f83f24f1c0ce9e04301a000ecbaa3.1768838938.git.mchehab+huawei@kernel.org>
1 parent 4d7f631 commit 8d08c7c

1 file changed

Lines changed: 12 additions & 11 deletions

File tree

tools/lib/python/kdoc/kdoc_files.py

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,8 @@
55
# pylint: disable=R0903,R0913,R0914,R0917
66

77
"""
8-
Parse lernel-doc tags on multiple kernel source files.
8+
Classes for navigating through the files that kernel-doc needs to handle
9+
to generate documentation.
910
"""
1011

1112
import argparse
@@ -43,7 +44,7 @@ def __init__(self, srctree=None, valid_extensions=None):
4344
self.srctree = srctree
4445

4546
def _parse_dir(self, dirname):
46-
"""Internal function to parse files recursively"""
47+
"""Internal function to parse files recursively."""
4748

4849
with os.scandir(dirname) as obj:
4950
for entry in obj:
@@ -65,7 +66,7 @@ def _parse_dir(self, dirname):
6566
def parse_files(self, file_list, file_not_found_cb):
6667
"""
6768
Define an iterator to parse all source files from file_list,
68-
handling directories if any
69+
handling directories if any.
6970
"""
7071

7172
if not file_list:
@@ -91,18 +92,18 @@ class KernelFiles():
9192
9293
There are two type of parsers defined here:
9394
- self.parse_file(): parses both kernel-doc markups and
94-
EXPORT_SYMBOL* macros;
95-
- self.process_export_file(): parses only EXPORT_SYMBOL* macros.
95+
``EXPORT_SYMBOL*`` macros;
96+
- self.process_export_file(): parses only ``EXPORT_SYMBOL*`` macros.
9697
"""
9798

9899
def warning(self, msg):
99-
"""Ancillary routine to output a warning and increment error count"""
100+
"""Ancillary routine to output a warning and increment error count."""
100101

101102
self.config.log.warning(msg)
102103
self.errors += 1
103104

104105
def error(self, msg):
105-
"""Ancillary routine to output an error and increment error count"""
106+
"""Ancillary routine to output an error and increment error count."""
106107

107108
self.config.log.error(msg)
108109
self.errors += 1
@@ -128,7 +129,7 @@ def parse_file(self, fname):
128129

129130
def process_export_file(self, fname):
130131
"""
131-
Parses EXPORT_SYMBOL* macros from a single Kernel source file.
132+
Parses ``EXPORT_SYMBOL*`` macros from a single Kernel source file.
132133
"""
133134

134135
# Prevent parsing the same file twice if results are cached
@@ -157,7 +158,7 @@ def __init__(self, verbose=False, out_style=None,
157158
wcontents_before_sections=False,
158159
logger=None):
159160
"""
160-
Initialize startup variables and parse all files
161+
Initialize startup variables and parse all files.
161162
"""
162163

163164
if not verbose:
@@ -213,7 +214,7 @@ def __init__(self, verbose=False, out_style=None,
213214

214215
def parse(self, file_list, export_file=None):
215216
"""
216-
Parse all files
217+
Parse all files.
217218
"""
218219

219220
glob = GlobSourceFiles(srctree=self.config.src_tree)
@@ -242,7 +243,7 @@ def msg(self, enable_lineno=False, export=False, internal=False,
242243
filenames=None, export_file=None):
243244
"""
244245
Interacts over the kernel-doc results and output messages,
245-
returning kernel-doc markups on each interaction
246+
returning kernel-doc markups on each interaction.
246247
"""
247248

248249
self.out_style.set_config(self.config)

0 commit comments

Comments
 (0)