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

Function iter_modules

crates/doc/generate.py:104–120  ·  view source on GitHub ↗

Yields ------ :class:`types.Module` Python modules.

()

Source from the content-addressed store, hash-verified

102
103
104def iter_modules() -> "Iterable[types.ModuleType]":
105 """
106 Yields
107 ------
108 :class:`types.Module`
109 Python modules.
110 """
111 for module_name in sys.stdlib_module_names - IGNORED_MODULES:
112 try:
113 with warnings.catch_warnings():
114 warnings.filterwarnings("ignore", category=DeprecationWarning)
115 module = __import__(module_name)
116 except ImportError:
117 warnings.warn(f"Could not import {module_name}", category=ImportWarning)
118 continue
119
120 yield module
121
122
123def iter_c_modules() -> "Iterable[types.ModuleType]":

Callers 1

iter_c_modulesFunction · 0.70

Calls 2

__import__Function · 0.50
warnMethod · 0.45

Tested by

no test coverage detected