o
    2g                     @  s   d Z ddlmZ ddlmZ ddlmZ ddlmZm	Z	m
Z
 ddlZddlmZ d	d
lmZ d	dlmZ d	dlmZ er@ddlZG dd deZG dd deZdS )zProvide the Redditors class.    )annotations)islice)SimpleNamespace)TYPE_CHECKINGIterableIteratorN   )API_PATH   )PRAWBase)ListingGenerator)stream_generatorc                   @  s   e Zd ZdZdS )PartialRedditorzKA namespace object that provides a subset of :class:`.Redditor` attributes.N)__name__
__module____qualname____doc__ r   r   M/home/garg/my-data/venv/lib/python3.10/site-packages/praw/models/redditors.pyr      s    r   c                   @  sB   e Zd ZdZdddZdddZdddZdddZdddZdS )	RedditorszLRedditors is a Listing class that provides various :class:`.Redditor` lists.generator_kwargsstr | int | dict[str, str]returnIterator[praw.models.Subreddit]c                 K     t | jtd fi |S )a  Return a :class:`.ListingGenerator` for new :class:`.Redditors`.

        :returns: :class:`.Redditor` profiles, which are a type of :class:`.Subreddit`.

        Additional keyword arguments are passed in the initialization of
        :class:`.ListingGenerator`.

        	users_newr   _redditr	   selfr   r   r   r   new   s   zRedditors.newidsIterable[str]Iterator[PartialRedditor]c                 c  s    t |}	 tt|d}|sdS dd|i}z| jjtd |d}W n tjj	y/   Y qw |
 D ]\}}td	d|i|V  q4q)
a  Get user summary data by redditor IDs.

        :param ids: An iterable of redditor fullname IDs.

        :returns: A iterator producing :class:`.PartialRedditor` objects.

        Each ID must be prefixed with ``t2_``.

        Invalid IDs are ignored by the server.

        Td   r!   ,user_by_fullname)paramsfullnameNr   )iterlistr   joinr   getr	   prawcore
exceptionsNotFounditemsr   )r   r!   iterablechunkr'   resultsr(   	user_datar   r   r   partial_redditors(   s   zRedditors.partial_redditorsc                 K  r   )a  Return a :class:`.ListingGenerator` for popular :class:`.Redditors`.

        :returns: :class:`.Redditor` profiles, which are a type of :class:`.Subreddit`.

        Additional keyword arguments are passed in the initialization of
        :class:`.ListingGenerator`.

        users_popularr   r   r   r   r   popularD   s
   
zRedditors.popularquerystrc                 K  s(   | j |d|d t| jtd fi |S )a!  Return a :class:`.ListingGenerator` of Redditors for ``query``.

        :param query: The query string to filter Redditors by.

        :returns: :class:`.Redditor`\ s.

        Additional keyword arguments are passed in the initialization of
        :class:`.ListingGenerator`.

        r'   )	argumentskeyqusers_search)_safely_add_argumentsr   r   r	   )r   r8   r   r   r   r   searchS   s   
zRedditors.searchstream_optionsc                 K  s   t | jfi |S )a?  Yield new Redditors as they are created.

        Redditors are yielded oldest first. Up to 100 historical Redditors will
        initially be returned.

        Keyword arguments are passed to :func:`.stream_generator`.

        :returns: :class:`.Redditor` profiles, which are a type of :class:`.Subreddit`.

        )r   r    )r   r@   r   r   r   streame   s   zRedditors.streamN)r   r   r   r   )r!   r"   r   r#   )r8   r9   r   r   r   r   )r@   r   r   r   )	r   r   r   r   r    r5   r7   r?   rA   r   r   r   r   r      s    



r   )r   
__future__r   	itertoolsr   typesr   typingr   r   r   r-   constr	   baser   listing.generatorr   utilr   praw.modelsprawr   r   r   r   r   r   <module>   s    