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`.`web`.`_element`.`Expose``

class documentation

`class Expose: (source)`

View In Hierarchy

Helper for exposing methods for various uses using a simple decorator-style callable.

Instances of this class can be called with one or more functions as positional arguments. The names of these functions will be added to a list on the class object of which they are methods.

Method | `__call__` | Add one or more functions to the set of exposed functions.
Method | `get` | Retrieve an exposed method with the given name from the given instance.
Class Variable | `_nodefault` | Undocumented

def __call__(self, f: `_Tc`, /, *funcObjs: `Callable[..., object]`) -> `_Tc`: (source)

Add one or more functions to the set of exposed functions.

This is a way to declare something about a class definition, similar to `zope.interface.implementer`. Use it like this:

        magic = Expose('perform extra magic')
        class Foo(Bar):
            def twiddle(self, x, y):
                ...
            def frob(self, a, b):
                ...
            magic(twiddle, frob)

Later you can query the object:

        aFoo = Foo()
        magic.get(aFoo, 'twiddle')(x=1, y=2)

The call to `get` will fail if the name it is given has not been exposed using `magic`.

Parameters
f:`_Tc` | Undocumented
*funcObjs:`Callable[..., object]` | One or more function objects which will be exposed to the client.
Returns
`_Tc` | The first of `funcObjs`.

@overload
def get(self, instance: `object`, methodName: `str`) -> `Callable[..., Any]`:
@overload
def get(self, instance: `object`, methodName: `str`, default: `T`) -> `Union[Callable[..., Any], T]`:
(source)

Retrieve an exposed method with the given name from the given instance.

Returns
`object` | A callable object for the named method assigned to the given instance.
Raises
`UnexposedMethodError` | Raised if `default` is not specified and there is no exposed method with the given name.

_nodefault = (source)

Undocumented