Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

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>

authored by

Mauro Carvalho Chehab and committed by
Jonathan Corbet
ff91637d 66c3bf97

+20 -6
+20 -6
tools/lib/python/abi/abi_regex.py
··· 16 16 from abi.helpers import AbiDebug 17 17 18 18 class AbiRegex(AbiParser): 19 - """Extends AbiParser to search ABI nodes with regular expressions""" 19 + """ 20 + Extends AbiParser to search ABI nodes with regular expressions. 20 21 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. 22 32 escape_symbols = r"([\x21-\x29\x2b-\x2d\x3a-\x40\x5c\x60\x7b-\x7e])" 33 + 34 + #: Special group for other nodes. 23 35 leave_others = "others" 24 36 25 37 # Tuples with regular expressions to be compiled and replacement data ··· 100 88 # Recover plus characters 101 89 (re.compile(r"\xf7"), "+"), 102 90 ] 91 + 92 + #: Regex to check if the symbol name has a number on it. 103 93 re_has_num = re.compile(r"\\d") 104 94 105 - # Symbol name after escape_chars that are considered a devnode basename 95 + #: Symbol name after escape_chars that are considered a devnode basename. 106 96 re_symbol_name = re.compile(r"(\w|\\[\.\-\:])+$") 107 97 108 - # List of popular group names to be skipped to minimize regex group size 109 - # Use AbiDebug.SUBGROUP_SIZE to detect those 98 + #: List of popular group names to be skipped to minimize regex group size 99 + #: Use AbiDebug.SUBGROUP_SIZE to detect those. 110 100 skip_names = set(["devices", "hwmon"]) 111 101 112 102 def regex_append(self, what, new): ··· 162 148 def get_regexes(self, what): 163 149 """ 164 150 Given an ABI devnode, return a list of all regular expressions that 165 - may match it, based on the sub-groups created by regex_append() 151 + may match it, based on the sub-groups created by regex_append(). 166 152 """ 167 153 168 154 re_list = []