MCPcopy Create free account
hub / github.com/twisted/twisted / load

Method load

src/twisted/python/modules.py:375–397  ·  view source on GitHub ↗

Load this module. @param default: if specified, the value to return in case of an error. @return: a genuine python module. @raise Exception: Importing modules is a risky business; the erorrs of any code run at module scope may be raised from here, as

(self, default=_nothing)

Source from the content-addressed store, hash-verified

373 return _isPackagePath(self.filePath)
374
375 def load(self, default=_nothing):
376 """
377 Load this module.
378
379 @param default: if specified, the value to return in case of an error.
380
381 @return: a genuine python module.
382
383 @raise Exception: Importing modules is a risky business;
384 the erorrs of any code run at module scope may be raised from here, as
385 well as ImportError if something bizarre happened to the system path
386 between the discovery of this PythonModule object and the attempt to
387 import it. If you specify a default, the error will be swallowed
388 entirely, and not logged.
389
390 @rtype: types.ModuleType.
391 """
392 try:
393 return self.pathEntry.pythonPath.moduleLoader(self.name)
394 except BaseException: # this needs more thought...
395 if default is not _nothing:
396 return default
397 raise
398
399 def __eq__(self, other: object) -> bool:
400 """

Callers 3

iterAttributesMethod · 0.95
walkModulesMethod · 0.95
_packagePathsMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected