Indentation

This commit is contained in:
Nyall Dawson 2024-08-10 17:52:00 +10:00
parent 526b89d205
commit 52ef640901

View File

@ -23,7 +23,6 @@ PREPEND_CODE_NO = 40
PREPEND_CODE_VIRTUAL = 41
PREPEND_CODE_MAKE_PRIVATE = 42
# TO RENAME
LINE = ''
@ -755,7 +754,9 @@ def processDoxygenLine(line):
return f"\n.. versionadded:: {since_match.group(1)}\n"
# Handle deprecated
deprecated_match = re.search(r'\\deprecated(?:\s+since\s+QGIS\s+(?P<DEPR_VERSION>[0-9.]+)(,\s*)?)?(?P<DEPR_MESSAGE>.*)?', line, re.IGNORECASE)
deprecated_match = re.search(
r'\\deprecated(?:\s+since\s+QGIS\s+(?P<DEPR_VERSION>[0-9.]+)(,\s*)?)?(?P<DEPR_MESSAGE>.*)?', line,
re.IGNORECASE)
if deprecated_match:
prev_indent = indent
indent = ''
@ -962,7 +963,8 @@ def fix_annotations(line):
# Note: this was the original perl regex, which isn't compatible with Python:
# line = re.sub(r"""=\s+[^=]*?\s+SIP_PYARGDEFAULT\(\s*\'?([^()']+)(\(\s*(?:[^()]++|(?2))*\s*\))?\'?\s*\)""", r'= \1', line)
line = re.sub(r"""=\s+[^=]*?\s+SIP_PYARGDEFAULT\(\s*\'?([^()\']+)(\((?:[^()]|\([^()]*\))*\))?\'?\s*\)""", r'= \1', line)
line = re.sub(r"""=\s+[^=]*?\s+SIP_PYARGDEFAULT\(\s*\'?([^()\']+)(\((?:[^()]|\([^()]*\))*\))?\'?\s*\)""", r'= \1',
line)
# Remove argument
if 'SIP_PYARGREMOVE' in line:
@ -987,7 +989,9 @@ def fix_annotations(line):
# original perl regex was:
# (?<coma>, +)?(const )?(\w+)(\<(?>[^<>]|(?4))*\>)?\s+[\w&*]+\s+SIP_PYARGREMOVE( = [^()]*(\(\s*(?:[^()]++|(?6))*\s*\))?)?(?(<coma>)|,?)//
line = re.sub(r'(?P<coma>, +)?(const )?(\w+)(\<(?:[^<>]|\<(?:[^<>]|\<[^<>]*\>)*\>)*\>)?\s+[\w&*]+\s+SIP_PYARGREMOVE( = [^()]*(\(\s*(?:[^()]++|\([^()]*\))*\s*\))?)?(?(coma)|,?)', '', line)
line = re.sub(
r'(?P<coma>, +)?(const )?(\w+)(\<(?:[^<>]|\<(?:[^<>]|\<[^<>]*\>)*\>)*\>)?\s+[\w&*]+\s+SIP_PYARGREMOVE( = [^()]*(\(\s*(?:[^()]++|\([^()]*\))*\s*\))?)?(?(coma)|,?)',
'', line)
line = re.sub(r'\(\s+\)', '()', line)
line = re.sub(r'SIP_FORCE', '', line)
@ -1318,7 +1322,8 @@ while line_idx < line_count:
if struct_match:
dbg_info(" going to struct => public")
class_and_struct.append(struct_match.group('structname'))
classname.append(classname[-1] if classname else struct_match.group('structname')) # fake new class since struct has considered similarly
classname.append(classname[-1] if classname else struct_match.group(
'structname')) # fake new class since struct has considered similarly
access.append(PUBLIC)
exported.append(exported[-1])
glob_bracket_nesting_idx.append(0)
@ -1938,7 +1943,9 @@ while line_idx < line_count:
python_signature = detect_and_remove_following_body_or_initializerlist()
# remove inline declarations
match = re.search(r'^(\s*)?(static |const )*(([(?:long )\w:]+(<.*?>)?\s+(\*|&)?)?(\w+)( (?:const*?))*)\s*(\{.*\});(\s*\/\/.*)?$', LINE)
match = re.search(
r'^(\s*)?(static |const )*(([(?:long )\w:]+(<.*?>)?\s+(\*|&)?)?(\w+)( (?:const*?))*)\s*(\{.*\});(\s*\/\/.*)?$',
LINE)
if match:
LINE = f"{match.group(1)}{match.group(3)};"