Fixups for buildings docs (sphinx_generator):

- Remove typehints from argsString before checking signature
- lie and detect `_from`, `_is`, and `_def` as `from`, `is`, and `def for
  signature validating purposes
- Fix: don't remove const from identifiers containing const (eg: constraint)
This commit is contained in:
lojack5
2025-01-11 21:44:57 -07:00
parent f49f0b446d
commit 62f820a8cf
3 changed files with 6 additions and 3 deletions

View File

@@ -538,7 +538,7 @@ class FunctionDef(BaseDef, FixWxPrefix):
default = '|'.join([self.cleanName(x, True) for x in default.split('|')])
s = f'{s}={default}'
elif param_type:
s = f'{s} : {param_type}'
s = f'{s}: {param_type}'
params.append(s)
self.pyArgsString = f"({', '.join(params)})"

View File

@@ -622,7 +622,9 @@ class ParameterList(Node):
theargs = []
for arg in arguments:
arg = arg.split(':')[0].strip() # Remove the typehint
if arg in ('_from', '_def', '_is'): # Reserved Python keywords we've had to rename
arg = arg[1:]
myarg = arg.split('=')[0].strip()
if myarg:
theargs.append(myarg)

View File

@@ -150,7 +150,8 @@ class FixWxPrefix(object):
Finally, the 'wx.' prefix is added if needed.
"""
for txt in ['const', '*', '&', ' ']:
name = re.sub(r'(const(?![\w\d]))', '', name) # remove 'const', but not 'const'raints
for txt in ['*', '&', ' ']:
name = name.replace(txt, '')
name = name.replace('::', '.')
if not is_expression: