
    ]h                         d dl Z d dlmZmZmZmZmZmZmZ d dl	Z	ddl
mZ  e	j                  e      Z ed      Z ed      Z G d deee            Z G d	 d
ee         Zy)    N)CallableOptionalTypeVarIteratorIterableTupleAny   )
AzureError
ReturnTypeResponseTypec            
           e Zd Z	 d	deee   gef   deegeeee	   f   f   dee   fdZ
deee	      fdZdee	   fdZeZy)
PageIteratorNget_nextextract_datacontinuation_tokenc                 X    || _         || _        || _        d| _        d| _        d| _        y)aY  Return an 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)selfr   r   r   s       W/var/www/core.comfia.cic-ware.com/crm/lib/python3.12/site-packages/azure/core/paging.py__init__zPageIterator.__init__0   s2     ")"4#( 15=A    returnc                     | S N r   s    r   __iter__zPageIterator.__iter__D       r   c                 p   | j                   | j                  rt        d      	 | j                  | j                         | _        d| _        | j                  | j                        \  | _         | _        t        | j                        S # t
        $ r#}|j                   s| j                   |_          d }~ww xY w)NzEnd of pagingT)	r   r   StopIterationr   r   r   r   r   iter)r   errors     r   __next__zPageIterator.__next__G   s    ""*t/G/G00	!^^D,C,CDDN $( 6:6H6H6X3!3D&&''  	+++/+B+B(	s    B	 		B5B00B5r   )__name__
__module____qualname__r   r   strr   r   r   r   r   r   r"   r(   nextr    r   r   r   r   /   s    
 -1	BHSM?L89B ~uS(::N5N/OOPB %SM	B((8J#78 ((:. (  Dr   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
dee   fd	Zdefd
ZeZy)	ItemPagedargskwargsr   Nc                 x    || _         || _        d| _        | j                  j                  dt              | _        y)zReturn an iterator of items.

        args and kwargs will be passed to the PageIterator constructor directly,
        except page_iterator_class
        Npage_iterator_class)_args_kwargs_page_iteratorpopr   _page_iterator_class)r   r0   r1   s      r   r   zItemPaged.__init__[   s4     
>B$(LL$4$45JL$Y!r   r   c                 R     | j                   | j                  d|i| j                  S )a  Get an iterator of pages of objects, instead of an 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 iterator of pages (themselves iterator of objects)
        :rtype: iterator[iterator[ReturnType]]
        r   )r8   r4   r5   )r   r   s     r   by_pagezItemPaged.by_pagef   s0     )t((QUQ[Q[l<Nl_c_k_kllr   c                 H    dj                  t        t        |                   S )Nz3<iterator object azure.core.paging.ItemPaged at {}>)formathexidr!   s    r   __repr__zItemPaged.__repr__r   s    DKKCPRSWPXMZZr   c                     | S r   r    r!   s    r   r"   zItemPaged.__iter__u   r#   r   c                     | j                   2t        j                  j                  | j	                               | _         t        | j                         S r   )r6   	itertoolschainfrom_iterabler:   r-   r!   s    r   r(   zItemPaged.__next__x   s<    &"+//"?"?"ODD''((r   r   )r)   r*   r+   r	   r   r   r,   r   r   r:   r?   r"   r(   r-   r    r   r   r/   r/   Z   sw    	Zc 	ZS 	ZT 	Z
m(3- 
m8HU_L`Ca 
m[# [(:. )* )
 Dr   r/   )rB   typingr   r   r   r   r   r   r	   logging
exceptionsr   	getLoggerr)   _LOGGERr   r   r   r/   r    r   r   <module>rJ      sq   4     " '

H
%\"
~&(8HZ01 (V#$ #r   