o
    2g	                     @  sF   d 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Z	dS )	z Provide the EditableMixin class.    )annotations)TYPE_CHECKING   )API_PATHNc                   @  s"   e Zd ZdZdd Zddd	Zd
S )EditableMixinz5Interface for classes that can be edited and deleted.c                 C  s   | j jtd d| jid dS )zDelete the object.

        Example usage:

        .. code-block:: python

            comment = reddit.comment("dkk4qjd")
            comment.delete()

            submission = reddit.submission("8dmv8z")
            submission.delete()

        deliddataN)_redditpostr   fullname)self r   Z/home/garg/my-data/venv/lib/python3.10/site-packages/praw/models/reddit/mixins/editable.pydelete   s   zEditableMixin.deletebodystrreturn,praw.models.Comment | praw.models.Submissionc                 C  sZ   || j | jjd}| jjtd |dd }dD ]}||jv r#t|| q| j|j | S )a  Replace the body of the object with ``body``.

        :param body: The Markdown formatted content for the updated object.

        :returns: The current instance after updating its attributes.

        Example usage:

        .. code-block:: python

            comment = reddit.comment("dkk4qjd")

            # construct the text of an edited comment
            # by appending to the old body:
            edited_body = comment.body + "Edit: thanks for the gold!"
            comment.edit(edited_body)

        )textthing_idvalidate_on_submiteditr	   r   )_fetchedr   _submissionreplies	subreddit)r   r   r   r   r   __dict__delattrupdate)r   r   r
   updated	attributer   r   r   r       s   

zEditableMixin.editN)r   r   r   r   )__name__
__module____qualname____doc__r   r   r   r   r   r   r      s    r   )
r&   
__future__r   typingr   constr   praw.modelsprawr   r   r   r   r   <module>   s    