+
    }i$                        ^ RI Ht ^ RIHtHt ^ RIHt ^ RIHt ^ RI	H
t
 ]'       d   ^ RIHt ^ RIHtHt ^ RIHt ]
! R	4       ! R
 R]4      4       tR# )    )annotations)ABCabstractmethod)TYPE_CHECKING)Request)
docs_group)Sequence)RequestManagerRequestManagerTandem)ProcessedRequestzRequest loadersc                      ] tR t^tRt]R R l4       t]R R l4       t]R R l4       t]R R	 l4       t	]R
 R l4       t
]R R l4       tRR R lltR R ltR R ltRtR# )RequestLoadera  An abstract class defining the interface for classes that provide access to a read-only stream of requests.

Request loaders are used to manage and provide access to a storage of crawling requests.

Key responsibilities:
    - Fetching the next request to be processed.
    - Marking requests as successfully handled after processing.
    - Managing state information such as the total and handled request counts.
c                   V ^8  d   QhRR/#    returnint )formats   "y/Users/ahmad/.openclaw/workspace/my-crawler/.venv/lib/python3.14/site-packages/crawlee/request_loaders/_request_loader.py__annotate__RequestLoader.__annotate__   s     O O O    c                   "   R# 5i)z@Get the number of requests in the loader that have been handled.Nr   selfs   &r   get_handled_countRequestLoader.get_handled_count           c                   V ^8  d   QhRR/# r   r   )r   s   "r   r   r   !   s     s ss sr   c                   "   R# 5i)zdGet an offline approximation of the total number of requests in the loader (i.e. pending + handled).Nr   r   s   &r   get_total_countRequestLoader.get_total_count    r   r    c                   V ^8  d   QhRR/# r   r   boolr   )r   s   "r   r   r   %   s     r r rr   c                   "   R# 5i)zcReturn True if there are no more requests in the loader (there might still be unfinished requests).Nr   r   s   &r   is_emptyRequestLoader.is_empty$   r   r    c                   V ^8  d   QhRR/# r&   r   )r   s   "r   r   r   )   s     = =4 =r   c                   "   R# 5i)z.Return True if all requests have been handled.Nr   r   s   &r   is_finishedRequestLoader.is_finished(   r   r    c                   V ^8  d   QhRR/# )r   r   zRequest | Noner   )r   s   "r   r   r   -   s      . r   c                   "   R# 5i)zReturn the next request to be processed, or `None` if there are no more pending requests.

The method should return `None` if and only if `is_finished` would return `True`. In other cases, the method
should wait until a request appears.
Nr   r   s   &r   fetch_next_request RequestLoader.fetch_next_request,   r   r    c                    V ^8  d   QhRRRR/# )r   requestr   r   zProcessedRequest | Noner   )r   s   "r   r   r   5   s     e eW eAX er   c                   "   R# 5i)zVMark a request as handled after a successful processing (or after giving up retrying).Nr   r   r4   s   &&r   mark_request_as_handled%RequestLoader.mark_request_as_handled4   r   r    Nc                    V ^8  d   QhRRRR/# )r   request_managerzRequestManager | Noner   r   r   )r   s   "r   r   r   8   s     ; ;/D ;Pd ;r   c                n   "   ^ RI Hp ^ RIHp Vf   VP	                  4       G Rj  xL
 pV! W4      #  L5i)zCombine the loader with a request manager to support adding and reclaiming requests.

Args:
    request_manager: Request manager to combine the loader with.
        If None is given, the default request queue is used.
)r   )RequestQueueN)crawlee.request_loadersr   crawlee.storagesr<   open)r   r:   r   r<   s   &&  r   	to_tandemRequestLoader.to_tandem8   s5      	A1"$0$5$5$77O#D:: 8s   $535c                    V ^8  d   QhRRRR/# )r   r4   zstr | Requestr   r   r   )r   s   "r   r   r   H   s     C C- CG Cr   c                    \        V\        4      '       d   V# \        V\        4      '       d   \        P                  ! V4      # \	        R\        V4       24      h)z6Transform a request-like object into a Request object.zInvalid request type: )
isinstancer   strfrom_url
ValueErrortyper6   s   &&r   _transform_request RequestLoader._transform_requestH   sI    gw''Ngs####G,,1$w-ABBr   c                    V ^8  d   QhRRRR/# )r   requestszSequence[str | Request]r   zlist[Request]r   )r   s   "r   r   r   R   s     1 1,C 1 1r   c                    \         \        \        3,          ! 4       pV F0  pV P                  V4      pVP	                  VP
                  V4       K2  	  \        VP                  4       4      # )zJTransform a list of request-like objects into a list of `Request` objects.)dictrE   r   rI   
setdefault
unique_keylistvalues)r   rL   processed_requestsr4   processed_requests   &&   r   _transform_requests!RequestLoader._transform_requestsR   s^    !#w,/1G $ 7 7 @))*;*F*FHYZ   &--/00r   r   )N)__name__
__module____qualname____firstlineno____doc__r   r   r#   r)   r-   r1   r7   r@   rI   rU   __static_attributes__r   r   r   r   r      s     O O s s r r = =   e e; C1 1r   r   N)
__future__r   abcr   r   typingr   crawleer   crawlee._utils.docsr   collections.abcr	   r=   r
   r   crawlee.storage_clients.modelsr   r   r   r   r   <module>rd      sD    " #    *(L? I1C I1 I1r   