
    {i                    ~    S r SSKJr  SSKJr  SSKJrJrJr  SSK	J
r
  SSKJrJr  \(       a  SS	Kr " S
 S\
\5      rg	)z#Provide the ListingGenerator class.    )annotations)deepcopy)TYPE_CHECKINGAnyIterator   )PRAWBase   )FlairListingModNoteListingNc                  j   ^  \ rS rSrSr  S	       S
U 4S jjjrSS jrSS jrSS jrS r	Sr
U =r$ )ListingGenerator   a*  Instances of this class generate :class:`.RedditBase` instances.

.. warning::

    This class should not be directly utilized. Instead, you will find a number of
    methods that return instances of the class here_.

.. _here: https://praw.readthedocs.io/en/latest/search.html?q=ListingGenerator

c                   > [         TU ]  USS9  SU l        SU l        SU l        X0l        U(       a  [        U5      O0 U l        U=(       d    SU R                  S'   X l        SU l	        g)a(  Initialize a :class:`.ListingGenerator` instance.

:param reddit: An instance of :class:`.Reddit`.
:param url: A URL returning a Reddit listing.
:param limit: The number of content entries to fetch. If ``limit`` is ``None``,
    then fetch as many entries as possible. Most of Reddit's listings contain a
    maximum of 1000 items, and are returned 100 at a time. This class will
    automatically issue all necessary requests (default: ``100``).
:param params: A dictionary containing additional query string parameters to
    send with the request.

N)_dataFi   limitr   )
super__init__
_exhausted_listing_list_indexr   r   paramsurlyielded)selfredditr   r   r   	__class__s        W/home/james-whalen/.local/lib/python3.13/site-packages/praw/models/listing/generator.pyr   ListingGenerator.__init__   s`    & 	t,
*0hv&b$}G    c                    U $ )z<Permit :class:`.ListingGenerator` to operate as an iterator. r   s    r   __iter__ListingGenerator.__iter__8   s    r    c                h   U R                   b   U R                  U R                   :  a  [        eU R                  b#  U R                  [        U R                  5      :  a  U R                  5         U =R                  S-  sl        U =R                  S-  sl        U R                  U R                  S-
     $ )z<Permit :class:`.ListingGenerator` to operate as a generator.r
   )r   r   StopIterationr   r   len_next_batchr#   s    r   __next__ListingGenerator.__next__<   s    ::!dlldjj&@== D$4$4DMM8J$JA}}T--122r    c                    [        U[        5      (       a  US   $ [        U[        5      (       aG  [        [        /nU H(  nUR
                  U;   d  M  U" U R                  U5      s  $    Sn[        U5      eU$ )Nr
   zUThe generator returned a dictionary PRAW didn't recognize. File a bug report at PRAW.)
isinstancelistdictr   r   CHILD_ATTRIBUTE_reddit
ValueError)r   listingclasseslisting_typemsgs        r   _extract_sublist!ListingGenerator._extract_sublistH   sp    gt$$1:gt$$#^4G '//7:'g>> !( n o%r    c                V   U R                   (       a  [        eU R                  R                  U R                  U R
                  S9U l        U R                  U R                  5      U l        SU l        U R                  (       d  [        eU R                  R                  (       a  U R                  R                  U R
                  R                  U R                  R                  5      :w  a8  U R                  R                  U R
                  U R                  R                  '   g SU l         g )N)r   r   T)r   r'   r1   getr   r   r   r7   r   afterAFTER_PARAMr#   s    r   r)   ListingGenerator._next_batchV   s    ??(($++(F--dmm<}}==4==#6#6$++//MM%%;
 $
 6:]]5H5HDKK112"DOr    )r   r   r   r   r   r   r   )d   N)r   zpraw.Redditr   strr   intr   zdict[str, str | int] | None)returnr   )r3   zdict[str, Any] | list[Any])__name__
__module____qualname____firstlineno____doc__r   r$   r*   r7   r)   __static_attributes____classcell__)r   s   @r   r   r      sY    	 .2  	
 , :
3# #r    r   )rF   
__future__r   copyr   typingr   r   r   baser	   r3   r   r   prawr   r"   r    r   <module>rN      s0    ) "  / /  1W#x W#r    