Files
ServerSync/lib/prompt_toolkit/__pycache__/auto_suggest.cpython-314.pyc

75 lines
10 KiB
Plaintext
Raw Normal View History

2026-02-12 02:28:23 +02:00
+
9<><39>i<EFBFBD><00><01><00>Rt^RIHt^RIHtHt^RIHtHt^RI H
t
^RI H t ^RI HtHt]'d^RIHt.ROt!RR4t!RR ]R7t!RR
]4t!RR ]4t!RR ]4t!RR ]4t!RR]4tR#)a)
`Fish-style <http://fishshell.com/>`_ like auto-suggestion.
While a user types input in a certain buffer, suggestions are generated
(asynchronously.) Usually, they are displayed after the input. When the cursor
presses the right arrow and the cursor is at the end of the input, the
suggestion will be inserted.
If you want the auto suggestions to be asynchronous (in a background thread),
because they take too much time, and could potentially block the event loop,
then wrap the :class:`.AutoSuggest` instance into a
:class:`.ThreadedAutoSuggest`.
)<01> annotations)<02>ABCMeta<74>abstractmethod)<02> TYPE_CHECKING<4E>Callable<6C><01>run_in_executor_with_context)<01>Document)<02>Filter<65> to_filter)<01>Buffer<65>
Suggestion<EFBFBD> AutoSuggest<73>ThreadedAutoSuggest<73>DummyAutoSuggest<73>AutoSuggestFromHistory<72>ConditionalAutoSuggest<73>DynamicAutoSuggestc<01>2<00>]tRt^'tRtRRltRRltRtR#)r zV
Suggestion returned by an auto-suggest algorithm.
:param text: The suggestion text.
c<01> <00>V^8<>dQhRRRR/#)<05><00>text<78>str<74>return<72>None<6E>)<01>formats"<22>B/tmp/pip-target-wqrk2shd/lib/python/prompt_toolkit/auto_suggest.py<70> __annotate__<5F>Suggestion.__annotate__.s<00><00><19><19>S<EFBFBD><19>T<EFBFBD><19>c <09><00>WnR#<00>N<>r)<02>selfrs&&r<00>__init__<5F>Suggestion.__init__.s<00><00><18> r c<01><00>V^8<>dQhRR/#)rrrr)rs"rrr1s<00><00>*<2A>*<2A>#<23>*r c <09>"<00>RVP R2#)z Suggestion(<28>)r#)r$s&r<00>__repr__<5F>Suggestion.__repr__1s<00><00><1C>T<EFBFBD>Y<EFBFBD>Y<EFBFBD>K<EFBFBD>q<EFBFBD>)<29>)r r#N)<08>__name__<5F>
__module__<EFBFBD> __qualname__<5F>__firstlineno__<5F>__doc__r%r*<00>__static_attributes__rr rr r 's<00><00><08> <19>*<2A>*r c<01><<00>]tRt^5tRt]RRl4tRRltRtR#)rz1
Base class for auto suggestion implementations.
c<01>$<00>V^8<>dQhRRRRRR/#<00>r<00>bufferr <00>documentr r<00>Suggestion | Noner)rs"rr<00>AutoSuggest.__annotate__;s"<00><00> <0C> <0C>V<EFBFBD> <0C>x<EFBFBD> <0C>DU<44> r c <0A><00>R#)af
Return `None` or a :class:`.Suggestion` instance.
We receive both :class:`~prompt_toolkit.buffer.Buffer` and
:class:`~prompt_toolkit.document.Document`. The reason is that auto
suggestions are retrieved asynchronously. (Like completions.) The
buffer text could be changed in the meantime, but ``document`` contains
the buffer document like it was at the start of the auto suggestion
call. So, from here, don't access ``buffer.text``, but use
``document.text`` instead.
:param buffer: The :class:`~prompt_toolkit.buffer.Buffer` instance.
:param document: The :class:`~prompt_toolkit.document.Document` instance.
Nr<00>r$r5r6s&&&r<00>get_suggestion<6F>AutoSuggest.get_suggestion:s<00>r c<01>$<00>V^8<>dQhRRRRRR/#<00>r<00>buffr r6r rr7r)rs"rrr8Ks$<00><00>3<>3<><1A>3<>&.<2E>3<> <1A>3r c<00> <0A>,"<00>VPW4#5i)z<>
Return a :class:`.Future` which is set when the suggestions are ready.
This function can be overloaded in order to provide an asynchronous
implementation.
<EFBFBD>r;<00>r$r?r6s&&&r<00>get_suggestion_async<6E> AutoSuggest.get_suggestion_asyncKs<00><00><00><14>"<22>"<22>4<EFBFBD>2<>2<>s<00>rN) r,r-r.r/r0rr;rCr1rr rrr5s%<00><00><08><14> <0C><14> <0C> 3<>3r )<01> metaclassc<01>><00>]tRt^VtRtRRltRRltRRltRtR #)
rz<>
Wrapper that runs auto suggestions in a thread.
(Use this to prevent the user interface from becoming unresponsive if the
generation of suggestions takes too much time.)
c<01> <00>V^8<>dQhRRRR/#)r<00> auto_suggestrrrr)rs"rr<00> ThreadedAutoSuggest.__annotate__]s<00><00>)<29>)<29>[<5B>)<29>T<EFBFBD>)r c <09><00>WnR#r"<00>rH)r$rHs&&rr%<00>ThreadedAutoSuggest.__init__]s<00><00>(<28>r c<01>$<00>V^8<>dQhRRRRRR/#r>r)rs"rrrI`s'<00><00>@<01>@<01>6<EFBFBD>@<01>X<EFBFBD>@<01>BS<42>@r c <09>8<00>VPPW4#r")rHr;rBs&&&rr;<00>"ThreadedAutoSuggest.get_suggestion`s<00><00><13> <20> <20>/<2F>/<2F><04>?<3F>?r c<01>$<00>V^8<>dQhRRRRRR/#r>r)rs"rrrIcs)<00><00>
M<01>
M<01><1A>
M<01>&.<2E>
M<01> <1A>
Mr c<00> <0A>Paaa"<00>RVVV3Rllp\V4GRjx<01>L
#L5i)z0
Run the `get_suggestion` function in a thread.
c<01><00>V^8<>dQhRR/#)rrr7r)rs"rr<00>>ThreadedAutoSuggest.get_suggestion_async.<locals>.__annotate__js<00><00> 7<> 7<>+<<3C> 7r c<01>(<<03>SPSS4#r"rA)r?r6r$s<00><><EFBFBD>r<00>run_get_suggestion_thread<61>KThreadedAutoSuggest.get_suggestion_async.<locals>.run_get_suggestion_threadjs<00><><00><17>&<26>&<26>t<EFBFBD>X<EFBFBD>6<> 6r Nr)r$r?r6rUsfff rrC<00>(ThreadedAutoSuggest.get_suggestion_asynccs$<00><><00><00> 7<> 7<>2<>2K<32>L<>L<>L<>L<>s <00>&<01>$<04>&rKN<> r,r-r.r/r0r%r;rCr1rr rrrVs<00><00><08> )<29>@<01>
M<01>
Mr c<01>&<00>]tRt^ptRtRRltRtR#)rz7
AutoSuggest class that doesn't return any suggestion.
c<01>$<00>V^8<>dQhRRRRRR/#r4r)rs"rr<00>DummyAutoSuggest.__annotate__us"<00><00><14><14>V<EFBFBD><14>x<EFBFBD><14>DU<44>r c <09><00>R#r"rr:s&&&rr;<00>DummyAutoSuggest.get_suggestionus<00><00>r rN<>r,r-r.r/r0r;r1rr rrrps<00><00><08><14>r c<01>&<00>]tRt^ytRtRRltRtR#)rz5
Give suggestions based on the lines in the history.
c<01>$<00>V^8<>dQhRRRRRR/#r4r)rs"rr<00>#AutoSuggestFromHistory.__annotate__~s"<00><00><14><14>V<EFBFBD><14>x<EFBFBD><14>DU<44>r c <09><><00>VPpVPPR^4R,pVP4'd|\ \ VP 444FUp\ VP44F5pVPV4'gK\V\V4R4uu# KW R#)<03>
N<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>) <0B>historyr<00>rsplit<69>strip<69>reversed<65>list<73> get_strings<67>
splitlines<EFBFBD>
startswithr <00>len)r$r5r6rer<00>string<6E>lines&&& rr;<00>%AutoSuggestFromHistory.get_suggestion~s<><00><00><18>.<2E>.<2E><07><18>}<7D>}<7D>#<23>#<23>D<EFBFBD>!<21>,<2C>R<EFBFBD>0<><04> <10>:<3A>:<3A><<3C><<3C>"<22>4<EFBFBD><07>(;<3B>(;<3B>(=<3D>#><3E>?<3F><06>$<24>V<EFBFBD>%6<>%6<>%8<>9<>D<EFBFBD><1B><EFBFBD><EFBFBD>t<EFBFBD>,<2C>,<2C>)<29>$<24>s<EFBFBD>4<EFBFBD>y<EFBFBD>{<7B>*;<3B><<3C><<3C>:<3A>@<01>
r rNr^rr rrrys<00><00><08><14>r c<01>2<00>]tRt^<5E>tRtRRltRRltRtR#)rzM
Auto suggest that can be turned on and of according to a certain condition.
c<01>$<00>V^8<>dQhRRRRRR/#)rrHr<00>filterz bool | Filterrrr)rs"rr<00>#ConditionalAutoSuggest.__annotate__<5F>s!<00><00>(<28>(<28>[<5B>(<28>-<2D>(<28>D<EFBFBD>(r c <09>2<00>Wn\V4VnR#r")rHr rs)r$rHrss&&&rr%<00>ConditionalAutoSuggest.__init__<5F>s<00><00>(<28><19><1F><06>'<27><04> r c<01>$<00>V^8<>dQhRRRRRR/#r4r)rs"rrrt<00>s"<00><00><14><14>V<EFBFBD><14>x<EFBFBD><14>DU<44>r c <09>h<00>VP4'dVPPW4#R#r")rsrHr;r:s&&&rr;<00>%ConditionalAutoSuggest.get_suggestion<6F>s'<00><00> <0F>;<3B>;<3B>=<3D>=<3D><17>$<24>$<24>3<>3<>F<EFBFBD>E<> E<>r )rHrsN)r,r-r.r/r0r%r;r1rr rrr<00>s<00><00><08>(<28><14>r c<01>><00>]tRt^<5E>tRtRRltRRltRRltRtR #)
rz<>
Validator class that can dynamically returns any Validator.
:param get_validator: Callable that returns a :class:`.Validator` instance.
c<01> <00>V^8<>dQhRRRR/#)r<00>get_auto_suggestz Callable[[], AutoSuggest | None]rrr)rs"rr<00>DynamicAutoSuggest.__annotate__<5F>s<00><00>1<>1<>)I<>1<>d<EFBFBD>1r c <09><00>WnR#r"<00>r|)r$r|s&&rr%<00>DynamicAutoSuggest.__init__<5F>s<00><00> 0<>r c<01>$<00>V^8<>dQhRRRRRR/#r>r)rs"rrr}<00>s"<00><00>;<3B>;<3B>6<EFBFBD>;<3B>X<EFBFBD>;<3B>BS<42>;r c <09>h<00>VP4;'g \4pVPW4#r")r|rr;<00>r$r?r6rHs&&& rr;<00>!DynamicAutoSuggest.get_suggestion<6F>s-<00><00><1B>,<2C>,<2C>.<2E>D<>D<>2B<32>2D<32> <0C><1B>*<2A>*<2A>4<EFBFBD>:<3A>:r c<01>$<00>V^8<>dQhRRRRRR/#r>r)rs"rrr}<00>s)<00><00>G<01>G<01><1A>G<01>&.<2E>G<01> <1A>Gr c<00> <09><>"<00>VP4;'g \4pVPW4GRjx<01>L
#L5ir")r|rrCr<>s&&& rrC<00>'DynamicAutoSuggest.get_suggestion_async<6E>s8<00><00><00><1C>,<2C>,<2C>.<2E>D<>D<>2B<32>2D<32> <0C>!<21>6<>6<>t<EFBFBD>F<>F<>F<>F<>s<00>7A<01>><04>ArNrXrr rrr<00>s<00><00><08> 1<>;<3B>G<01>Gr N)r rrrrrr)r0<00>
__future__r<00>abcrr<00>typingrr<00>prompt_toolkit.eventlooprr6r <00>filtersr
r r5r <00>__all__r rrrrrrrr r<00><module>r<>s<><00><01> <04>#<23>'<27>*<2A>A<><1E>&<26><10><1E> <02><07> *<2A> *<2A>3<>G<EFBFBD>3<>BM<01>+<2B>M<01>4<14>{<7B><14><14>[<5B><14>, <14>[<5B> <14> G<01><1B>Gr