+
    8Li                        R t ^ RIt^ RIt^ RIHtHt ^ RIHtHtH	t	H
t
HtHtHtHtHtHt ^ RIHt ]P&                  R!8  d
   ^ RIHtHt M^ RIHtHt ^ RIHt R"t]! R4      t]]R,          ]3,          t ! R	 R
]4      t ! R R]4      t ! R R]4      t  ! R R4      t!]! R]R7      t"R R lt# ! R R4      t$ ! R R]	],          4      t%]R#R R ll4       t&]R#R R ll4       t&R#R R llt&R R  lt'R# )$z$Code shared between the API classes.N)ABCabstractmethod)
AnyCallableGenericIteratorListOptionalTupleTypeVarUnionoverload)unpackb)LiteralProtocol)unicode_errors_defaultTTc                       ] tR t^tRtR# )	NvimError N)__name__
__module____qualname____firstlineno____static_attributes__r       3/usr/lib/python3/dist-packages/pynvim/api/common.pyr   r      s    r   r   c                   2   a  ] tR t^t o V 3R lR ltRtV tR# )IRemotec                2   < V ^8  d   QhRS[ RS[RS[RS[/#    nameargskwargsreturnstrr   )format__classdict__s   "r   __annotate__IRemote.__annotate__   s)     " "C " "s "s "r   c                    \         hNNotImplementedErrorselfr"   r#   r$   s   &&*,r   requestIRemote.request   s    !!r   r   N)r   r   r   r   r2   r   __classdictcell__r)   s   @r   r   r      s     " "r   r   c                      a  ] tR t^ t o RtV 3R lR lt]]V 3R lR l4       4       tV 3R lR lt	V 3R lR	 lt
V 3R
 lR ltV 3R lR ltRtV tR# )RemotezBase class for Nvim objects(buffer/window/tabpage).

Each type of object has it's own specialized class with API wrappers around
the msgpack-rpc session. This implements equality which takes the remote
object handle into consideration.
c                <   < V ^8  d   QhRS[ RS[S[S[3,          /# )r!   session	code_data)r   r
   intr   )r(   r)   s   "r   r*   Remote.__annotate__)   s'     B B BE#s(O Br   c                p   Wn         W n        \        V^,          4      V n        \	        W P
                  4      V n        \        W P
                  R,           V P
                  R,           V P
                  R,           4      V n        \        W P
                  R,           V P
                  R,           4      V n	        R# )zInitialize from session and code_data immutable object.

The `code_data` contains serialization information required for
msgpack-rpc calls. It must be immutable for Buffer equality to work.
get_varset_vardel_var
get_option
set_optionN)
_sessionr:   r   handle	RemoteApi_api_prefixapi	RemoteMapvarsoptions)r1   r9   r:   s   &&&r   __init__Remote.__init__)   s      "il+T#3#34d$4$4y$@"..:"..:<	 !'7'7,'F!%!1!1L!@Br   c                    < V ^8  d   QhRS[ /# r!   r%   r'   )r(   r)   s   "r   r*   r<   ;   s     $ $S $r   c                    \        4       hr-   r.   r1   s   &r   rF   Remote._api_prefix9   s     "##r   c                    < V ^8  d   QhRS[ /# rN   rO   )r(   r)   s   "r   r*   r<   >   s     
 
# 
r   c                T    RV P                   P                  : RV P                  : R2# )z&Get text representation of the object.<z(handle=z)>)	__class__r   rD   rQ   s   &r   __repr__Remote.__repr__>   s"     NN##KK
 	
r   c                &   < V ^8  d   QhRS[ RS[/# )r!   otherr%   )r   bool)r(   r)   s   "r   r*   r<   E   s     7 7C 7D 7r   c                \    \        VR4      ;'       d    VP                  V P                  8H  # )z6Return True if `self` and `other` are the same object.r:   )hasattrr:   )r1   rZ   s   &&r   __eq__Remote.__eq__E   s+    {+ 6 6OOt~~5	7r   c                    < V ^8  d   QhRS[ /# rN   r;   )r(   r)   s   "r   r*   r<   J   s     ) )# )r   c                6    V P                   P                  4       # )z&Return hash based on remote object id.)r:   __hash__rQ   s   &r   rc   Remote.__hash__J   s    ~~&&((r   c                2   < V ^8  d   QhRS[ RS[RS[RS[/# r    r&   )r(   r)   s   "r   r*   r<   N   s/     B BC B Bs Bs Br   c                B    V P                   P                  ! W.VO5/ VB # )zWrapper for nvim.request.)rC   r2   r0   s   &&*,r   r2   Remote.requestN   s!    }}$$TA$A&AAr   )rC   rG   r:   rD   rJ   rI   N)r   r   r   r   __doc__rK   propertyr   rF   rW   r^   rc   r2   r   r4   r5   s   @r   r7   r7       s\     B B  $  $
 
7 7
) )B Br   r7   c                   H   a  ] tR t^St o RtV 3R lR ltV 3R lR ltRtV tR# )rE   z>Wrapper to allow api methods to be called like python methods.c                &   < V ^8  d   QhRS[ RS[/# )r!   obj
api_prefixr   r'   )r(   r)   s   "r   r*   RemoteApi.__annotate__V   s     & &G & &r   c                    Wn         W n        R# )z2Initialize a RemoteApi with object and api prefix.N)_objrF   )r1   rl   rm   s   &&&r   rK   RemoteApi.__init__V   s    	%r   c                :   < V ^8  d   QhRS[ RS[RS[3,          /# )r!   r"   r%   .)r'   r   r   )r(   r)   s   "r   r*   ro   [   s(     M M Mc(: Mr   c                z    \         P                  ! V P                  P                  V P                  V,           4      # )z#Return wrapper to named api method.)	functoolspartialrq   r2   rF   )r1   r"   s   &&r   __getattr__RemoteApi.__getattr__[   s*      !2!2D4D4Dt4KLLr   )rF   rq   N)	r   r   r   r   rh   rK   rw   r   r4   r5   s   @r   rE   rE   S   s     H& &
M Mr   rE   E)boundc                R    V ^8  d   QhR\         R\        \         \        3,          /# )r!   excr%   )ry   r   KeyError)r(   s   "r   r*   r*   c   s#      A %8"4 r   c                 B   \        V \        4      '       d   V P                  ^ ,          P                  R4      '       d   \	        V P                  ^ ,          4      # V P                  ^ ,          P                  R4      '       d   \	        V P                  ^ ,          4      # V # )    zKey not found:zInvalid option name:)
isinstancer   r#   
startswithr}   )r|   s   &r   transform_keyerrorr   c   sn    #y!!88A;!!"233CHHQK((88A;!!"899CHHQK((Jr   c                      a  ] tR t^lt o RtRtRtRV 3R lR lltV 3R lR ltV 3R lR lt	V 3R	 lR
 lt
V 3R lR lt]V 3R lR l4       t]RV 3R lR ll4       tRV 3R lR lltRtV tR# )rH   a"  Represents a string->object map stored in Nvim.

This is the dict counterpart to the `RemoteSequence` class, but it is used
as a generic way of retrieving values from the various map-like data
structures present in Nvim.

It is used to provide a dict-like API to vim variables and options.
Nc          	      R   < V ^8  d   QhRS[ RS[RS[S[,          RS[S[,          /# )r!   rl   
get_method
set_method
del_method)r   r'   r	   )r(   r)   s   "r   r*   RemoteMap.__annotate__y   sA     C CC C SM	C
 SMCr   c                   \         P                  ! VP                  V4      V n        V'       d'   \         P                  ! VP                  V4      V n        V'       d)   \         P                  ! VP                  V4      V n        R# R# )z3Initialize a RemoteMap with session, getter/setter.N)ru   rv   r2   _get_set_del)r1   rl   r   r   r   s   &&&&&r   rK   RemoteMap.__init__y   sW     %%ckk:>	!))#++zBDI!))#++zBDI r   c                &   < V ^8  d   QhRS[ RS[/# r!   keyr%   r&   )r(   r)   s   "r   r*   r      s     * *s *s *r   c                b     V P                  V4      #   \         d   p\        T4      hRp?ii ; i)zReturn a map value by key.N)r   r   r   r1   r   r|   s   && r   __getitem__RemoteMap.__getitem__   s0    	*99S>! 	*$S))	*s    .).c                *   < V ^8  d   QhRS[ RS[RR/# )r!   r   valuer%   Nr&   )r(   r)   s   "r   r*   r      s"      s 3 4 r   c                b    V P                   '       g   \        R4      hV P                  W4       R# )z3Set a map value by key(if the setter was provided).This dict is read-onlyN)r   	TypeError)r1   r   r   s   &&&r   __setitem__RemoteMap.__setitem__   s#    yyy455		#r   c                $   < V ^8  d   QhRS[ RR/# )r!   r   r%   NrO   )r(   r)   s   "r   r*   r      s     * *s *t *r   c                    V P                   '       g   \        R4      h V P                  V4      #   \         d   p\        T4      hRp?ii ; i)z4Delete a map value by associating None with the key.r   N)r   r   r   r   r   s   && r   __delitem__RemoteMap.__delitem__   sE    yyy455	*99S>! 	*$S))	*s   0 AAAc                &   < V ^8  d   QhRS[ RS[/# r   )r'   r[   )r(   r)   s   "r   r*   r      s        r   c                N     V P                  V4       R#   \         d     R# i ; i)z#Check if key is present in the map.TF)r   	Exception)r1   r   s   &&r   __contains__RemoteMap.__contains__   s'    	IIcN 		s    $$c                ,   < V ^8  d   QhRS[ RS[RS[/# r!   r   defaultr%   )r'   r   )r(   r)   s   "r   r*   r      s    11s1Q111r   c                    R # r-   r   r1   r   r   s   &&&r   getRemoteMap.get   s    .1r   c                L   < V ^8  d   QhRS[ RS[S[,          RS[S[,          /# r   r'   r	   r   )r(   r)   s   "r   r*   r      s     LLsLXa[LHQKLr   c                    R # r-   r   r   s   &&&r   r   r      s    ILr   c                L   < V ^8  d   QhRS[ RS[S[,          RS[S[,          /# r   r   )r(   r)   s   "r   r*   r      s*      s Xa[ HQK r   c                L     V P                  V4      #   \         d    Tu # i ; i)z6Return value for key if present, else a default value.)r   r}   r   s   &&&r   r   r      s,    	##C(( 	N	s    ##)r   r   r   )NNr-   )r   r   r   r   rh   r   r   rK   r   r   r   r   r   r   r   r4   r5   s   @r   rH   rH   l   sz      DDC C* * * *  1 1LL L  r   rH   c                      a  ] tR t^t o RtV 3R lR ltV 3R lR lt]V 3R lR l4       t]V 3R lR	 l4       tV 3R
 lR ltV 3R lR lt	V 3R lR lt
RtV tR# )RemoteSequencead  Represents a sequence of objects stored in Nvim.

This class is used to wrap msgpack-rpc functions that work on Nvim
sequences(of lines, buffers, windows and tabpages) with an API that
is similar to the one provided by the python-vim interface.

For example, the 'windows' property of the `Nvim` class is a RemoteSequence
sequence instance, and the expression `nvim.windows[0]` is translated to
session.request('nvim_list_wins')[0].

One important detail about this class is that all methods will fetch the
sequence into a list and perform the necessary manipulation
locally(iteration, indexing, counting, etc).
c                &   < V ^8  d   QhRS[ RS[/# )r!   r9   methodrn   )r(   r)   s   "r   r*   RemoteSequence.__annotate__   s     A A A Ar   c                R    \         P                  ! VP                  V4      V n        R# )z1Initialize a RemoteSequence with session, method.N)ru   rv   r2   _fetch)r1   r9   r   s   &&&r   rK   RemoteSequence.__init__   s    ''@r   c                    < V ^8  d   QhRS[ /# rN   ra   )r(   r)   s   "r   r*   r      s     " " "r   c                4    \        V P                  4       4      # )z)Return the length of the remote sequence.)lenr   rQ   s   &r   __len__RemoteSequence.__len__   s    4;;=!!r   c                &   < V ^8  d   QhRS[ RS[/# r!   idxr%   )r;   r   )r(   r)   s   "r   r*   r      s    --s-q-r   c                    R # r-   r   r1   r   s   &&r   r   RemoteSequence.__getitem__   s    *-r   c                6   < V ^8  d   QhRS[ RS[S[,          /# r   )slicer   r   )r(   r)   s   "r   r*   r      s    55u5a5r   c                    R # r-   r   r   s   &&r   r   r      s    25r   c                b   < V ^8  d   QhRS[ S[S[3,          RS[ S[S[S[,          3,          /# r   )r   r   r;   r   r   )r(   r)   s   "r   r*   r      s1     1 1uUCZ0 1U1d1g:5F 1r   c                    \        V\        4      '       g   V P                  4       V,          # V P                  4       VP                  VP                   # )z Return a sequence item by index.)r   r   r   startstopr   s   &&r   r   r      s;    #u%%;;=%%{{}SYYsxx00r   c                0   < V ^8  d   QhRS[ S[,          /# rN   )r   r   )r(   r)   s   "r   r*   r      s      (1+ r   c              #  H   "   V P                  4       pV F  pVx  K	  	  R# 5i)z$Return an iterator for the sequence.Nr   )r1   itemsitems   &  r   __iter__RemoteSequence.__iter__   s     DJ s    "c                &   < V ^8  d   QhRS[ RS[/# )r!   r   r%   )r   r[   )r(   r)   s   "r   r*   r      s     % % %t %r   c                &    WP                  4       9   # )z,Check if an item is present in the sequence.r   )r1   r   s   &&r   r   RemoteSequence.__contains__   s    {{}$$r   r   N)r   r   r   r   rh   rK   r   r   r   r   r   r   r4   r5   s   @r   r   r      s\     A A" " - -5 51 1 % %r   r   c                <    V ^8  d   QhR\         R\        R\        /# r!   rl   moder%   )bytesTDecodeModer'   )r(   s   "r   r*   r*      s     E E Ek ES Er   c                     R # r-   r   rl   r   s   &&r   decode_if_bytesr      s    BEr   c                ^    V ^8  d   QhR\         R\        R\        \         \        3,          /# r   r   r   r   r'   )r(   s   "r   r*   r*      s     K K K+ Kq#v Kr   c                     R # r-   r   r   s   &&r   r   r      s    HKr   c                ^    V ^8  d   QhR\         R\        R\        \         \        3,          /# r   r   )r(   s   "r   r*   r*      s)       + q#v r   c                p    VRJ d   \         p\        V \        4      '       d   V P                  RVR7      # V # )zDecode obj if it is bytes.Tzutf-8)errors)r   r   r   decoder   s   &&r   r   r      s3    t|%#uzz'$z//Jr   c                `    V ^8  d   QhR\         \        .\        3,          R\        R\        /# )r!   fnrl   r%   )r   r   )r(   s   "r   r*   r*      s,      XseSj!   r   c           	        \        V4      pV\        J g   V\        J d   V Uu. uF  p\        W4      NK  	  up# V\        J d8   VP                  4        UUu/ uF  w  rE\        W4      \        W4      bK  	  upp# V ! V4      # u upi u uppi )z:Recursively walk an object graph applying `fn` to objects.)typelisttuplewalkdictr   )r   rl   type_okvs   &&    r   r   r      su    
 IE}%()SRS))}58YY[A[TQRT"[([AAc7N *As   B B	)      r   )T)(rh   ru   sysabcr   r   typingr   r   r   r   r   r	   r
   r   r   r   msgpackr   version_infotyping_extensionsr   r   pynvim.compatr   __all__r   r'   r   r   r   r   r7   rE   ry   r   rH   r   r   r   r   r   r   <module>r      s    *  
 #% % % f33( 0
 CLGDM3&'		 	"h "
0BS 0Bf
M 
M Cy!D DN-%WQZ -%` 
 E 
 E 
 K 
 Kr   