MCPcopy Create free account
hub / github.com/aarnphm/whispercpp / __init__

Method __init__

src/whispercpp/utils.py:87–116  ·  view source on GitHub ↗

Create a lazy loaded module. Args: local_name (str): The name of the module in the parent's globals. parent_module_globals (dict[str, t.Any]): The parent's globals. name (str): The name of the module to be imported. warning (str, optional): A

(
        self,
        local_name: str,
        parent_module_globals: dict[str, t.Any],
        name: str,
        warning: str | None = None,
        exc_msg: str | None = None,
        exc: type[Exception] = ImportError,
    )

Source from the content-addressed store, hash-verified

85 """
86
87 def __init__(
88 self,
89 local_name: str,
90 parent_module_globals: dict[str, t.Any],
91 name: str,
92 warning: str | None = None,
93 exc_msg: str | None = None,
94 exc: type[Exception] = ImportError,
95 ):
96 """Create a lazy loaded module.
97
98 Args:
99 local_name (str): The name of the module in the parent's globals.
100 parent_module_globals (dict[str, t.Any]): The parent's globals.
101 name (str): The name of the module to be imported.
102 warning (str, optional): A warning to be emitted when the module is loaded. Defaults to None.
103 exc_msg (str, optional): An exception message to be raised when the module is loaded. Defaults to None.
104 exc (type[Exception], optional): The exception to be raised when the module is loaded. Defaults to ImportError.
105
106 Returns:
107 LazyLoader: A lazy loaded module.
108 """
109 self._local_name = local_name
110 self._parent_module_globals = parent_module_globals
111 self._warning = warning
112 self._exc_msg = exc_msg
113 self._exc = exc
114 self._module: types.ModuleType | None = None
115
116 super().__init__(str(name))
117
118 def _load(self) -> types.ModuleType:
119 """Load the module and insert it into the parent's globals."""

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected