MCPcopy Index your code
hub / github.com/RustPython/RustPython / find_doc_entries

Function find_doc_entries

crates/doc/generate.py:180–217  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

178
179
180def find_doc_entries() -> "Iterable[DocEntry]":
181 yield from (
182 doc_entry
183 for module in iter_c_modules()
184 for doc_entry in traverse(module, module)
185 )
186 yield from (doc_entry for doc_entry in traverse(__builtins__, __builtins__))
187
188 builtin_types = [
189 type(None),
190 type(bytearray().__iter__()),
191 type(bytes().__iter__()),
192 type(dict().__iter__()),
193 type(dict().items()),
194 type(dict().items().__iter__()),
195 type(dict().values()),
196 type(dict().values().__iter__()),
197 type(lambda: ...),
198 type(list().__iter__()),
199 type(memoryview(b"").__iter__()),
200 type(range(0).__iter__()),
201 type(set().__iter__()),
202 type(str().__iter__()),
203 type(tuple().__iter__()),
204 ]
205
206 # Add types from the types module (e.g., ModuleType, FunctionType, etc.)
207 for name in dir(types):
208 if name.startswith("_"):
209 continue
210 obj = getattr(types, name)
211 if isinstance(obj, type):
212 builtin_types.append(obj)
213
214 for typ in builtin_types:
215 parts = ("builtins", typ.__name__)
216 yield DocEntry(parts, pydoc._getowndoc(typ))
217 yield from traverse(typ, __builtins__, parts)
218
219
220def main():

Callers 1

mainFunction · 0.85

Calls 14

iter_c_modulesFunction · 0.85
traverseFunction · 0.85
listClass · 0.85
setFunction · 0.85
strFunction · 0.85
dirFunction · 0.85
getattrFunction · 0.85
isinstanceFunction · 0.85
DocEntryClass · 0.85
__iter__Method · 0.45
itemsMethod · 0.45
valuesMethod · 0.45

Tested by

no test coverage detected