Files
ServerSync/lib/prompt_toolkit/application/__pycache__/current.cpython-314.pyc

83 lines
8.2 KiB
Plaintext
Raw Normal View History

2026-02-12 02:28:23 +02:00
+
9<><39>iA<00><01>(a<00>0t$^RIHt^RIHt^RIHt^RIHtH t H
t
]'d^RI H t ^RI Ht^RIHt.ROt!R R4t]!R
]!4R 7tR ]R
&R RltRRltRRlt]RRl4t]RRRll4t]RRl4tR#)<1C>)<01> annotations)<01>contextmanager)<01>
ContextVar)<03> TYPE_CHECKING<4E>Any<6E> Generator)<01>Input)<01>Output)<01> Application<6F>
AppSessionc<01>b<00>]tRt^tRtR RRlltRRlt]RRl4t]R R
l4t R t
R#) r a-
An AppSession is an interactive session, usually connected to one terminal.
Within one such session, interaction with many applications can happen, one
after the other.
The input/output device is not supposed to change during one session.
Warning: Always use the `create_app_session` function to create an
instance, so that it gets activated correctly.
:param input: Use this as a default input for all applications
running in this session, unless an input is passed to the `Application`
explicitly.
:param output: Use this as a default output.
Nc<01>$<00>V^8<>dQhRRRRRR/#)<07><00>input<75> Input | None<6E>output<75> Output | None<6E>return<72>None<6E>)<01>formats"<22>I/tmp/pip-target-wqrk2shd/lib/python/prompt_toolkit/application/current.py<70> __annotate__<5F>AppSession.__annotate__)s$<00><00>1<>1<>!<21>1<>2?<3F>1<> <0A>1<>c <09>,<00>WnW nRVnR#<00>N<><03>_input<75>_output<75>app)<03>selfrrs&&&r<00>__init__<5F>AppSession.__init__)s<00><00><1C> <0B><1D> <0C>-1<><04>rc<01><00>V^8<>dQhRR/#)rr<00>strr)rs"rrr3s<00><00>/<2F>/<2F>#<23>/rc <09>$<00>RVP: R2#)zAppSession(app=<3D>))r!)r"s&r<00>__repr__<5F>AppSession.__repr__3s<00><00> <20><14><18><18> <0C>A<EFBFBD>.<2E>.rc<01><00>V^8<>dQhRR/#)rrr r)rs"rrr7s<00><00><1B><1B>u<EFBFBD>rc <09>Z<00>VPf^RIHpV!4VnVP#)N<><01> create_input)r<00>prompt_toolkit.input.defaultsr.)r"r.s& rr<00>AppSession.input6s"<00><00> <0F>;<3B>;<3B> <1E> B<>&<26>.<2E>D<EFBFBD>K<EFBFBD><13>{<7B>{<7B>rc<01><00>V^8<>dQhRR/#)rrr
r)rs"rrr?s<00><00><1C><1C><06>rc <09>Z<00>VPf^RIHpV!4VnVP#)N<><01> create_output)r <00>prompt_toolkit.output.defaultsr4)r"r4s& rr<00>AppSession.output>s"<00><00> <0F><<3C><<3C> <1F> D<>(<28>?<3F>D<EFBFBD>L<EFBFBD><13>|<7C>|<7C>rr<00>NN) <0B>__name__<5F>
__module__<EFBFBD> __qualname__<5F>__firstlineno__<5F>__doc__r#r)<00>propertyrr<00>__static_attributes__rrrr r s9<00><00><08> 1<>/<2F><0E><1B><0E><1B><0E><1C><0E>r<00>_current_app_session)<01>defaultzContextVar[AppSession]c<01><00>V^8<>dQhRR/#)rrr r)rs"rrrLs<00><00>&<26>&<26><1A>&rc<01>*<00>\P4#r)r?<00>getrrr<00>get_app_sessionrDLs<00><00> <1F> #<23> #<23> %<25>%rc<01><00>V^8<>dQhRR/#)rr<00>Application[Any]r)rs"rrrPs<00><00><1E><1E>!<21>rc<05>x<00>\P4pVPe VP#^RIHpV!4#)a<>
Get the current active (running) Application.
An :class:`.Application` is active during the
:meth:`.Application.run_async` call.
We assume that there can only be one :class:`.Application` active at the
same time. There is only one terminal window, with only one stdin and
stdout. This makes the code significantly easier than passing around the
:class:`.Application` everywhere.
If no :class:`.Application` is running, then return by default a
:class:`.DummyApplication`. For practical reasons, we prefer to not raise
an exception. This way, we don't have to check all over the place whether
an actual `Application` was returned.
(For applications like pymux where we can have more than one `Application`,
we'll use a work-around to handle that.)
)<01>DummyApplication)r?rCr!<00>dummyrH)<02>sessionrHs r<00>get_apprKPs2<00><00>&#<23>&<26>&<26>(<28>G<EFBFBD><0E>{<7B>{<7B><1E><16>{<7B>{<7B><1A>'<27> <1B> <1D>rc<01><00>V^8<>dQhRR/#)rrzApplication[Any] | Noner)rs"rrrls<00><00><17><17>0<>rc<05>B<00>\P4pVP#)z^
Get the current active (running) Application, or return `None` if no
application is running.
<EFBFBD>r?rCr!)rJs r<00>get_app_or_nonerOls<00><00>
#<23>&<26>&<26>(<28>G<EFBFBD> <12>;<3B>;<3B>rc<01> <00>V^8<>dQhRRRR/#)rr!rFrzGenerator[None, None, None]r)rs"rrrvs<00><00>#<23>#<23>!<21>#<23>&A<>#rc#<05><>"<00>\P4pVPpWnRx<00>W!nR# Y!ni;i5i)a<>
Context manager that sets the given :class:`.Application` active in an
`AppSession`.
This should only be called by the `Application` itself.
The application will automatically be active while its running. If you want
the application to be active in other threads/coroutines, where that's not
the case, use `contextvars.copy_context()`, or use `Application.context` to
run it in the appropriate context.
NrN)r!rJ<00> previous_apps& r<00>set_apprSus5<00><00><00>#<23>&<26>&<26>(<28>G<EFBFBD><1A>;<3B>;<3B>L<EFBFBD><15>K<EFBFBD>#<23> <0A>"<22> <0B><>l<EFBFBD> <0B>s<00>'A<01>6<00>A<01>><03>ANc<01>$<00>V^8<>dQhRRRRRR/#)rrrrrr<00>!Generator[AppSession, None, None]r)rs"rrr<00>s$<00><00>*<2A>*<2A> <17>*<2A>(5<>*<2A>&<26>*rc#<05>"<00>Vf\4PpVf\4Pp\WR7p\P V4pVx<00>\P V4R# \P T4i;i5i)z<>
Create a separate AppSession.
This is useful if there can be multiple individual ``AppSession``'s going
on. Like in the case of a Telnet/SSH server.
N<EFBFBD>rr)rDrr r r?<00>set<65>reset)rrrJ<00>tokens&& r<00>create_app_sessionr[<00>sp<00><00><00>$ <0A>}<7D><1F>!<21>(<28>(<28><05> <0A>~<7E> <20>"<22>*<2A>*<2A><06><19>u<EFBFBD>4<>G<EFBFBD> <20> $<24> $<24>W<EFBFBD> -<2D>E<EFBFBD>*<2A><15> <0A><1C>"<22>"<22>5<EFBFBD>)<29><><1C>"<22>"<22>5<EFBFBD>)<29>s<00>AB
<01>A0<00>B
<01>0B<03>B
c<01><00>V^8<>dQhRR/#)rrrUr)rs"rrr<00>s<00><00><1A><1A>%F<>rc#<05><>"<00>^RIHp^RIHpV!RR7pV!RR7p\ W#R7;_uu_4pVx<00>RRR4R# +'giR#;i5i)am
Create `AppSession` that always prefers the TTY input/output.
Even if `sys.stdin` and `sys.stdout` are connected to input/output pipes,
this will still use the terminal for interaction (because `sys.stderr` is
still connected to the terminal).
Usage::
from prompt_toolkit.shortcuts import prompt
with create_app_session_from_tty():
prompt('>')
r-r3T)<01>always_prefer_ttyrWN)r/r.r5r4r[)r.r4rr<00> app_sessions r<00>create_app_session_from_ttyr`<00>sB<00><00><00> ;<3B><<3C> <18>4<EFBFBD> 0<>E<EFBFBD> <1A>T<EFBFBD> 2<>F<EFBFBD> <1B>%<25> 7<> 7<>;<3B><19><19>
8<EFBFBD> 7<> 7<> 7<>s<00>3A<01>A<05>
A<01> A <09> A)r rDrKrOrSr[r`r7)<1B>__conditional_annotations__<5F>
__future__r<00>
contextlibr<00> contextvarsr<00>typingrrr<00>prompt_toolkit.input.baser <00>prompt_toolkit.output.baser
<00> applicationr <00>__all__r r?<00>__annotations__rDrKrOrSr[r`)ras@r<00><module>rks<><00><><01>"<22>"<22>%<25>"<22>0<>0<><10>/<2F>1<>(<28> <02><07>,<1C>,<1C>^0:<3A><1A>J<EFBFBD>L<EFBFBD>0<02><14>,<2C><02>
&<26><1E>8<17><10>#<23><10>#<23>*<10>*<2A><10>*<2A>@<10><1A><10>r