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

Method __getitem__

src/twisted/python/modules.py:208–228  ·  view source on GitHub ↗

Retrieve a module from below this path or package. @param modname: a str naming a module to be loaded. For entries, this is a top-level, undotted package name, and for packages it is the name of the module without the package prefix. For example, if you have a

(self, modname)

Source from the content-addressed store, hash-verified

206 raise NotImplementedError()
207
208 def __getitem__(self, modname):
209 """
210 Retrieve a module from below this path or package.
211
212 @param modname: a str naming a module to be loaded. For entries, this
213 is a top-level, undotted package name, and for packages it is the name
214 of the module without the package prefix. For example, if you have a
215 PythonModule representing the 'twisted' package, you could use::
216
217 twistedPackageObj['python']['modules']
218
219 to retrieve this module.
220
221 @raise KeyError: if the module is not found.
222
223 @return: a PythonModule.
224 """
225 for module in self.iterModules():
226 if module.name == self._subModuleName(modname):
227 return module
228 raise KeyError(modname)
229
230 def __iter__(self):
231 """

Callers

nothing calls this directly

Calls 2

iterModulesMethod · 0.95
_subModuleNameMethod · 0.95

Tested by

no test coverage detected