+
    8i2                    B   R t ^ RIHt ^ RIHt ^ RIHtHtHtH	t	H
t
HtHtHt ^ RIHtHt ^ RIHt ^ RIHtHtHt ^ RIHtHtHtHt ^ RIHt ^ R	IHtH t  ^ R
I!H"t"H#t#H$t$ ]'       d   ^ RI%H&t& ^ RI'H(t( ^ RI)H*t* Rt+ ! R R] ]$,          4      t, ! R R],]$,          4      t-R# )z4CommandCursor class to iterate over command results.)annotations)deque)TYPE_CHECKINGAnyIteratorMappingNoReturnOptionalSequenceUnion)CodecOptions&_convert_raw_document_lists_to_streams)_CURSOR_CLOSED_ERRORS)ConnectionFailureInvalidOperationOperationFailure)_GetMore_OpMsg_OpReply_RawBatchGetMore)PinnedResponse)_ConnectionManager_CursorBase)_Address_DocumentOut_DocumentType)ClientSession)
Collection)
ConnectionTc                      ] tR t^.tRt]tR&R R lltR R ltR R lt	R	 R
 lt
]R R l4       tR R ltR'R R lltR R ltR R ltR R ltR R ltR R ltR R ltR R ltR R  ltR(R! R" lltR# R$ ltR%tR# ))CommandCursorz)A cursor / iterator over command cursors.Nc               8    V ^8  d   QhRRRRRRRRR	R
RRRRRR/#    
collectionzCollection[_DocumentType]cursor_infozMapping[str, Any]addresszOptional[_Address]
batch_sizeintmax_await_time_msOptional[int]sessionzOptional[ClientSession]commentr   returnNone )formats   "`/var/www/html/photoedit/myenv/lib/python3.14/site-packages/pymongo/synchronous/command_cursor.py__annotate__CommandCursor.__annotate__3   sZ     ( (-( '( $	(
 ( )( )( ( 
(    c                   RV n         Wn        VR,          V n        \        VR,          4      V n        VP                  R4      V n        W0n        W@n        WPn	        V P                  P                  P                  P                  P                  V n        W`n        V P                  e   RV P                  n        V P                  ^ 8H  V n        Wpn        V P"                  '       d   V P'                  4        RV9   d   VR,          V n        MVP*                  V n        V P-                  V4       \/        V\0        4      '       g   Ve   \3        R\5        V4       24      hR# R# )zCreate a new command cursor.Nid
firstBatchpostBatchResumeTokenTnsz2max_await_time_ms must be an integer or None, not )	_sock_mgr_collection_idr   _dataget_postbatchresumetoken_address_batch_size_max_await_time_msdatabaseclientoptionstimeout_timeout_session_attached_to_cursor_killed_comment_end_session_ns	full_namer'   
isinstancer(   	TypeErrortype)selfr$   r%   r&   r'   r)   r+   r,   s   &&&&&&&&r1   __init__CommandCursor.__init__3   s'    #6@t$;|45
BM//"C
"  %"3((1188@@HH==$04DMM-xx1}<<<;"4(DH!++DH
#+S116G6SDTJ[E\D]^  7T1r4   c                   V ^8  d   QhRR/# )r#   r-   strr/   )r0   s   "r1   r2   r3   ]   s       r4   c                	    V P                   # N)rM   rR   s   &r1   _get_namespaceCommandCursor._get_namespace]   s    xxr4   c                    V ^8  d   QhRRRR/# )r#   r'   r(   r-   CommandCursor[_DocumentType]r/   )r0   s   "r1   r2   r3   `   s      S -I r4   c                    \        V\        4      '       g   \        R\        V4       24      hV^ 8  d   \	        R4      hV^8H  ;'       d    ^;'       g    TV n        V # )aa  Limits the number of documents returned in one batch. Each batch
requires a round trip to the server. It can be adjusted to optimize
performance and limit data transfer.

.. note:: batch_size can not override MongoDB's internal limits on the
   amount of data it will return to the client in a single batch (i.e
   if you set batch size to 1,000,000,000, MongoDB will currently only
   return 4-16MB of results per batch).

Raises :exc:`TypeError` if `batch_size` is not an integer.
Raises :exc:`ValueError` if `batch_size` is less than ``0``.

:param batch_size: The size of each batch of results requested.
z#batch_size must be an integer, not zbatch_size must be >= 0)rO   r(   rP   rQ   
ValueErrorrA   )rR   r'   s   &&r1   r'   CommandCursor.batch_size`   s^     *c**A$zBRASTUU>677%?00q>>Jr4   c                   V ^8  d   QhRR/# )r#   r-   boolr/   )r0   s   "r1   r2   r3   w   s     # #4 #r4   c                2    \        V P                  4      ^ 8  # )zNReturns `True` if the cursor has documents remaining from the
previous batch.
)lenr=   rY   s   &r1   	_has_nextCommandCursor._has_nextw   s     4::""r4   c                   V ^8  d   QhRR/# )r#   r-   Optional[Mapping[str, Any]]r/   )r0   s   "r1   r2   r3   ~   s     * **E *r4   c                    V P                   # )z\Retrieve the postBatchResumeToken from the response to a
changeStream aggregate or getMore.
)r?   rY   s   &r1   _post_batch_resume_token&CommandCursor._post_batch_resume_token}   s    
 )))r4   c                    V ^8  d   QhRRRR/# )r#   connr   r-   r.   r/   )r0   s   "r1   r2   r3      s     * ** * *r4   c                	>   V P                   P                  P                  pVP                  V P                  4      '       g   R # V P
                  '       gH   VP                  4        \        VR4      pV P                  ^ 8X  d   VP                  4        R # W0n        R # R # NF)
r;   rC   rD   _should_pin_cursorrH   r:   
pin_cursorr   r<   close)rR   rm   rD   conn_mgrs   &&  r1   _maybe_pin_connection#CommandCursor._maybe_pin_connection   sq    !!**11((77~~~OO)$6H xx1} !) r4   c               0    V ^8  d   QhRRRRRRRRR	R
RR/# )r#   responseUnion[_OpReply, _OpMsg]	cursor_idr*   codec_optionszCodecOptions[Mapping[str, Any]]user_fieldsrh   legacy_responserb   r-   zSequence[_DocumentOut]r/   )r0   s   "r1   r2   r3      sN     ` `)` !` 7	`
 1` ` 
 `r4   c                	&    VP                  W#WE4      # rX   )unpack_response)rR   rw   ry   rz   r{   r|   s   &&&&&&r1   _unpack_responseCommandCursor._unpack_response   s     ''	+__r4   c                   V ^8  d   QhRR/# )r#   r-   r.   r/   )r0   s   "r1   r2   r3      s     ! !d !r4   c                	    V P                   '       dS   V P                   P                  '       d5   R V P                   n        V P                   P                  4        RV n         R# R# R# )FN)rH   	_implicitrI   _end_implicit_sessionrY   s   &r1   rL   CommandCursor._end_session   sD    ===T]]44405DMM-MM//1 DM 5=r4   c                    V ^8  d   QhRRRR/# )r#   	operationr   r-   r.   r/   )r0   s   "r1   r2   r3      s     *& *&x *&D *&r4   c                   V P                   P                  P                  p VP                  WP                  V P
                  R7      p\        T\         4      '       d8   T P"                  '       g&   \%        TP&                  TP(                  4      T n        TP*                  '       dI   TP,                  ^ ,          R,          pTR,          pTP/                  R4      T n        TR,          T n        MITP,                  p\        TP4                  \6        4      '       g   Q hTP4                  P8                  T n        T P2                  ^ 8X  d   T P                  4        \;        T4      T n        R#   \         dV   pTP                  \        9   d   RT n	        TP                  '       d   T P                  4        h T P                  4        h Rp?i\         d    RT n	        T P                  4        h \         d    T P                  4        h i ; i)z/Send a getmore message and handle the response.)r&   TNcursor	nextBatchr8   r6   )r;   rC   rD   _run_operationr   r@   r   coder   rJ   rF   _die_no_lockrr   r   	ExceptionrO   r   r:   r   rm   more_to_comefrom_commanddocsr>   r?   r<   datar   ry   r   r=   )rR   r   rD   rw   excr   	documentss   &&     r1   _send_messageCommandCursor._send_message   s   !!**11	,,00$-- - H. h//>>>!3HMM8CXCX!Y   ]]1%h/F{+I)/4J)KD&d|DH IhmmX6666}}..DH88q=JJL9%
G   		xx00#{{{!!#  

  	DLJJL 	JJL	s)   'E, ,H	7-G%"GH	!H	6H	c                   V ^8  d   QhRR/# )r#   r-   r(   r/   )r0   s   "r1   r2   r3      s        #  r4   c                   \        V P                  4      '       g   V P                  '       d   \        V P                  4      # V P                  '       d   V P                  P                  R^4      w  rV P                  P                  V P                  4      pV P                  V P                  VVV P                  V P                  V P                  P                  VV P                  V P                  P                  P                  V P                   V P"                  RV P$                  4      4       MV P'                  4        \        V P                  4      # )zRefreshes the cursor with more data from the server.

Returns the length of self._data after refresh. Will exit early if
self._data is already non-empty. Raises OperationFailure when the
cursor cannot be refreshed due to an error on the query.
.F)rd   r=   rJ   r<   rM   splitr;   _read_preference_forr+   r   _getmore_classrA   rz   rH   rC   rD   rB   r:   rK   	_die_lock)rR   dbnamecollname	read_prefs   &   r1   _refreshCommandCursor._refresh   s     tzz??dllltzz?"888#xx~~c15F((==dllKI##$$HH$$22MM$$--44++NNMM" NN4::r4   c                   V ^8  d   QhRR/# )r#   r-   zIterator[_DocumentType]r/   )r0   s   "r1   r2   r3      s      1 r4   c                	    V # rX   r/   rY   s   &r1   __iter__CommandCursor.__iter__       r4   c                   V ^8  d   QhRR/# )r#   r-   r]   r/   )r0   s   "r1   r2   r3      s      7 r4   c                	    V # rX   r/   rY   s   &r1   	__enter__CommandCursor.__enter__   r   r4   c                   V ^8  d   QhRR/# r#   r-   r   r/   )r0   s   "r1   r2   r3      s      m r4   c                d    V P                   '       d   V P                  R4      pVf   K)  V# \        h)zAdvance the cursor.T)alive	_try_nextStopIteration)rR   docs   & r1   nextCommandCursor.next   s+     jjj..&C
r4   c                   V ^8  d   QhRR/# r   r/   )r0   s   "r1   r2   r3      s      - r4   c                	"    V P                  4       # rX   )r   rY   s   &r1   __next__CommandCursor.__next__   s    yy{r4   c                    V ^8  d   QhRRRR/# )r#   get_more_allowedrb   r-   Optional[_DocumentType]r/   )r0   s   "r1   r2   r3     s      $ 3J r4   c                    \        V P                  4      '       g+   V P                  '       g   V'       d   V P                  4        \        V P                  4      '       d   V P                  P	                  4       # R# )z<Advance the cursor blocking for at most one getMore command.N)rd   r=   rJ   r   popleft)rR   r   s   &&r1   r   CommandCursor._try_next  sF    4::t|||8HMMOtzz??::%%''r4   c               $    V ^8  d   QhRRRRRR/# )r#   resultlisttotalr*   r-   rb   r/   )r0   s   "r1   r2   r3     s!      $ }  r4   c                   \        V P                  4      '       g#   V P                  '       g   V P                  4        \        V P                  4      '       d   Vf8   VP	                  V P                  4       V P                  P                  4        R# \        \        \        V P                  4      V4      4       F,  pVP                  V P                  P                  4       4       K.  	  R# R# )z4Get all or some available documents from the cursor.TF)
rd   r=   rJ   r   extendclearrangeminappendr   )rR   r   r   _s   &&& r1   _next_batchCommandCursor._next_batch  s    4::t|||MMOtzz??}djj)

  "  s3tzz?E:;AMM$**"4"4"67 <r4   c                   V ^8  d   QhRR/# )r#   r-   r   r/   )r0   s   "r1   r2   r3     s     5 51 5r4   c                &    V P                  RR7      # )a"  Advance the cursor without blocking indefinitely.

This method returns the next document without waiting
indefinitely for data.

If no document is cached locally then this method runs a single
getMore command. If the getMore yields any documents, the next
document is returned, otherwise, if the getMore returns no documents
(because there is no additional data) then ``None`` is returned.

:return: The next document or ``None`` when no document is available
  after running a single getMore or when the cursor is closed.

.. versionadded:: 4.5
T)r   )r   rY   s   &r1   try_nextCommandCursor.try_next  s      ~~t~44r4   )r@   rA   r;   rK   r=   r<   rJ   rB   rM   r?   rH   r:   rG       NNNro   rX   )__name__
__module____qualname____firstlineno____doc__r   r   rS   rZ   r'   re   propertyrj   rt   r   rL   r   r   r   r   r   r   r   r   r   __static_attributes__r/   r4   r1   r    r    .   sw    3N(T.# * **`!*&X D5 5r4   r    c                  R   a  ] tR tRt]tR	R V 3R llltR
R R lltR R ltRt	V ;t
# )RawBatchCommandCursori.  c               8    V ^8  d   QhRRRRRRRRR	R
RRRRRR/# r"   r/   )r0   s   "r1   r2   "RawBatchCommandCursor.__annotate__1  sZ     
 
-
 '
 $	

 
 )
 )
 
 

r4   c           	     d   < VP                  R4      '       d   Q h\        SV `	  VVVVVVV4       R# )a$  Create a new cursor / iterator over raw batches of BSON data.

Should not be called directly by application developers -
see :meth:`~pymongo.collection.Collection.aggregate_raw_batches`
instead.

.. seealso:: The MongoDB documentation on `cursors <https://dochub.mongodb.org/core/cursors>`_.
r7   N)r>   superrS   )	rR   r$   r%   r&   r'   r)   r+   r,   	__class__s	   &&&&&&&&r1   rS   RawBatchCommandCursor.__init__1  s<    $ ??<0000	
r4   c               0    V ^8  d   QhRRRRRRRRR	R
RR/# )r#   rw   rx   ry   r*   rz   zCodecOptions[dict[str, Any]]r{   rh   r|   rb   r-   zlist[Mapping[str, Any]]r/   )r0   s   "r1   r2   r   N  sF      ) ! 4	
 1  
!r4   c                	^    VP                  W$R 7      pV'       g   \        V^ ,          4       V# ))r{   )raw_responser   )rR   rw   ry   rz   r{   r|   r   s   &&&&&& r1   r   &RawBatchCommandCursor._unpack_responseN  s.      ,,Y,P 3<?Cr4   c                    V ^8  d   QhRRRR/# )r#   indexr(   r-   r   r/   )r0   s   "r1   r2   r   ]  s     S S S Sr4   c                	    \        R 4      h)z0Cannot call __getitem__ on RawBatchCommandCursor)r   )rR   r   s   &&r1   __getitem__!RawBatchCommandCursor.__getitem__]  s    QRRr4   r/   r   ro   )r   r   r   r   r   r   rS   r   r   r   __classcell__)r   s   @r1   r   r   .  s#    %N
 
:S Sr4   r   N).r   
__future__r   collectionsr   typingr   r   r   r   r   r	   r
   r   bsonr   r   pymongo.cursor_sharedr   pymongo.errorsr   r   r   pymongo.messager   r   r   r   pymongo.responser   pymongo.synchronous.cursor_baser   r   pymongo.typingsr   r   r   "pymongo.synchronous.client_sessionr   pymongo.synchronous.collectionr   pymongo.synchronous.poolr   _IS_SYNCr    r   r/   r4   r1   <module>r      sx    ; " 	 	 	 F 7 P P H H + K A A@93}5K. }5@0SM-8 0Sr4   