Files
ServerSync/lib/invoke/__pycache__/watchers.cpython-314.pyc

92 lines
6.8 KiB
Plaintext
Raw Normal View History

2026-02-12 02:28:23 +02:00
+
t<10>i<EFBFBD><00><00><><00>^RIt^RIt^RIHtHt^RIHt!RR]P4t!RR]4t !RR ] 4t
R#)
<EFBFBD>N)<02> Generator<6F>Iterable)<01>ResponseNotAcceptedc<00>6a<00>]tRt^toRtV3RlRltRtVtR#)<06> StreamWatchera%
A class whose subclasses may act on seen stream data from subprocesses.
Subclasses must exhibit the following API; see `Responder` for a concrete
example.
* ``__init__`` is completely up to each subclass, though as usual,
subclasses *of* subclasses should be careful to make use of `super` where
appropriate.
* `submit` must accept the entire current contents of the stream being
watched, as a string, and may optionally return an iterable of strings
(or act as a generator iterator, i.e. multiple calls to ``yield
<string>``), which will each be written to the subprocess' standard
input.
.. note::
`StreamWatcher` subclasses exist in part to enable state tracking, such
as detecting when a submitted password didn't work & erroring (or
prompting a user, or etc). Such bookkeeping isn't easily achievable
with simple callback functions.
.. note::
`StreamWatcher` subclasses `threading.local` so that its instances can
be used to 'watch' both subprocess stdout and stderr in separate
threads.
.. versionadded:: 1.0
c<00>6<<01>V^8<>dQhRS[RS[S[,/#)<03><00>stream<61>return<72><02>strr)<02>format<61> __classdict__s"<22><>6/tmp/pip-target-zhdecbcm/lib/python/invoke/watchers.py<70> __annotate__<5F>StreamWatcher.__annotate__&s<00><><00> "<22> "<22>S<EFBFBD> "<22>X<EFBFBD>c<EFBFBD>]<5D> "<22>c <0C><00>\h)z<>
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
)<01>NotImplementedError)<02>selfr
s&&r<00>submit<69>StreamWatcher.submit&s
<00><00>"<22>!r<00>N)<08>__name__<5F>
__module__<EFBFBD> __qualname__<5F>__firstlineno__<5F>__doc__r<00>__static_attributes__<5F>__classdictcell__<5F>rs@rrrs<00><><00><00><08>: "<22> "rrc<00>Za<00>]tRt^5toRtV3RlRltV3RlRltV3RlRltRtVt R #)
<EFBFBD> Responderz<72>
A parameterizable object that submits responses to specific patterns.
Commonly used to implement password auto-responds for things like ``sudo``.
.. versionadded:: 1.0
c<00>*<<01>V^8<>dQhRS[RS[RR/#)r <00>pattern<72>responser N<>r )rrs"<22>rr<00>Responder.__annotate__>s"<00><><00><17><17><03><17>s<EFBFBD><17>t<EFBFBD>rc <0C>,<00>WnW n^VnR#)a
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.
N)r%r&<00>index)rr%r&s&&&r<00>__init__<5F>Responder.__init__>s<00><00><1F> <0C> <20> <0A><16><04>
rc <00>B<<01>V^8<>dQhRS[RS[RS[RS[S[,/#)r r
r%<00>
index_attrr r )rrs"<22>rrr(Os1<00><><00><17><17><19><17>$'<27><17>58<35><17> <11>#<23><1D>rc <0C><><00>\W4pWRp\P!W%\P4pV'd\ WV\ V4,4V#)az
Generic "search for pattern in stream, using index" behavior.
Used here and in some subclasses that want to track multiple patterns
concurrently.
:param str stream: The same data passed to ``submit``.
:param str pattern: The pattern to search for.
:param str index_attr: The name of the index attribute to use.
:returns: An iterable of string matches.
.. versionadded:: 1.0
N)<06>getattr<74>re<72>findall<6C>S<>setattr<74>len)rr
r%r.r*<00>new<65>matchess&&&& r<00>pattern_matches<65>Responder.pattern_matchesOsF<00><00>&<18><04>)<29><05><14>V<EFBFBD>n<EFBFBD><03><14>*<2A>*<2A>W<EFBFBD>2<EFBFBD>4<EFBFBD>4<EFBFBD>0<><07> <12> <13>D<EFBFBD>e<EFBFBD>c<EFBFBD>#<23>h<EFBFBD>&6<> 7<><16>rc<00><<<01>V^8<>dQhRS[RS[S[RR3,/#<00>r r
r N<>r r)rrs"<22>rrr(ks&<00><><00> <20> <20>S<EFBFBD> <20>Y<EFBFBD>s<EFBFBD>D<EFBFBD>$<24><EFBFBD>%?<3F> rc#<08>p"<00>VPWPR4FpVPx<00>K R#5i)r*N)r8r%r&)rr
<00>_s&& rr<00>Responder.submitks+<00><00><00><15>%<25>%<25>f<EFBFBD>l<EFBFBD>l<EFBFBD>G<EFBFBD>D<>A<EFBFBD><16>-<2D>-<2D> <1F>E<01>s<00>46)r*r%r&N)
rrrrrr+r8rrr r!s@rr#r#5s(<00><><00><00><08><17><17>"<17><17>8 <20> rr#c<00>Zaa<01>]tRt^qtoRtV3RlV3RlltV3RlV3RlltRtVtV;t #)<07>FailingRespondera
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
c<00>0<<01>V^8<>dQhRS[RS[RS[RR/#)r r%r&<00>sentinelr Nr')rrs"<22>rr<00>FailingResponder.__annotate__|s)<00><><00><1B><1B><03><1B>s<EFBFBD><1B>c<EFBFBD><1B>d<EFBFBD>rc<08>N<<01>\SV`W4W0n^VnRVnR#)rFN)<05>superr+rC<00> failure_index<65>tried)rr%r&rC<00> __class__s&&&&<26>rr+<00>FailingResponder.__init__|s$<00><><00> <0A><07><18><17>+<2B> <20> <0A><1E><04><1A><1A><04>
rc<00><<<01>V^8<>dQhRS[RS[S[RR3,/#r;r<)rrs"<22>rrrD<00>s&<00><><00><18><18>S<EFBFBD><18>Y<EFBFBD>s<EFBFBD>D<EFBFBD>$<24><EFBFBD>%?<3F>rc<08><<01>\SV`V4pVPWPR4pVP'd:V'd2RP VP VP4p\V4hV'dRVnV#)rGz(Auto-response to r"{}" failed with {!r}!T)rFrr8rCrHrr%r)rr
r&<00>failed<65>errrIs&& <20>rr<00>FailingResponder.submit<69>sk<00><><00><18>7<EFBFBD>><3E>&<26>)<29><08><15>%<25>%<25>f<EFBFBD>m<EFBFBD>m<EFBFBD>_<EFBFBD>M<><06> <0F>:<3A>:<3A>:<3A>&<26><<3C>C<>C<><14> <0C> <0C>d<EFBFBD>m<EFBFBD>m<EFBFBD><0E>C<EFBFBD>&<26>c<EFBFBD>*<2A> *<2A> <13><1D>D<EFBFBD>J<EFBFBD><17>r)rGrCrH)
rrrrrr+rrr <00> __classcell__)rIrs@@rrArAqs#<00><><00><00><08><1B><1B> <18><18>rrA) r1<00> threading<6E>typingrr<00>
exceptionsr<00>localrr#rArrr<00><module>rUs;<00><01> <09><10>&<26>+<2B>*"<22>I<EFBFBD>O<EFBFBD>O<EFBFBD>*"<22>Z9 <20> <0A>9 <20>x <18>y<EFBFBD> r