
    {iPc                        S r SSKJr  SSKJrJrJrJr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  \(       a  SSKr\
\\4   r\
S\4   r\
\\4   r " S S5      r " S S\5      r " S S\5      r " S S\5      r g)z6Provides classes for interacting with moderator notes.    )islice)TYPE_CHECKINGAny	GeneratorListOptionalTupleUnion   )API_PATH   )PRAWBase)ListingGenerator)Comment)Redditor)
SubmissionNzpraw.models.Subredditc                   <   \ rS rSrSr  S S jrS\S\S\4S jr	S\
\   S	\
\   S
\S   4S jrS\S\S
\4S jrS\S\
\   S	\
\   S\S
\S   4
S jrSSSSS.S\\   S\S\\   S\\   S\\\\\4      S\S
S4S jjrSSSSS.S\S\\   S\\   S\\   4S jjrSrg)!BaseModNotes   z7Provides base methods to interact with moderator notes.c                     Xl         g)z`Initialize a :class:`.BaseModNotes` instance.

:param reddit: An instance of :class:`.Reddit`.

N_reddit)selfreddits     O/home/james-whalen/.local/lib/python3.13/site-packages/praw/models/mod_notes.py__init__BaseModNotes.__init__   s	         redditor	subredditgenerator_kwargsc                 l    [         R                  " USUUS9  [        U R                  [        S   40 UD6$ )Nparams)	argumentskeyr    user	mod_notes)r   _safely_add_argumentsr   r   r   )r   r   r    r!   s       r   _all_generatorBaseModNotes._all_generator#   s<     	&&&		
  h{.CXGWXXr   	redditors
subredditsreturnpraw.models.ModNoteNNc              #     #    [        U5      n[        U5      n [        [        US5      5      n[        [        US5      5      n[        XV/5      (       d  g SR	                  [        [        U5      5      SR	                  [        [        U5      5      S.nU R                  R                  [        S   US9nUS    H*  n	U R                  R                  R                  U	5      v   M,     M  7f)Ni  ,)r,   usersmod_notes_bulkr#   r'   )iterlistr   anyjoinmapstrr   getr   	_objector	objectify)
r   r+   r,   subreddits_iterredditors_itersubreddits_chunkusers_chunkr#   response	note_dicts
             r   _bulk_generatorBaseModNotes._bulk_generator1   s      z*i#F?C$@Avnc:;K(677!hhs30@'AB#c;"78F ||''1A(B6'RH%k2	ll,,66yAA 3 s   C)C+error_message
attributesc                 p    UR                  5       u  p4U=(       d    [        XS 5      nUc  [        U5      eU$ N)popitemgetattr	TypeError)r   rF   rG   	attribute_valuevalues         r   _ensure_attributeBaseModNotes._ensure_attributeC   s9    &..0	8'$48=M**r   	all_notesc              +      #    U(       a.  U H'  nU H  nU R                   " Xe40 UD6 S h  vN   M      M)     g U R                  X#5       S h  vN   g  N' N7frI   )r)   rD   )r   rR   r+   r,   r!   r    r   s          r   _notesBaseModNotes._notesJ   sb      '	 )H#22  /?    !* ( ++IBBB	 Cs!   (AA!AAAAN)labelr   r    thingrV   noterW   other_settingsr/   c                j   SnU(       a  [        U[        5      (       aJ  Un[        U SU5      (       a  [        U SU5      (       d#  [        U R                  R                  U/S95      nOUR                  n[        U SU5      =(       d    UR                  n[        U SU5      =(       d    UR                  nU R                  SUS9nU R                  SUS9n[        U5      [        U5      US	.nU(       a  XS
'   U(       a  XxS'   UR                  U5        U R                  R                  [        S   US9$ )a  Create a :class:`.ModNote` for a redditor in the specified subreddit.

:param label: The label for the note. As of this writing, this can be one of the
    following: ``"ABUSE_WARNING"``, ``"BAN"``, ``"BOT_BAN"``,
    ``"HELPFUL_USER"``, ``"PERMA_BAN"``, ``"SOLID_CONTRIBUTOR"``,
    ``"SPAM_WARNING"``, ``"SPAM_WATCH"``, or ``None`` (default: ``None``).
:param note: The content of the note. As of this writing, this is limited to 250
    characters.
:param redditor: The redditor to create the note for (default: ``None``).

    .. note::

        This parameter is required if ``thing`` is not provided or this is not
        called from a :class:`.Redditor` instance (e.g.,
        ``reddit.redditor.notes``).

:param subreddit: The subreddit associated with the note (default: ``None``).

    .. note::

        This parameter is required if ``thing`` is not provided or this is not
        called from a :class:`.Subreddit` instance (e.g.,
        ``reddit.subreddit.mod``).

:param thing: Either the fullname of a comment/submission, a :class:`.Comment`,
    or a :class:`.Submission` to associate with the note.
:param other_settings: Additional keyword arguments can be provided to handle
    new parameters as Reddit introduces them.

:returns: The new :class:`.ModNote` object.

For example, to create a note for u/spez in r/test:

.. code-block:: python

    reddit.subreddit("test").mod.notes.create(
        label="HELPFUL_USER", note="Test note", redditor="spez"
    )
    # or
    reddit.redditor("spez").mod.notes.create(
        label="HELPFUL_USER", note="Test note", subreddit="test"
    )
    # or
    reddit.notes.create(
        label="HELPFUL_USER", note="Test note", redditor="spez", subreddit="test"
    )

Nr   r    )	fullnameszEither the 'redditor' or 'thing' parameters must be provided or this method must be called from a Redditor instance (e.g., 'redditor.notes').r   zEither the 'subreddit' or 'thing' parameters must be provided or this method must be called from a Subreddit instance (e.g., 'subreddit.mod.notes').r    )r&   r    rX   rV   	reddit_idr'   )data)
isinstancer:   rK   nextr   infofullnameauthorr    rP   updatepostr   )	r   rV   rX   r   r    rW   rY   r^   r_   s	            r   createBaseModNotes.createZ   s2   t 	%%%!	 D*h77k9== !!2!2eW!2!EFE!NN	tZ:JellHk9=PI))X * 

 **'  	 + 
	 MY

 !M )N#||  +!6T BBr   F)
delete_allnote_idr   r    ri   rj   c                L   U R                  SUS9nU R                  SUS9nU(       d  Uc  Sn[        U5      eU(       a-  U R                  SU/U/5       H  nUR                  5         M     g[	        U5      [	        U5      US.nU R
                  R                  [        S	   US
9  g)a  Delete note(s) for a redditor.

:param delete_all: When ``True``, delete all notes for the specified redditor in
    the specified subreddit (default: ``False``).

    .. note::

        This will make a request for each note.

:param note_id: The ID of the note to delete. This parameter is ignored if
    ``delete_all`` is ``True``.
:param redditor: The redditor to delete the note(s) for (default: ``None``). Can
    be a :class:`.Redditor` instance or a redditor name.

    .. note::

        This parameter is required if this method is **not** called from a
        :class:`.Redditor` instance (e.g., ``redditor.notes``).

:param subreddit: The subreddit to delete the note(s) from (default: ``None``).
    Can be a :class:`.Subreddit` instance or a subreddit name.

    .. note::

        This parameter is required if this method is **not** called from a
        :class:`.Subreddit` instance (e.g., ``reddit.subreddit.mod``).


For example, to delete a note with the ID
``"ModNote_d324b280-5ecc-435d-8159-3e259e84e339"``, try:

.. code-block:: python

    reddit.subreddit("test").mod.notes.delete(
        note_id="ModNote_d324b280-5ecc-435d-8159-3e259e84e339", redditor="spez"
    )
    # or
    reddit.redditor("spez").notes.delete(
        note_id="ModNote_d324b280-5ecc-435d-8159-3e259e84e339", subreddit="test"
    )
    # or
    reddit.notes.delete(
        note_id="ModNote_d324b280-5ecc-435d-8159-3e259e84e339",
        subreddit="test",
        redditor="spez",
    )

To delete all notes for u/spez, try:

.. code-block:: python

    reddit.subreddit("test").mod.notes.delete(delete_all=True, redditor="spez")
    # or
    reddit.redditor("spez").notes.delete(delete_all=True, subreddit="test")
    # or
    reddit.notes.delete(delete_all=True, subreddit="test", redditor="spez")

zEither the 'redditor' parameter must be provided or this method must be called from a Redditor instance (e.g., 'redditor.notes').r\   zEither the 'subreddit' parameter must be provided or this method must be called from a Subreddit instance (e.g., 'subreddit.mod.notes').r]   Nz2Either 'note_id' or 'delete_all' must be provided.T)r&   r    rj   r'   r4   )rP   rL   rT   deleter:   r   r   )r   ri   rj   r   r    msgrX   r#   s           r   rl   BaseModNotes.delete   s    D ))I * 

 **O + 
	
 goFCC. D8*ykB C H ^"F
 LL 5fEr   r   )r   praw.Reddit)__name__
__module____qualname____firstlineno____doc__r   RedditorTypeSubredditTyper   r)   r   r   rD   r:   rP   boolrT   r   r
   r   r   rg   rl   __static_attributes__ r   r   r   r      s   A		YY !Y  	YBl+B9=m9LB	4	5B$s # # CC %C '	C
  C 
4	5C&  $+/-1;?^C }^C 	^C
 <(^C M*^C gz3678^C ^C 
^CF !!%+/-1XF XF #	XF
 <(XF M*XF XFr   r   c            
       f   ^  \ rS rSrSrSSS\4U 4S jjrSS.S	\S
\\	   S\
S\S   4S jjrSrU =r$ )RedditorModNotesi  a  Provides methods to interact with moderator notes at the redditor level.

.. 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   ro   r   c                 0   > [         TU ]  U5        X l        g)zInitialize a :class:`.RedditorModNotes` instance.

:param reddit: An instance of :class:`.Reddit`.
:param redditor: An instance of :class:`.Redditor`.

N)superr   r   )r   r   r   	__class__s      r   r   RedditorModNotes.__init__'  s     	  r   NrR   r,   rR   r!   r-   r.   c                    [        U5      S:X  a  Sn[        U5      eUc  [        U5      S:H  nU R                  " UU R                  /[        U5      -  [	        U5      40 UD6$ )aY  Return notes for this :class:`.Redditor` from one or more subreddits.

:param subreddits: One or more subreddits to retrieve the notes from. Must be
    either a :class:`.Subreddit` or a subreddit name.
:param all_notes: Whether to return all notes or only the latest note (default:
    ``True`` if only one subreddit is provided otherwise ``False``).

    .. note::

        Setting this to ``True`` will result in a request for each subreddit.


:returns: A generator that yields the most recent :class:`.ModNote` (or ``None``
    if this redditor doesn't have any notes) per subreddit in their relative
    order. If ``all_notes`` is ``True``, this will yield all notes or ``None``
    from each subreddit for this redditor.

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}")

For example, the latest note for u/spez from r/test and r/redditdev can be
iterated through like so:

.. code-block:: python

    redditor = reddit.redditor("spez")
    subreddit = reddit.subreddit("redditdev")

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

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

.. code-block:: python

    redditor = reddit.redditor("spez")
    subreddit = reddit.subreddit("redditdev")

    for note in redditor.notes.subreddits("test", subreddit, all_notes=True):
        print(f"{note.label}: {note.note}")

r   z&At least 1 subreddit must be provided.r   )len
ValueErrorrT   r   r6   )r   rR   r,   r!   rm   s        r   r,   RedditorModNotes.subreddits1  sl    n z?a:CS/!J1,I{{]]Oc*o-
 	
 	
r   r\   )rp   rq   rr   rs   rt   ru   r   rv   r   rw   r   r   r,   rx   __classcell__r~   s   @r   r{   r{     s`    "!} ! ! %)A
"A
 D>A
  	A

 
4	5A
 A
r   r{   c            
       f   ^  \ rS rSrSrSSS\4U 4S jjrSS.S	\S
\\	   S\
S\S   4S jjrSrU =r$ )SubredditModNotesiu  a  Provides methods to interact with moderator notes at the subreddit level.

.. note::

    The authenticated user must be a moderator of this subreddit.

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

.. code-block:: python

    subreddit = reddit.subreddit("test")

    for note in subreddit.mod.notes.redditors("spez"):
        print(f"{note.label}: {note.note}")

r   ro   r    c                 0   > [         TU ]  U5        X l        g)zInitialize a :class:`.SubredditModNotes` instance.

:param reddit: An instance of :class:`.Reddit`.
:param subreddit: An instance of :class:`.Subreddit`.

N)r}   r   r    )r   r   r    r~   s      r   r   SubredditModNotes.__init__  s     	 "r   Nr   r+   rR   r!   r-   r.   c                    [        U5      S:X  a  Sn[        U5      eUc  [        U5      S:H  nU R                  " U[        U5      U R                  /[        U5      -  40 UD6$ )a7  Return notes from this :class:`.Subreddit` for one or more redditors.

:param redditors: One or more redditors to retrieve notes for. Must be either a
    :class:`.Redditor` or a redditor name.
:param all_notes: Whether to return all notes or only the latest note (default:
    ``True`` if only one redditor is provided otherwise ``False``).

    .. note::

        Setting this to ``True`` will result in a request for each redditor.


:returns: A generator that yields the most recent :class:`.ModNote` (or ``None``
    if the user doesn't have any notes in this subreddit) per redditor in their
    relative order. If ``all_notes`` is ``True``, this will yield all notes for
    each redditor.

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

.. code-block:: python

    subreddit = reddit.subreddit("test")

    for note in subreddit.mod.notes.redditors("spez"):
        print(f"{note.label}: {note.note}")

For example, the latest note for u/spez and u/bboe from r/test can be iterated
through like so:

.. code-block:: python

    subreddit = reddit.subreddit("test")
    redditor = reddit.redditor("bboe")

    for note in subreddit.mod.notes.redditors("spez", redditor):
        print(f"{note.label}: {note.note}")

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

.. code-block:: python

    subreddit = reddit.subreddit("test")
    redditor = reddit.redditor("bboe")

    for note in subreddit.mod.notes.redditors("spez", redditor, all_notes=True):
        print(f"{note.label}: {note.note}")

r   z%At least 1 redditor must be provided.r   )r   r   rT   r6   r    )r   rR   r+   r!   rm   s        r   r+   SubredditModNotes.redditors  sl    n y>Q9CS/!I!+I{{O^^s9~-
 	
 	
r   r]   )rp   rq   rr   rs   rt   rv   r   ru   r   rw   r   r   r+   rx   r   r   s   @r   r   r   u  s`    "#} # # %)A
 A
 D>A
  	A

 
4	5A
 A
r   r   c                       \ rS rSrSrSSSSSS.S\S\\\\	\
4         S\\\
      S	\\\	      S
\\\      S\S\S   4S jjrSS.S
\S\\   S\S\S   4S jjrSrg)RedditModNotesi  a4  Provides methods to interact with moderator notes at a global level.

.. note::

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

For example, the latest note for u/spez in r/redditdev and r/test, and for u/bboe in
r/redditdev can be iterated through like so:

.. code-block:: python

    redditor = reddit.redditor("bboe")
    subreddit = reddit.subreddit("redditdev")

    pairs = [(subreddit, "spez"), ("test", "spez"), (subreddit, redditor)]

    for note in reddit.notes(pairs=pairs):
        print(f"{note.label}: {note.note}")

FN)rR   pairsr+   r,   thingsrR   r   r+   r,   r   r!   r-   r.   c                B   Uc  / nUc  / nUc  / nUc  / nX#-   U-   U-   (       d  Sn[        U5      e[        U5      [        U5      -  S:X  a;  [        U5      [        U5      -   S:  a   [        [        U5      S:  a  S5      eS5      e/ n/ n	U[        U5       V
Vs/ s H  n
[        U5        H  nX4PM     M     snn
-   U-   nU H  n[        U[        [
        45      (       aL  UR                  UR                  R                  5        U	R                  UR                  R                  5        Mj  [        U[        5      (       a(  Uu  pUR                  U
5        U	R                  U5        M  S[        U5       3n[        U5      e   U R                  " XU	40 UD6$ s  snn
f )ac  Get note(s) for each subreddit/user pair, or ``None`` if they don't have any.

:param all_notes: Whether to return all notes or only the latest note for each
    subreddit/redditor pair (default: ``False``).

    .. note::

        Setting this to ``True`` will result in a request for each unique
        subreddit/redditor pair. If ``subreddits`` and ``redditors`` are
        provided, this will make a request equivalent to number of redditors
        multiplied by the number of subreddits.

:param pairs: A list of subreddit/redditor tuples.

    .. note::

        Required if ``subreddits``, ``redditors``, nor ``things`` are provided.

:param redditors: A list of redditors to return notes for. This parameter is
    used in tandem with ``subreddits`` to get notes from multiple subreddits for
    each of the provided redditors.

    .. note::

        Required if ``items`` or ``things`` is not provided or if ``subreddits``
        **is** provided.

:param subreddits: A list of subreddits to return notes for. This parameter is
    used in tandem with ``redditors`` to get notes for multiple redditors from
    each of the provided subreddits.

    .. note::

        Required if ``items`` or ``things`` is not provided or if ``redditors``
        **is** provided.

:param things: A list of comments and/or submissions to return notes for.
:param generator_kwargs: Additional keyword arguments passed to the generator.
    This parameter is ignored when ``all_notes`` is ``False``.

:returns: A generator that yields the most recent :class:`.ModNote` (or ``None``
    if the user doesn't have any notes) per entry in their relative order. If
    ``all_notes`` is ``True``, this will yield all notes for each entry.

.. note::

    This method will merge the subreddits and redditors provided from ``pairs``,
    ``redditors``, ``subreddits``, and ``things``.

.. note::

    This method accepts :class:`.Redditor` instances or redditor names and
    :class:`.Subreddit` instances or subreddit names where applicable.

For example, the latest note for u/spez in r/redditdev and r/test, and for
u/bboe in r/redditdev can be iterated through like so:

.. code-block:: python

    redditor = reddit.redditor("bboe")
    subreddit = reddit.subreddit("redditdev")

    pairs = [(subreddit, "spez"), ("test", "spez"), (subreddit, redditor)]

    for note in reddit.notes(pairs=pairs):
        print(f"{note.label}: {note.note}")

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

.. code-block:: python

    redditor = reddit.redditor("bboe")
    subreddit = reddit.subreddit("redditdev")

    for note in reddit.notes(
        redditors=["spez", redditor],
        subreddits=["announcements", subreddit, "test"],
        all_notes=True,
    ):
        print(f"{note.label}: {note.note}")

For example, the latest note for the authors of the last 5 comments and
submissions from r/test can be iterated through like so:

.. code-block:: python

    submissions = list(reddit.subreddit("test").new(limit=5))
    comments = list(reddit.subreddit("test").comments(limit=5))

    for note in reddit.notes(things=submissions + comments):
        print(f"{note.label}: {note.note}")

.. note::

    Setting ``all_notes`` to ``True`` will make a request for each redditor and
    subreddit combination. The previous example will make 6 requests.

zWEither the 'pairs', 'redditors', 'subreddits', or 'things' parameters must be provided.r   z;'redditors' must be non-empty if 'subreddits' is not empty.z;'subreddits' must be non-empty if 'redditors' is not empty.z1Cannot get subreddit and author fields from type )rL   r   setr`   r   r   appendrd   namer    display_namer	   typer   rT   )r   rR   r   r+   r,   r   r!   rm   merged_redditorsmerged_subredditsr   r    itemsitems                 r   __call__RedditModNotes.__call__  s   Z =EIJ>F!J.7kCC. 	NS_,1IZ014z?Q& N  S   !$I .H!$ZI %!0 & .  	 D$* 566 ''(8(89!(()D)DED%((&*#	 ''1!((3I$t*V o%  {{):
>N
 	
's    Fr   c                    / n/ nU H9  nUR                  UR                  5        UR                  UR                  5        M;     Uc  [        U5      S:H  nU R                  " XU40 UD6$ )a  Return notes associated with the author of a :class:`.Comment` or :class:`.Submission`.

:param things: One or more things to return notes on. Must be a
    :class:`.Comment` or :class:`.Submission`.
:param all_notes: Whether to return all notes, or only the latest (default:
    ``True`` if only one thing is provided otherwise ``False``).

    .. note::

        Setting this to ``True`` will result in a request for each thing.


:returns: A generator that yields the most recent :class:`.ModNote` (or ``None``
    if the user doesn't have any notes) per entry in their relative order. If
    ``all_notes`` is ``True``, this will yield all notes for each entry.

For example, to get the latest note for the authors of the top 25 submissions in
r/test:

.. code-block:: python

    submissions = reddit.subreddit("test").top(limit=25)
    for note in reddit.notes.things(*submissions):
        print(f"{note.label}: {note.note}")

For example, to get the latest note for the authors of the last 25 comments in
r/test:

.. code-block:: python

    comments = reddit.subreddit("test").comments(limit=25)
    for note in reddit.notes.things(*comments):
        print(f"{note.label}: {note.note}")

r   )r   r    rd   r   rT   )r   rR   r   r!   r,   r+   rW   s          r   r   RedditModNotes.things  sj    R 
	Eeoo.U\\*  Fq(I{{9P?OPPr   ry   )rp   rq   rr   rs   rt   rw   r   r   r	   rv   ru   	ThingTyper   r   r   r   rx   ry   r   r   r   r     s    0  DH2648,0[
 [
 U=,#>?@A	[

 D./[
 T-01[
 i)[
  [
 
4	5[
@ %)0Q0Q D>0Q  	0Q
 
4	50Q 0Qr   r   )!rt   	itertoolsr   typingr   r   r   r   r   r	   r
   constr   baser   listing.generatorr   reddit.commentr   reddit.redditorr   reddit.submissionr   praw.modelsprawr:   ru   rv   r   r   r{   r   r   ry   r   r   <module>r      s    <  N N N   / # % )Xs]#-s23':%&	}F }F@]
| ]
@]
 ]
@cQ\ cQr   