Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Add types.* for doc/generate.py
  • Loading branch information
youknowone committed Dec 10, 2025
commit 3d0b809d2f3c1aed3318843a87d8120cc718d258
11 changes: 10 additions & 1 deletion crates/doc/generate.py
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,15 @@ def find_doc_entries() -> "Iterable[DocEntry]":
type(str().__iter__()),
type(tuple().__iter__()),
]

# Add types from the types module (e.g., ModuleType, FunctionType, etc.)
for name in dir(types):
if name.startswith("_"):
continue
obj = getattr(types, name)
if isinstance(obj, type):
builtin_types.append(obj)

for typ in builtin_types:
parts = ("builtins", typ.__name__)
yield DocEntry(parts, pydoc._getowndoc(typ))
Expand All @@ -204,7 +213,7 @@ def main():
docs = {
entry.key: entry.doc
for entry in find_doc_entries()
if entry.raw_doc is not None
if entry.raw_doc is not None and isinstance(entry.raw_doc, str)
}
dumped = json.dumps(docs, sort_keys=True, indent=4)
OUTPUT_FILE.write_text(dumped)
Expand Down