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`.`deprecate`.`_ModuleProxy``

class documentation

`class _ModuleProxy: (source)`

View In Hierarchy

Python module wrapper to hook module-level attribute access.

Access to deprecated attributes first checks `_ModuleProxy._deprecatedAttributes`, if the attribute does not appear there then access falls through to `_ModuleProxy._module`, the wrapped module object.

Method | `__getattribute__` | Get an attribute from the module object, possibly emitting a warning.
Method | `__init__` | Undocumented
Method | `__repr__` | Get a string containing the type of the module proxy and a representation of the wrapped module object.
Method | `__setattr__` | Set an attribute on the wrapped module object.
Instance Variable | `_deprecatedAttributes` | Mapping of attribute names to objects that retrieve the module attribute's original value.
Instance Variable | `_lastWasPath` | Heuristic guess as to whether warnings about this package should be ignored for the next call. If the last attribute access of this module was a `getattr` of `__path__`, we will assume that it was the import system doing it and we won't emit a warning for the next access, even if it is to a deprecated attribute...
Instance Variable | `_module` | Module on which to hook attribute access.

def __getattribute__(self, name): (source)

Get an attribute from the module object, possibly emitting a warning.

If the specified name has been deprecated, then a warning is issued. (Unless certain obscure conditions are met; see `_ModuleProxy._lastWasPath` for more information about what might quash such a warning.)

def __init__(self, module): (source)

Undocumented

def __repr__(self): (source)

Get a string containing the type of the module proxy and a representation of the wrapped module object.

Returns
`str` | Undocumented

def __setattr__(self, name, value): (source)

Set an attribute on the wrapped module object.

_deprecatedAttributes: `dict` mapping `str` to `_DeprecatedAttribute` = (source)

Mapping of attribute names to objects that retrieve the module attribute's original value.

_lastWasPath: `bool` = (source)

Heuristic guess as to whether warnings about this package should be ignored for the next call. If the last attribute access of this module was a `getattr` of `__path__`, we will assume that it was the import system doing it and we won't emit a warning for the next access, even if it is to a deprecated attribute. The CPython import system always tries to access `__path__`, then the attribute itself, then the attribute itself again, in both successful and failed cases.

_module: `module` = (source)

Module on which to hook attribute access.