Skip to content

Commit ff91637

Browse files
mchehabJonathan Corbet
authored andcommitted
docs: python: abi_regex: do some improvements at documentation
Add documentation for two consts and ensure that all sentenses will end with a dot. Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org> Signed-off-by: Jonathan Corbet <corbet@lwn.net> Message-ID: <5419ad89a5042c1571198c2f055866674808579b.1768838938.git.mchehab+huawei@kernel.org>
1 parent 66c3bf9 commit ff91637

File tree

1 file changed

+20
-6
lines changed

1 file changed

+20
-6
lines changed

tools/lib/python/abi/abi_regex.py

Lines changed: 20 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,22 @@
1616
from abi.helpers import AbiDebug
1717

1818
class AbiRegex(AbiParser):
19-
"""Extends AbiParser to search ABI nodes with regular expressions"""
19+
"""
20+
Extends AbiParser to search ABI nodes with regular expressions.
2021
21-
# Escape only ASCII visible characters
22+
There some optimizations here to allow a quick symbol search:
23+
instead of trying to place all symbols altogether an doing linear
24+
search which is very time consuming, create a tree with one depth,
25+
grouping similar symbols altogether.
26+
27+
Yet, sometimes a full search will be needed, so we have a special branch
28+
on such group tree where other symbols are placed.
29+
"""
30+
31+
#: Escape only ASCII visible characters.
2232
escape_symbols = r"([\x21-\x29\x2b-\x2d\x3a-\x40\x5c\x60\x7b-\x7e])"
33+
34+
#: Special group for other nodes.
2335
leave_others = "others"
2436

2537
# Tuples with regular expressions to be compiled and replacement data
@@ -88,13 +100,15 @@ class AbiRegex(AbiParser):
88100
# Recover plus characters
89101
(re.compile(r"\xf7"), "+"),
90102
]
103+
104+
#: Regex to check if the symbol name has a number on it.
91105
re_has_num = re.compile(r"\\d")
92106

93-
# Symbol name after escape_chars that are considered a devnode basename
107+
#: Symbol name after escape_chars that are considered a devnode basename.
94108
re_symbol_name = re.compile(r"(\w|\\[\.\-\:])+$")
95109

96-
# List of popular group names to be skipped to minimize regex group size
97-
# Use AbiDebug.SUBGROUP_SIZE to detect those
110+
#: List of popular group names to be skipped to minimize regex group size
111+
#: Use AbiDebug.SUBGROUP_SIZE to detect those.
98112
skip_names = set(["devices", "hwmon"])
99113

100114
def regex_append(self, what, new):
@@ -148,7 +162,7 @@ def regex_append(self, what, new):
148162
def get_regexes(self, what):
149163
"""
150164
Given an ABI devnode, return a list of all regular expressions that
151-
may match it, based on the sub-groups created by regex_append()
165+
may match it, based on the sub-groups created by regex_append().
152166
"""
153167

154168
re_list = []

0 commit comments

Comments
 (0)