
    {iEB                        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  SSKJr  S	S
KJr  S	SKJr  SSKJr  SSKJrJr  \(       a  SSKr " S S\\\\5      r " S S5      rg)zProvide the Redditor class.    )annotations)dumps)TYPE_CHECKINGAny	Generator   )API_PATH)_deprecate_args)cachedproperty   )RedditorListingMixin)stream_generator   )
RedditBase)FullnameMixinMessageableMixinNc                  |  ^  \ rS rSrSrSr\S!S j5       r\S"S j5       r	\S#S j5       r
\S$S j5       r\S$S j5       r   S%       S&U 4S
 jjjrS'U 4S jjrU 4S jrS rS(S jrS)S jrS rS r\" S5      S	S.S*S jj5       rS+S jr\" S5      SS.S,S jj5       rS-S jrS.S jrS/S jrS rS rS rS r U =r!$ )0Redditor   a  A class representing the users of Reddit.

.. include:: ../../typical_attributes.rst

.. note::

    Shadowbanned accounts are treated the same as non-existent accounts, meaning
    that they will not have any attributes.

.. note::

    Suspended/banned accounts will only return the ``name`` and ``is_suspended``
    attributes.

=================================== ================================================
Attribute                           Description
=================================== ================================================
``comment_karma``                   The comment karma for the :class:`.Redditor`.
``comments``                        Provide an instance of :class:`.SubListing` for
                                    comment access.
``submissions``                     Provide an instance of :class:`.SubListing` for
                                    submission access.
``created_utc``                     Time the account was created, represented in
                                    `Unix Time`_.
``has_verified_email``              Whether or not the :class:`.Redditor` has
                                    verified their email.
``icon_img``                        The url of the Redditors' avatar.
``id``                              The ID of the :class:`.Redditor`.
``is_employee``                     Whether or not the :class:`.Redditor` is a
                                    Reddit employee.
``is_friend``                       Whether or not the :class:`.Redditor` is friends
                                    with the authenticated user.
``is_mod``                          Whether or not the :class:`.Redditor` mods any
                                    subreddits.
``is_gold``                         Whether or not the :class:`.Redditor` has active
                                    Reddit Premium status.
``is_suspended``                    Whether or not the :class:`.Redditor` is
                                    currently suspended.
``link_karma``                      The link karma for the :class:`.Redditor`.
``name``                            The Redditor's username.
``subreddit``                       If the :class:`.Redditor` has created a
                                    user-subreddit, provides a dictionary of
                                    additional attributes. See below.
``subreddit["banner_img"]``         The URL of the user-subreddit banner.
``subreddit["name"]``               The fullname of the user-subreddit.
``subreddit["over_18"]``            Whether or not the user-subreddit is NSFW.
``subreddit["public_description"]`` The public description of the user-subreddit.
``subreddit["subscribers"]``        The number of users subscribed to the
                                    user-subreddit.
``subreddit["title"]``              The title of the user-subreddit.
=================================== ================================================

.. _unix time: https://en.wikipedia.org/wiki/Unix_time

namec                     US:X  a  gU " X5      $ )zDReturn an instance of :class:`.Redditor`, or ``None`` from ``data``.z	[deleted]N )clsredditdatas      U/home/james-whalen/.local/lib/python3.13/site-packages/praw/models/reddit/redditor.py	from_dataRedditor.from_dataO   s     ;6      c                4    SSK Jn  U" U R                  U 5      $ )a  Provide an instance of :class:`.RedditorModNotes`.

This provides an interface for managing moderator notes for a redditor.

.. note::

    The authenticated user must be a moderator of the provided subreddit(s).

For example, all the notes for u/spez in r/test can be iterated through like so:

.. code-block:: python

    redditor = reddit.redditor("spez")

    for note in redditor.notes.subreddits("test"):
        print(f"{note.label}: {note.note}")

r   )RedditorModNotes)praw.models.mod_notesr!   _reddit)selfr!   s     r   notesRedditor.notesV   s    ( 	;d33r   c                    [        U 5      $ )a  Provide an instance of :class:`.RedditorStream`.

Streams can be used to indefinitely retrieve new comments made by a redditor,
like:

.. code-block:: python

    for comment in reddit.redditor("spez").stream.comments():
        print(comment)

Additionally, new submissions can be retrieved via the stream. In the following
example all submissions are fetched via the redditor u/spez:

.. code-block:: python

    for submission in reddit.redditor("spez").stream.submissions():
        print(submission)

)RedditorStreamr$   s    r   streamRedditor.streamn   s    * d##r   c                H    U R                   R                  R                  S   $ )zReturn the class's kind.redditor)r#   configkindsr)   s    r   _kindRedditor._kind   s     ||""((44r   c                .    [         S   R                  U S9$ )Nuserr3   )r	   formatr)   s    r   _pathRedditor._path   s    &&D&11r   Nc                   > X#U4R                  S5      S:w  a  Sn[        U5      eU(       a"  [        U[        5      (       a  SU;   d   S5       eSU l        U(       a  X l        OU(       a  X0l        [        TU ]!  XSS9  g)	a  Initialize a :class:`.Redditor` instance.

:param reddit: An instance of :class:`.Reddit`.
:param name: The name of the redditor.
:param fullname: The fullname of the redditor, starting with ``t2_``.

Exactly one of ``name``, ``fullname`` or ``_data`` must be provided.

Nr   z?Exactly one of 'name', 'fullname', or '_data' must be provided.r   zPlease file a bug with PRAW.T	_fullname)_data_extra_attribute_to_check)	count	TypeError
isinstancedict_listing_use_sortr   r9   super__init__)r$   r   r   fullnamer:   msg	__class__s         r   rB   Redditor.__init__   s|      E"((.!3SCC. 5$''FeO.-.;!%I%NTr   c                l   > US:X  a  U(       a  SSK Jn  U" U R                  US9n[        TU ]  X5        g)z"Objectify the subreddit attribute.	subredditr   )UserSubreddit)r   r:   N)user_subredditrI   r#   rA   __setattr__)r$   r   valuerI   rE   s       r   rK   Redditor.__setattr__   s-    ;55!UCED(r   c                   > U R                  5       nUS   n[        U 5      " U R                  US9nU R                  R	                  UR                  5        [
        TU ]  5         g )Nr   )r:   )_fetch_datatyper#   __dict__updaterA   _fetch)r$   r   otherrE   s      r   rS   Redditor._fetch   sN    !F|T
4<<t4U^^,r   c                    [        U S5      (       a   U R                  U R                  5      U l        SSU R                  0S 4$ )Nr9   
user_aboutr3   )hasattr_fetch_usernamer9   r   r)   s    r   _fetch_infoRedditor._fetch_info   s;    4%%,,T^^<DIfdii0$66r   c                T    U R                   R                  [        S   SU0S9U   S   $ )Nuser_by_fullnameidsparamsr   )r#   getr	   )r$   rC   s     r   rY   Redditor._fetch_username   s9    ||); <eXEVW

 	r   c               v    [         S   R                  U S9nU R                  R                  [	        U5      X#S9  g )N	friend_v1r4   )r   methodpath)r	   r5   r#   requestr   )r$   r   re   urls       r   _friendRedditor._friend   s5    {#***5%+fGr   c                ^    U R                   R                  [        S   SU R                  0S9  g)a  Block the :class:`.Redditor`.

For example, to block :class:`.Redditor` u/spez:

.. code-block:: python

    reddit.redditor("spez").block()

.. note::

    Blocking a trusted user will remove that user from your trusted list.

.. seealso::

    :meth:`.trust`


block_userr   r_   Nr#   postr	   r   r)   s    r   blockRedditor.block   s)    $ 	(<0&$))9LMr   c                ^    U R                   R                  [        S   SU R                  0S9  g)zRemove the :class:`.Redditor` from your whitelist of trusted users.

For example, to remove :class:`.Redditor` u/spez from your whitelist:

.. code-block:: python

    reddit.redditor("spez").distrust()

.. seealso::

    :meth:`.trust`

remove_whitelistedr   r   Nrm   r)   s    r   distrustRedditor.distrust   s*     	(#78		?RSr   note)rv   c               :    U R                  U(       a  SU0O0 SS9  g)a  Friend the :class:`.Redditor`.

:param note: A note to save along with the relationship. Requires Reddit Premium
    (default: ``None``).

Calling this method subsequent times will update the note.

For example, to friend u/spez:

.. code-block:: python

    reddit.redditor("spez").friend()

To add a note to the friendship (requires Reddit Premium):

.. code-block:: python

    reddit.redditor("spez").friend(note="My favorite admin")

rv   PUTr   re   N)ri   )r$   rv   s     r   friendRedditor.friend   s    , 	D64.bGr   c                `    U R                   R                  [        S   R                  U S95      $ )a  Return a :class:`.Redditor` instance with specific friend-related attributes.

:returns: A :class:`.Redditor` instance with fields ``date``, ``id``, and
    possibly ``note`` if the authenticated user has Reddit Premium.

For example, to get the friendship information of :class:`.Redditor` u/spez:

.. code-block:: python

    info = reddit.redditor("spez").friend_info
    friend_data = info.date

rd   r4   r#   ra   r	   r5   r)   s    r   friend_infoRedditor.friend_info  s,     || 5 < <$ < GHHr   monthsr   )r   c                   US:  d  US:  a  Sn[        U5      eU R                  R                  [        S   R	                  U S9SU0S9  g)	zGild the :class:`.Redditor`.

:param months: Specifies the number of months to gild up to 36 (default: ``1``).

For example, to gild :class:`.Redditor` u/spez for 1 month:

.. code-block:: python

    reddit.redditor("spez").gild(months=1)

r   $   zmonths must be between 1 and 36	gild_user)usernamer   rs   N)r=   r#   rn   r	   r5   )r$   r   rD   s      r   gildRedditor.gild  sT     A:"3CC. [!(($(7x>P 	 	
r   c                r    U R                   R                  [        S   R                  U S95      =(       d    / $ )a'  Return a list of the redditor's moderated subreddits.

:returns: A list of :class:`.Subreddit` objects. Return ``[]`` if the redditor
    has no moderated subreddits.

:raises: ``prawcore.ServerError`` in certain circumstances. See the note below.

.. note::

    The redditor's own user profile subreddit will not be returned, but other
    user profile subreddits they moderate will be returned.

Usage:

.. code-block:: python

    for subreddit in reddit.redditor("spez").moderated():
        print(subreddit.display_name)
        print(subreddit.title)

.. note::

    A ``prawcore.ServerError`` exception may be raised if the redditor moderates
    a large number of subreddits. If that happens, try switching to
    :ref:`read-only mode <read_only_application>`. For example,

    .. code-block:: python

        reddit.read_only = True
        for subreddit in reddit.redditor("reddit").moderated():
            print(str(subreddit))

    It is possible that requests made in read-only mode will also raise a
    ``prawcore.ServerError`` exception.

    When used in read-only mode, this method does not retrieve information about
    subreddits that require certain special permissions to access, e.g., private
    subreddits and premium-only subreddits.

.. seealso::

    :meth:`.User.moderator_subreddits`

	moderatedr4   r}   r)   s    r   r   Redditor.moderated)  s2    Z || 5 < <$ < GHNBNr   c                `    U R                   R                  [        S   R                  U S95      $ )zReturn a list of the redditor's public multireddits.

For example, to to get :class:`.Redditor` u/spez's multireddits:

.. code-block:: python

    multireddits = reddit.redditor("spez").multireddits()

multireddit_userr4   r}   r)   s    r   multiredditsRedditor.multiredditsX  s-     ||); < C C C NOOr   c                r    [        U R                  R                  [        S   R	                  U S95      5      $ )ag  Return a list of the redditor's trophies.

:returns: A list of :class:`.Trophy` objects. Return ``[]`` if the redditor has
    no trophies.

:raises: :class:`.RedditAPIException` if the redditor doesn't exist.

Usage:

.. code-block:: python

    for trophy in reddit.redditor("spez").trophies():
        print(trophy.name)
        print(trophy.description)

trophiesr4   )listr#   ra   r	   r5   r)   s    r   r   Redditor.trophiesd  s1    " DLL$$Xj%9%@%@d%@%KLMMr   c                ^    U R                   R                  [        S   SU R                  0S9  g)a  Add the :class:`.Redditor` to your whitelist of trusted users.

Trusted users will always be able to send you PMs.

Example usage:

.. code-block:: python

    reddit.redditor("AaronSw").trust()

Use the ``accept_pms`` parameter of :meth:`.Preferences.update` to toggle your
``accept_pms`` setting between ``"everyone"`` and ``"whitelisted"``. For
example:

.. code-block:: python

    # Accept private messages from everyone:
    reddit.user.preferences.update(accept_pms="everyone")
    # Only accept private messages from trusted users:
    reddit.user.preferences.update(accept_pms="whitelisted")

You may trust a user even if your ``accept_pms`` setting is switched to
``"everyone"``.

.. note::

    You are allowed to have a user on your blocked list and your friends list at
    the same time. However, you cannot trust a user who is on your blocked list.

.. seealso::

    - :meth:`.distrust`
    - :meth:`.Preferences.update`
    - :meth:`.trusted`

add_whitelistedr   rs   Nrm   r)   s    r   trustRedditor.trustw  s+    J 	(#45VTYY<OPr   c                    U R                   R                  R                  5       R                  [	        U 5      SS.n[
        S   R                  SS9nU R                   R                  X!S9  g)zUnblock the :class:`.Redditor`.

For example, to unblock :class:`.Redditor` u/spez:

.. code-block:: python

    reddit.redditor("spez").unblock()

enemy)	containerr   rP   unfriendall)rH   rs   N)r#   r3   merC   strr	   r5   rn   )r$   r   rh   s      r   unblockRedditor.unblock  s`     **--/88I

 z"))E):#)r   c                :    U R                  S[        U 5      0SS9  g)zUnfriend the :class:`.Redditor`.

For example, to unfriend :class:`.Redditor` u/spez:

.. code-block:: python

    reddit.redditor("spez").unfriend()

idDELETEry   N)ri   r   r)   s    r   r   Redditor.unfriend  s     	4T+H=r   )r9   r@   r   )r   praw.Redditr   dict[str, Any]returnzRedditor | None)r   zpraw.models.RedditorModNotes)r   z*praw.models.reddit.redditor.RedditorStream)r   r   )NNN)r   r   r   
str | NonerC   r   r:   zdict[str, Any] | None)r   r   rL   r   )rC   r   )r   r   re   r   )rv   r   )r   praw.models.Redditor)r   int)r   zlist[praw.models.Subreddit])r   zlist[praw.models.Multireddit])r   zlist[praw.models.Trophy])"__name__
__module____qualname____firstlineno____doc__	STR_FIELDclassmethodr   r   r%   r*   propertyr0   r6   rB   rK   rS   rZ   rY   ri   ro   rt   r
   rz   r~   r   r   r   r   r   r   r   __static_attributes____classcell__)rE   s   @r   r   r      sB   6p I! ! 4 4. $ $, 5 5 2 2  #'+UU U 	U
 %U U<)7

HN(T  V$( H H.I  X$% 
 
&-O^
PN&%QN*$
> 
>r   r   c                  F    \ rS rSrSrSS jr    S	S jr    S
S jrSrg)r(   i  z(Provides submission and comment streams.c                    Xl         g)zmInitialize a :class:`.RedditorStream` instance.

:param redditor: The redditor associated with the streams.

Nr-   )r$   r-   s     r   rB   RedditorStream.__init__  s	     !r   c                V    [        U R                  R                  R                  40 UD6$ )a  Yield new comments as they become available.

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

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

For example, to retrieve all new comments made by redditor u/spez, try:

.. code-block:: python

    for comment in reddit.redditor("spez").stream.comments():
        print(comment)

)r   r-   commentsnewr$   stream_optionss     r   r   RedditorStream.comments  s$    $   6 6 : :MnMMr   c                V    [        U R                  R                  R                  40 UD6$ )a  Yield new submissions as they become available.

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

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

For example, to retrieve all new submissions made by redditor u/spez, try:

.. code-block:: python

    for submission in reddit.redditor("spez").stream.submissions():
        print(submission)

)r   r-   submissionsr   r   s     r   r   RedditorStream.submissions  s$    $   9 9 = =PPPr   r   N)r-   r   )r   str | int | dict[str, str]r   z*Generator[praw.models.Comment, None, None])r   r   r   z-Generator[praw.models.Submission, None, None])	r   r   r   r   r   rB   r   r   r   r   r   r   r(   r(     s:    2!N :N	3N(Q :Q	6Qr   r(   )r   
__future__r   jsonr   typingr   r   r   constr	   utilr
   
util.cacher   listing.mixinsr   r   baser   mixinsr   r   praw.modelsprawr   r(   r   r   r   <module>r      sR    ! "  0 0  # ( 1 #  3f>!5}j f>R1Q 1Qr   