
    {i!                        S 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Jr  S	S
KJr  \(       a  SSKr " S S\5      r " S S5      rg)z!Provide the Removal Reason class.    )annotations)TYPE_CHECKINGAnyIterator)warn   )API_PATH)ClientException)_deprecate_argscachedproperty   )
RedditBaseNc                     ^  \ rS rSrSrSr\      SS j5       rSS jrSS jr	   S         SU 4S jjjr
U 4S	 jrS
 r\" SS5      SSS.SS jj5       rSrU =r$ )RemovalReason   a}  An individual Removal Reason object.

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

=========== ==================================
Attribute   Description
=========== ==================================
``id``      The ID of the removal reason.
``message`` The message of the removal reason.
``title``   The title of the removal reason.
=========== ==================================

idc                .    Ub  [        S[        SS9  U$ U $ )zReason ID param is deprecated. Warns if it's used.

:param id_value: Returns the actual value of parameter ``id`` is parameter
    ``reason_id`` is not used.
:param reason_id_value: The value passed as parameter ``reason_id``.

zParameter 'reason_id' is deprecated. Either use positional arguments (e.g., reason_id="x" -> "x") or change the parameter name to 'id' (e.g., reason_id="x" -> id="x"). This parameter will be removed in PRAW 8.r   )category
stacklevel)r   DeprecationWarningid_valuereason_id_values     \/home/james-whalen/.local/lib/python3.13/site-packages/praw/models/reddit/removal_reasons.py_warn_reason_idRemovalReason._warn_reason_id"   s,     & , #"    c                    [        U[        5      (       a  U[        U 5      :H  $ [        XR                  5      =(       a    [        U 5      [        U5      :H  $ )z5Return whether the other instance equals the current.)
isinstancestr	__class__)selfothers     r   __eq__RemovalReason.__eq__9   s?    eS!!CI%%%0LSY#e*5LLr   c                j    [        U R                  R                  5      [        [        U 5      5      -  $ )z(Return the hash of the current instance.)hashr!   __name__r    r"   s    r   __hash__RemovalReason.__hash__?   s$    DNN++,tCI>>r   Nc                   > U R                  X4S9nXE4R                  S5      S:w  a  Sn[        U5      eU(       a  X@l        X l        [
        TU ]  XS9  g)aF  Initialize a :class:`.RemovalReason` instance.

:param reddit: An instance of :class:`.Reddit`.
:param subreddit: An instance of :class:`.Subreddit`.
:param id: The ID of the removal reason.
:param reason_id: The original name of the ``id`` parameter. Used for backwards
    compatibility. This parameter should not be used.

r   Nr   z%Either id or _data needs to be given._data)r   count
ValueErrorr   	subredditsuper__init__)r"   redditr1   r   	reason_idr.   msgr!   s          r   r3   RemovalReason.__init__C   sZ    " (("(P	##D)Q.9CS/!G"-r   c                >  > U R                   R                  R                   HR  nUR                  U R                  :X  d  M  U R                  R                  UR                  5        [        TU ]  5           g    SU R                    SU R                   3n[        U5      e)Nz
Subreddit z" does not have the removal reason )	r1   modremoval_reasonsr   __dict__updater2   _fetchr
   )r"   removal_reasonr6   r!   s      r   r=   RemovalReason._fetch^   s~    "nn00@@N  DGG+$$^%<%<= 	 A
 4>>**LTWWIVc""r   c                    [         S   R                  U R                  U R                  S9nU R                  R                  U5        g)zDelete a removal reason from this subreddit.

To delete ``"141vv5c16py7d"`` from r/test try:

.. code-block:: python

    reddit.subreddit("test").mod.removal_reasons["141vv5c16py7d"].delete()

r>   r1   r   N)r	   formatr1   r   _redditdelete)r"   urls     r   rD   RemovalReason.deleteg   s9     '(//$..TWW/UC r   messagetitlerG   rH   c          	         [         S   R                  U R                  U R                  S9nXS.R	                  5        VVs0 s H  u  pEXEc  [        X5      OU_M     nnnU R                  R                  X6S9  gs  snnf )a  Update the removal reason from this subreddit.

.. note::

    Existing values will be used for any unspecified arguments.

:param message: The removal reason's new message.
:param title: The removal reason's new title.

To update ``"141vv5c16py7d"`` from r/test try:

.. code-block:: python

    reddit.subreddit("test").mod.removal_reasons["141vv5c16py7d"].update(
        title="New title", message="New message"
    )

r>   rA   rI   Ndata)r	   rB   r1   r   itemsgetattrrC   put)r"   rG   rH   rE   namevaluerL   s          r   r<   RemovalReason.updatet   s    ( '(//$..TWW/U ,3CIIK
K '$%EAK 	 
 	(	
s   A:)r   r1   )r   
str | Noner   rS   returnrS   )r#   zstr | RemovalReasonrT   bool)rT   int)NNN)
r4   zpraw.Redditr1   praw.models.Subredditr   rS   r5   rS   r.   zdict[str, Any] | None)rG   rS   rH   rS   )r(   
__module____qualname____firstlineno____doc__	STR_FIELDstaticmethodr   r$   r*   r3   r=   rD   r   r<   __static_attributes____classcell__)r!   s   @r   r   r      s     I2<	 ,M?  $'+.. ). 	.
 . %. .6#! Y(.2 ) ))r   r   c                  l    \ rS rSrSr\SS j5       rSS jrSS jrSS jr	\
" SS5      SS	 j5       rS
rg)SubredditRemovalReasons   zFProvide a set of functions to a :class:`.Subreddit`'s removal reasons.c           	         U R                   R                  [        S   R                  U R                  S95      nUS    Vs/ s H(  n[        U R                   U R                  US   U   S9PM*     sn$ s  snf )zbGet a list of Removal Reason objects.

:returns: A list of instances of :class:`.RemovalReason`.

removal_reasons_listr1   orderrL   r-   )rC   getr	   rB   r1   r   )r"   responser5   s      r   _removal_reason_list,SubredditRemovalReasons._removal_reason_list   s     <<##+,33dnn3M
 &g.	
 /	 dnnHV4DY4O /	
 	
 
s   /A3c                    [        U[        5      (       d  U R                  U   $ [        U R                  U R
                  U5      $ )a  Return the Removal Reason with the ID/number/slice ``reason_id``.

:param reason_id: The ID or index of the removal reason

.. note::

    Removal reasons fetched using a specific rule name are lazily loaded, so you
    might have to access an attribute to get all the expected attributes.

This method is to be used to fetch a specific removal reason, like so:

.. code-block:: python

    reason_id = "141vv5c16py7d"
    reason = reddit.subreddit("test").mod.removal_reasons[reason_id]
    print(reason)

You can also use indices to get a numbered removal reason. Since Python uses
0-indexing, the first removal reason is index 0, and so on.

.. note::

    Both negative indices and slices can be used to interact with the removal
    reasons.

:raises: :py:class:`IndexError` if a removal reason of a specific number does
    not exist.

For example, to get the second removal reason of r/test:

.. code-block:: python

    reason = reddit.subreddit("test").mod.removal_reasons[1]

To get the last three removal reasons in a subreddit:

.. code-block:: python

    reasons = reddit.subreddit("test").mod.removal_reasons[-3:]
    for reason in reasons:
        print(reason)

)r   r    ri   r   rC   r1   )r"   r5   s     r   __getitem__#SubredditRemovalReasons.__getitem__   s:    X )S)),,Y77T\\4>>9EEr   c                2    Xl         UR                  U l        g)zInitialize a :class:`.SubredditRemovalReasons` instance.

:param subreddit: The subreddit whose removal reasons to work with.

N)r1   rC   )r"   r1   s     r   r3    SubredditRemovalReasons.__init__   s     # ((r   c                ,    [        U R                  5      $ )zReturn a list of Removal Reasons for the subreddit.

This method is used to discover all removal reasons for a subreddit:

.. code-block:: python

    for removal_reason in reddit.subreddit("test").mod.removal_reasons:
        print(removal_reason)

)iterri   r)   s    r   __iter__ SubredditRemovalReasons.__iter__   s     D--..r   rG   rH   c                   XS.n[         S   R                  U R                  S9nU R                  R	                  XCS9n[        U R                  U R                  U5      $ )a  Add a removal reason to this subreddit.

:param message: The message associated with the removal reason.
:param title: The title of the removal reason.

:returns: The :class:`.RemovalReason` added.

The message will be prepended with ``Hi u/username,`` automatically.

To add ``"Test"`` to r/test try:

.. code-block:: python

    reddit.subreddit("test").mod.removal_reasons.add(title="Test", message="Foobar")

rI   rd   re   rK   )r	   rB   r1   rC   postr   )r"   rG   rH   rL   rE   r5   s         r   addSubredditRemovalReasons.add   sW    $ #3-.555OLL%%c%5	T\\4>>9EEr   )rC   r1   N)rT   zlist[RemovalReason])r5   zstr | int | slicerT   r   )r1   rW   )rT   zIterator[RemovalReason])rG   r    rH   r    rT   r   )r(   rX   rY   rZ   r[   r   ri   rl   r3   rr   r   rv   r^    r   r   ra   ra      sE    P
 
 .F`)/ Y(F )Fr   ra   )r[   
__future__r   typingr   r   r   warningsr   constr	   
exceptionsr
   utilr   r   baser   prawr   ra   rx   r   r   <module>r      sC    ' " / /   ) 3 |)J |)~oF oFr   