Go to the latest version of this document.
search in docstrings

Search bar offers the following options:

- Term presence. The below example searches for documents that must contain “foo”, might contain “bar” and must not contain “baz”: `+foo bar -baz`
- Wildcards. The below example searches for documents with words beginning with “foo”: `foo*`
- Search in specific fields. The following search matches all objects in "twisted.mail" that matches “search”: `+qname:twisted.mail.* +search`

  Possible fields: 'name', 'qname' (fully qualified name), 'docstring', and 'kind'. Last two fields are only applicable if "search in docstrings" is enabled.

- Fuzzy matches. The following search matches all documents that have a word within 1 edit distance of “foo”: `foo~1`

Results provided by Lunr.js

# ``twisted`.`python`.`modules`.`_ModuleIteratorHelper``

class documentation

`class _ModuleIteratorHelper: (source)`

Known subclasses: `twisted.python.modules.PathEntry`, `twisted.python.modules.PythonModule`

View In Hierarchy

This mixin provides common behavior between python module and path entries, since the mechanism for searching sys.path and __path__ attributes is remarkably similar.

Method | `__getitem__` | Retrieve a module from below this path or package.
Method | `__iter__` | Implemented to raise NotImplementedError for clarity, so that attempting to loop over this object won't call __getitem__.
Method | `iterModules` | Loop over the modules present below this entry or package on PYTHONPATH.
Method | `walkModules` | Similar to `iterModules`, this yields self, and then every module in my package or entry, and every submodule in each package or entry.
Method | `_getEntry` | Implement in subclasses to specify what path entry submodules will come from.
Method | `_packagePaths` | Implement in subclasses to specify where to look for modules.
Method | `_subModuleName` | This is a hook to provide packages with the ability to specify their names as a prefix to submodules here.

def __getitem__(self, modname): (source)

Retrieve a module from below this path or package.

Parameters

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 PythonModule representing the 'twisted' package, you could use:

        twistedPackageObj['python']['modules']

to retrieve this module.

Returns
a PythonModule.
Raises
`KeyError` | if the module is not found.

def __iter__(self): (source)

Implemented to raise NotImplementedError for clarity, so that attempting to loop over this object won't call __getitem__.

Note: in the future there might be some sensible default for iteration, like 'walkEverything', so this is deliberately untested and undefined behavior.

def iterModules(self): (source)

Loop over the modules present below this entry or package on PYTHONPATH.

For modules which are not packages, this will yield nothing.

For packages and path entries, this will only yield modules one level down; i.e. if there is a package a.b.c, iterModules on a will only return a.b. If you want to descend deeply, use walkModules.

Returns
a generator which yields PythonModule instances that describe modules which can be, or have been, imported.

def walkModules(self, importPackages=False): (source)
overridden in `twisted.python.modules.PythonModule`

Similar to `iterModules`, this yields self, and then every module in my package or entry, and every submodule in each package or entry.

In other words, this is deep, and `iterModules` is shallow.

def _getEntry(self): (source)
overridden in `twisted.python.modules.PathEntry`, `twisted.python.modules.PythonModule`

Implement in subclasses to specify what path entry submodules will come from.

Returns
a PathEntry instance.

def _packagePaths(self): (source)
overridden in `twisted.python.modules.PathEntry`, `twisted.python.modules.PythonModule`

Implement in subclasses to specify where to look for modules.

Returns
iterable of FilePath-like objects.

def _subModuleName(self, mn): (source)
overridden in `twisted.python.modules.PythonModule`

This is a hook to provide packages with the ability to specify their names as a prefix to submodules here.