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`.`internet`.`utils``

module documentation
(source)

Utility methods.

Function | `getProcessOutput` | Spawn a process and return its output as a deferred returning a `bytes`.
Function | `getProcessOutputAndValue` | Spawn a process and returns a Deferred that will be called back with its output (from stdout and stderr) and it's exit code as (out, err, code) If a signal is raised, the Deferred will errback with the stdout and stderr up to that point, along with the signal, as (out, err, signalNum)...
Function | `getProcessValue` | Spawn a process and return its exit code as a Deferred.
Function | `runWithWarningsSuppressed` | Run the function f, but with some warnings suppressed.
Function | `suppressWarnings` | Wrap `f` in a callable which suppresses the indicated warnings before invoking `f` and unsuppresses them afterwards. If f returns a Deferred, warnings will remain suppressed until the Deferred fires.
Class | `_BackRelay` | Trivial protocol for communicating with a process and turning its output into the result of a `Deferred`.
Class | `_EverythingGetter` | Undocumented
Class | `_ValueGetter` | Undocumented
Exception | `_UnexpectedErrorOutput` | Standard error data was received where it was not expected. This is a subclass of `IOError` to preserve backward compatibility with the previous error behavior of `getProcessOutput`.
Function | `_callProtocolWithDeferred` | Undocumented
Function | `_resetWarningFilters` | Undocumented

def getProcessOutput(executable, args=(), env={}, path=None, reactor=None, errortoo=0): (source)

Spawn a process and return its output as a deferred returning a `bytes`.

Parameters
executable | The file name to run and get the output of - the full path should be used.
args | the command line arguments to pass to the process; a sequence of strings. The first string should NOT be the executable's name.
env | the environment variables to pass to the process; a dictionary of strings.
path | the path to run the subprocess in - defaults to the current directory.
reactor | the reactor to use - defaults to the default reactor
errortoo | If true, include stderr in the result. If false, if stderr is received the returned `Deferred` will errback with an `IOError` instance with a `processEnded` attribute. The `processEnded` attribute refers to a `Deferred` which fires when the executed process ends.

def getProcessOutputAndValue(executable, args=(), env={}, path=None, reactor=None, stdinBytes=None): (source)

Spawn a process and returns a Deferred that will be called back with its output (from stdout and stderr) and it's exit code as (out, err, code) If a signal is raised, the Deferred will errback with the stdout and stderr up to that point, along with the signal, as (out, err, signalNum)

def getProcessValue(executable, args=(), env={}, path=None, reactor=None): (source)

Spawn a process and return its exit code as a Deferred.

def runWithWarningsSuppressed(suppressedWarnings, f, *a, **kw): (source)

Run the function f, but with some warnings suppressed.

This calls `warnings.filterwarnings` to add warning filters before invoking f. If f returns a `Deferred` then the added filters are removed once the deferred fires. Otherwise they are removed immediately.

Note that the list of warning filters is a process-wide resource, so calling this function will affect all threads.

Parameters
suppressedWarnings | A list of arguments to pass to `warnings.filterwarnings`, a sequence of (args, kwargs) 2-tuples.
f | A callable, which may return a `Deferred`.
*a | Positional arguments passed to f
**kw | Keyword arguments passed to f
Returns
The result of `f(*a, **kw)`
See Also
`twisted.python.util.runWithWarningsSuppressed` functions similarly, but doesn't handled `Deferred`s.

def suppressWarnings(f, *suppressedWarnings): (source)

Wrap `f` in a callable which suppresses the indicated warnings before invoking `f` and unsuppresses them afterwards. If f returns a Deferred, warnings will remain suppressed until the Deferred fires.

def _callProtocolWithDeferred(protocol, executable, args, env, path, reactor=None, protoArgs=()): (source)

Undocumented

def _resetWarningFilters(passthrough, addedFilters): (source)

Undocumented