
    ]h                         d dl Zd dlZd dlmZmZmZmZmZm	Z	m
Z
mZ ddlmZ  ej                  e      Z ed      Z ed      ZddgZ G d	 d
ee         Z G d deee            Z G d dee         Zy)    N)IterableAsyncIteratorTypeVarCallableTupleOptional	AwaitableAny   )
AzureError
ReturnTypeResponseTypeAsyncPageIteratorAsyncItemPagedc                   .    e Zd Zdee   ddfdZdefdZy)	AsyncListiterablereturnNc                 $    t        |      | _        y)zChange an iterable into a fake async iterator.

        Could be useful to fill the async iterator contract when you get a list.

        :param iterable: A sync iterable of T
        N)iter	_iterator)selfr   s     ]/var/www/core.comfia.cic-ware.com/crm/lib/python3.12/site-packages/azure/core/async_paging.py__init__zAsyncList.__init__3   s     h    c                 n   K   	 t        | j                        S # t        $ r}t               |d }~ww xY wwN)nextr   StopIterationStopAsyncIteration)r   errs     r   	__anext__zAsyncList.__anext__>   s4     	0'' 	0$&C/	0s   5 5	2-25)__name__
__module____qualname__r   r   r   r"    r   r   r   r   2   s&    	(*!5 	($ 	(0 0r   r   c                   z    e Zd Z	 ddeee   gee   f   deegeeee	e
   f      f   dee   ddfdZde	e
   fdZy)	r   Nget_nextextract_datacontinuation_tokenr   c                 X    || _         || _        || _        d| _        d| _        d| _        y)a_  Return an async iterator of pages.

        :param get_next: Callable that take the continuation token and return a HTTP response
        :param extract_data: Callable that take an HTTP response and return a tuple continuation token,
         list of ReturnType
        :param str continuation_token: The continuation token needed by get_next
        FN)	_get_next_extract_datar*   _did_a_call_already	_response_current_page)r   r(   r)   r*   s       r   r   zAsyncPageIterator.__init__F   s2     ")"4#( 15BFr   c                   K   | j                   | j                  rt        d      	 | j                  | j                          d {   | _        d| _        | j                  | j                         d {   \  | _         | _        t        | j                  t        j                  j                        rt        | j                        | _        | j                  S 7 # t
        $ r#}|j                   s| j                   |_          d }~ww xY w7 w)NzEnd of pagingT)r*   r.   r    r,   r/   r   r-   r0   
isinstancecollectionsabcr   r   )r   errors     r   r"   zAsyncPageIterator.__anext__Z   s     ""*t/G/G$_55	#'>>$2I2I#JJDN $( <@<N<Nt~~<^6^3!3 d((+//*B*BC!*4+=+=!>D!!! K 	+++/+B+B(	 7_sG   $DC C	C %D4D5A%DC 	D%DDDr   )r#   r$   r%   r   r   strr	   r   r   r   r   r   r"   r&   r   r   r   r   E   s    
 -1	GHSM?Il,CCDG ~ysMR\D]?]9^/__`G %SM	G
 
G("z!: "r   c                   R    e Zd ZdededdfdZ	 d	dee   deee      fdZ	defdZ
y)
r   argskwargsr   Nc                     || _         || _        d| _        d| _        | j                  j	                  dt
              | _        y)zReturn an async iterator of items.

        args and kwargs will be passed to the AsyncPageIterator constructor directly,
        except page_iterator_class
        Npage_iterator_class)_args_kwargs_page_iterator_pagepopr   _page_iterator_class)r   r8   r9   s      r   r   zAsyncItemPaged.__init__p   s<     
RV:>
$(LL$4$45JL]$^!r   r*   c                 V     | j                   | j                  i | j                  d|iS )a  Get an async iterator of pages of objects, instead of an async iterator of objects.

        :param str continuation_token:
            An opaque continuation token. This value can be retrieved from the
            continuation_token field of a previous generator object. If specified,
            this generator will begin returning results from this point.
        :returns: An async iterator of pages (themselves async iterator of objects)
        :rtype: AsyncIterator[AsyncIterator[ReturnType]]
        r*   )rA   r<   r=   )r   r*   s     r   by_pagezAsyncItemPaged.by_page|   s*     )t(($**llYkllr   c                   K   | j                   -| j                         | _         | j                          d {   S | j                  ?| j                   j                          d {   | _        | j                          d {   S 	 | j                  j                          d {   S 7 r7 F7 +7 
# t        $ r# d | _        | j                          d {  7  cY S w xY wwr   )r>   rC   r"   r?   r    )r   s    r   r"   zAsyncItemPaged.__anext__   s     &"&,,.D)))::#22<<>>DJ)))	*--/// * ?)/! 	*DJ))))	*su   5C!B*-C!%B,&C!B.C!B2 %B0&B2 )C!,C!.C!0B2 2#CCCC!CC!r   )r#   r$   r%   r
   r   r   r6   r   r   rC   r"   r&   r   r   r   r   o   sY    
_c 
_S 
_T 
_ -1m$SMm 
}Z0	1m* *r   )collections.abcr3   loggingtypingr   r   r   r   r   r   r	   r
   
exceptionsr   	getLoggerr#   _LOGGERr   r   __all__r   r   r   r&   r   r   <module>rL      s   4  	 	 	 # '

H
%\"
~& 0
10j) 0&'"mJ&?@ '"T(*]:. (*r   