Variant of `Responder` which is capable of detecting incorrect responses. This class adds a ``sentinel`` parameter to ``__init__``, and its ``submit`` will raise `.ResponseNotAccepted` if it detects that sentinel value in the stream. .. versionadded:: 1.0
Method | __init__ |
Imprint this `Responder` with necessary parameters. |
Method | submit |
Act on ``stream`` data, potentially returning responses. |
Instance Variable | failure |
Undocumented |
Instance Variable | sentinel |
Undocumented |
Instance Variable | tried |
Undocumented |
Inherited from Responder
:
Method | pattern |
Generic "search for pattern in stream, using index" behavior. |
Instance Variable | index |
Undocumented |
Instance Variable | pattern |
Undocumented |
Instance Variable | response |
Undocumented |
invoke.watchers.Responder.__init__
Imprint this `Responder` with necessary parameters. :param pattern: A raw string (e.g. ``r"\[sudo\] password for .*:"``) which will be turned into a regular expression. :param response: The string to submit to the subprocess' stdin when ``pattern`` is detected.
invoke.watchers.Responder.submit
Act on ``stream`` data, potentially returning responses. :param str stream: All data read on this stream since the beginning of the session. :returns: An iterable of ``str`` (which may be empty). .. versionadded:: 1.0