Improve cross-module references in docstrings

This commit is contained in:
baldurk
2026-02-11 16:52:20 +00:00
parent fc85e44a06
commit 109e524d5c
3 changed files with 16 additions and 7 deletions
+11 -2
View File
@@ -234,7 +234,8 @@ def check_used_types(objname, module, used_types):
print(" - Maybe missing namespace to refer to renderdoc.{}?".format(type_name))
break
for mod_name in ['renderdoc', 'qrenderdoc']:
check_mods = ['renderdoc', 'qrenderdoc']
for mod_name in check_mods:
mod = sys.modules[mod_name]
if args.verbose:
print("===== Checks for {} =====".format(mod_name))
@@ -350,7 +351,15 @@ for mod_name in ['renderdoc', 'qrenderdoc']:
type_name = re.sub('StructuredObjectList', 'List[SDObject]', type_name)
type_name = re.sub('StructuredChunkList', 'List[SDChunk]', type_name)
type_name = re.sub('^builtins.', '', type_name)
type_name = re.sub('^importlib._bootstrap.', '', type_name)
if 'importlib._bootstrap' in type_name:
type_name = re.sub('^importlib._bootstrap.', '', type_name)
real_module = [
m for m in check_mods if type_name in sys.modules[m].__dict__
][0]
if real_module != mod_name:
type_name = f"{real_module}.{type_name}"
type_name = re.sub('datetime.datetime', 'datetime', type_name)
if type_name == 'NoneType':
+3 -3
View File
@@ -82,7 +82,7 @@ struct ShaderProcessingTool
}
DOCUMENT(R"(The :class:`KnownShaderTool` identifying which known tool this program is.
:type: KnownShaderTool
:type: renderdoc.KnownShaderTool
)");
KnownShaderTool tool = KnownShaderTool::Unknown;
DOCUMENT(R"(The human-readable name of the program.
@@ -102,12 +102,12 @@ struct ShaderProcessingTool
rdcstr args;
DOCUMENT(R"(The input that this program expects.
:type: ShaderEncoding
:type: renderdoc.ShaderEncoding
)");
ShaderEncoding input = ShaderEncoding::Unknown;
DOCUMENT(R"(The output that this program provides.
:type: ShaderEncoding
:type: renderdoc.ShaderEncoding
)");
ShaderEncoding output = ShaderEncoding::Unknown;
+2 -2
View File
@@ -2202,7 +2202,7 @@ tool.
:param KnownShaderTool tool: The tool to get the input encoding for.
:return: The encoding that this tool expects as an input by default.
:rtype: renderdoc.ShaderEncoding
:rtype: ShaderEncoding
)");
constexpr inline ShaderEncoding ToolInput(KnownShaderTool tool)
{
@@ -2229,7 +2229,7 @@ tool.
:param KnownShaderTool tool: The tool to get the output encoding for.
:return: The encoding that this tool produces as an output by default.
:rtype: renderdoc.ShaderEncoding
:rtype: ShaderEncoding
)");
constexpr inline ShaderEncoding ToolOutput(KnownShaderTool tool)
{