o
    2g2                     @  sR  d Z ddlmZ ddlZddlmZ ddlmZmZm	Z	 ddl
mZ ddlmZ ddlmZ d	d
lmZ d	dlmZ d	dlmZmZ ddlm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"m#Z# ddl$m%Z% ddl&m'Z' ddl(m)Z) er~ddl*Z+e,dZ-ddddZ.G dd dZ/G dd de"e!Z0G d d! d!ee#e eZ1e1e)_2dS )"zProvide the Submission class.    )annotationsN)dumps)TYPE_CHECKINGAny	Generator)urljoin)warn)Conflict   )API_PATH)
InvalidURL)_deprecate_argscachedproperty   )CommentForest)Listing)SubmissionListingMixin   )
RedditBase)FullnameMixinModNoteMixinThingModerationMixinUserContentMixin)PollData)Redditor)	Subredditzn\n\n!?(\[.*?])?\(?((https://((preview|i)\.redd\.it|reddit.com/link).*?)|(?!https)([a-zA-Z0-9]+( \".*?\")?))\)?imgvideogif)ImageRedditVideoAnimatedImagec                   @  s>   e Zd ZdZdddZddd	Zed
ddddddZdS )SubmissionFlairzDProvide a set of functions pertaining to :class:`.Submission` flair.
submissionpraw.models.Submissionc                 C  
   || _ dS )zInitialize a :class:`.SubmissionFlair` instance.

        :param submission: The :class:`.Submission` associated with the flair functions.

        N)r#   selfr#    r(   U/home/garg/my-data/venv/lib/python3.10/site-packages/praw/models/reddit/submission.py__init__)      
zSubmissionFlair.__init__return"list[dict[str, bool | list | str]]c                 C  s2   t d j| jjd}| jjj|d| jjidd S )zReturn list of available flair choices.

        Choices are required in order to use :meth:`.select`.

        For example:

        .. code-block:: python

            choices = submission.flair.choices()

        flairselector	subredditlinkdatachoices)r   formatr#   r0   _redditpostfullname)r'   urlr(   r(   r)   r4   1   s   zSubmissionFlair.choicesflair_template_idtextN)r;   str
str | Nonec                C  s:   || j j|d}td j| j jd}| j jj||d dS )a  Select flair for submission.

        :param flair_template_id: The flair template to select. The possible values can
            be discovered through :meth:`.choices`.
        :param text: If the template's ``flair_text_editable`` value is ``True``, this
            value will set a custom text (default: ``None``).

        For example, to select an arbitrary editable flair text (assuming there is one)
        and set a custom value try:

        .. code-block:: python

            choices = submission.flair.choices()
            template_id = next(x for x in choices if x["flair_text_editable"])["flair_template_id"]
            submission.flair.select(template_id, text="my custom value")

        )r:   r1   r;   select_flairr/   r2   N)r#   r8   r   r5   r0   r6   r7   )r'   r:   r;   r3   r9   r(   r(   r)   selectB   s   zSubmissionFlair.selectr#   r$   )r,   r-   )r:   r<   r;   r=   )__name__
__module____qualname____doc__r*   r4   r   r?   r(   r(   r(   r)   r"   &   s    

r"   c                   @  s   e Zd ZdZdZd1ddZeddd	d2ddZedddddddd3ddZdd Z	dd Z
dd Zdd Zeddddd d4d"d#Zed$d%d&d5d'd(Zd)d* Zd+d, Zd6d/d0ZdS )7SubmissionModerationzProvide a set of functions pertaining to :class:`.Submission` moderation.

    Example usage:

    .. code-block:: python

        submission = reddit.submission("8dmv8z")
        submission.mod.approve()

    removal_link_messager#   r$   c                 C  r%   )zwInitialize a :class:`.SubmissionModeration` instance.

        :param submission: The submission to moderate.

        N)thingr&   r(   r(   r)   r*   l   r+   zSubmissionModeration.__init__stateT)rH   boolc                C  $   | j jjtd | j j|dd dS )a  Set contest mode for the comments of this submission.

        :param state: ``True`` enables contest mode and ``False`` disables (default:
            ``True``).

        Contest mode have the following effects:

        - The comment thread will default to being sorted randomly.
        - Replies to top-level comments will be hidden behind "[show replies]" buttons.
        - Scores will be hidden from non-moderators.
        - Scores accessed through the API (mobile apps, bots) will be obscured to "1"
          for non-moderators.

        Example usage:

        .. code-block:: python

            submission = reddit.submission("5or86n")
            submission.mod.contest_mode()

        contest_modeidrH   r2   NrG   r6   r7   r   r8   )r'   rH   r(   r(   r)   rK   t   s   
z!SubmissionModeration.contest_moder;   	css_classr:    N)rO   r:   r;   r<   r=   c                C  s^   || j j|d}td j| j jd}|dur$||d< td j| j jd}| j jj||d dS )a|  Set flair for the submission.

        :param css_class: The css class to associate with the flair html (default:
            ``""``).
        :param flair_template_id: The flair template ID to use when flairing.
        :param text: The flair text to associate with the :class:`.Submission` (default:
            ``""``).

        This method can only be used by an authenticated user who is a moderator of the
        submission's :class:`.Subreddit`.

        Example usage:

        .. code-block:: python

            submission = reddit.submission("5or86n")
            submission.mod.flair(text="PRAW", css_class="bot")

        )rO   r1   r;   flairr/   Nr:   r>   r2   )rG   r8   r   r5   r0   r6   r7   )r'   rO   r:   r;   r3   r9   r(   r(   r)   rQ      s   zSubmissionModeration.flairc                 C  "   | j jjtd d| j jid dS )a  Mark as not safe for work.

        This method can be used both by the submission author and moderators of the
        subreddit that the submission belongs to.

        Example usage:

        .. code-block:: python

            submission = reddit.subreddit("test").submit("nsfw test", selftext="nsfw")
            submission.mod.nsfw()

        .. seealso::

            :meth:`.sfw`

        marknsfwrM   r2   NrN   r'   r(   r(   r)   nsfw      "zSubmissionModeration.nsfwc                 C  s6   | j j| j jdd| j jd}| j jjtd |d dS )a  Mark as original content.

        This method can be used by moderators of the subreddit that the submission
        belongs to. If the subreddit has enabled the Original Content beta feature in
        settings, then the submission's author can use it as well.

        Example usage:

        .. code-block:: python

            submission = reddit.subreddit("test").submit("oc test", selftext="original")
            submission.mod.set_original_content()

        .. seealso::

            :meth:`.unset_original_content`

        TFrM   r8   should_set_ocexecutedrset_original_contentr2   NrG   rM   r8   r0   r6   r7   r   r'   r3   r(   r(   r)   r[         z)SubmissionModeration.set_original_contentc                 C  rR   )ag  Mark as safe for work.

        This method can be used both by the submission author and moderators of the
        subreddit that the submission belongs to.

        Example usage:

        .. code-block:: python

            submission = reddit.submission("5or86n")
            submission.mod.sfw()

        .. seealso::

            :meth:`.nsfw`

        
unmarknsfwrM   r2   NrN   rT   r(   r(   r)   sfw   s   
zSubmissionModeration.sfwc                 C  rR   )a  Indicate that the submission contains spoilers.

        This method can be used both by the submission author and moderators of the
        subreddit that the submission belongs to.

        Example usage:

        .. code-block:: python

            submission = reddit.submission("5or86n")
            submission.mod.spoiler()

        .. seealso::

            :meth:`.unspoiler`

        spoilerrM   r2   NrN   rT   r(   r(   r)   ra      rV   zSubmissionModeration.spoilerbottom)rb   rH   r,   c                C  sH   | j j|d}|sd|d< z| j jjtd |dW S  ty#   Y dS w )a  Set the submission's sticky state in its subreddit.

        :param bottom: When ``True``, set the submission as the bottom sticky. If no top
            sticky exists, this submission will become the top sticky regardless
            (default: ``True``).
        :param state: ``True`` sets the sticky for the submission and ``False`` unsets
            (default: ``True``).

        :returns: The stickied submission object.

        .. note::

            When a submission is stickied two or more times, the Reddit API responds
            with a 409 error that is raised as a ``Conflict`` by prawcore. This method
            suppresses these ``Conflict`` errors.

        This submission will replace the second stickied submission if one exists.

        For example:

        .. code-block:: python

            submission = reddit.submission("5or86n")
            submission.mod.sticky()

        rL   r   numsticky_submissionr2   N)rG   r8   r6   r7   r   r	   )r'   rb   rH   r3   r(   r(   r)   sticky  s   zSubmissionModeration.stickysortblank)rf   c                C  rJ   )a  Set the suggested sort for the comments of the submission.

        :param sort: Can be one of: ``"confidence"``, ``"top"``, ``"new"``,
            ``"controversial"``, ``"old"``, ``"random"``, ``"qa"``, or ``"blank"``
            (default: ``"blank"``).

        suggested_sort)rM   rf   r2   NrN   )r'   rf   r(   r(   r)   rh   5  s   	
z#SubmissionModeration.suggested_sortc                 C  s6   | j j| j jdd| j jd}| j jjtd |d dS )a3  Indicate that the submission is not original content.

        This method can be used by moderators of the subreddit that the submission
        belongs to. If the subreddit has enabled the Original Content beta feature in
        settings, then the submission's author can use it as well.

        Example usage:

        .. code-block:: python

            submission = reddit.subreddit("test").submit("oc test", selftext="original")
            submission.mod.unset_original_content()

        .. seealso::

            :meth:`.set_original_content`

        FrW   r[   r2   Nr\   r]   r(   r(   r)   unset_original_contentB  r^   z+SubmissionModeration.unset_original_contentc                 C  rR   )a  Indicate that the submission does not contain spoilers.

        This method can be used both by the submission author and moderators of the
        subreddit that the submission belongs to.

        For example:

        .. code-block:: python

            submission = reddit.subreddit("test").submit("not spoiler", selftext="spoiler")
            submission.mod.unspoiler()

        .. seealso::

            :meth:`.spoiler`

        	unspoilerrM   r2   NrN   rT   r(   r(   r)   rj   ^  rV   zSubmissionModeration.unspoilerlevelintc                 C  rJ   )u  Change the Crowd Control level of the submission.

        :param level: An integer between 0 and 3.

        **Level Descriptions**

        ===== ======== ================================================================
        Level Name     Description
        ===== ======== ================================================================
        0     Off      Crowd Control will not action any of the submission's comments.
        1     Lenient  Comments from users who have negative karma in the subreddit are
                       automatically collapsed.
        2     Moderate Comments from new users and users with negative karma in the
                       subreddit are automatically collapsed.
        3     Strict   Comments from users who haven’t joined the subreddit, new users,
                       and users with negative karma in the subreddit are automatically
                       collapsed.
        ===== ======== ================================================================

        Example usage:

        .. code-block:: python

            submission = reddit.submission("745ryj")
            submission.mod.update_crowd_control_level(2)

        .. seealso::

            :meth:`~.CommentModeration.show`

        update_crowd_control)rM   rk   r2   NrN   )r'   rk   r(   r(   r)   update_crowd_control_levelr  s    
z/SubmissionModeration.update_crowd_control_levelr@   )rH   rI   )rO   r<   r:   r=   r;   r<   )rb   rI   rH   rI   r,   r$   )rf   r<   )rk   rl   )rA   rB   rC   rD   REMOVAL_MESSAGE_APIr*   r   rK   rQ   rU   r[   r`   ra   re   rh   ri   rj   rn   r(   r(   r(   r)   rE   ^   s.    

%%rE   c                      sB  e Zd ZdZdZedSddZedTd	d
ZedUddZ	e
dVddZe
dWddZe
dVddZ			dXdY fddZdZ fd d!Zd[d'd(Zd)dd*d\d1d2Z fd3d4Zd5d6 Zd7d8 Zd]d;d<Zd^d>d?Zed@dAdBdCdDdEdFddd)dGd)ddHd_dJdKZed$ddLd`dMdNZdOdP Zed$ddLd`dQdRZ  ZS )a
Submissiona  A class for submissions to Reddit.

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

    ========================== =========================================================
    Attribute                  Description
    ========================== =========================================================
    ``author``                 Provides an instance of :class:`.Redditor`.
    ``author_flair_text``      The text content of the author's flair, or ``None`` if
                               not flaired.
    ``clicked``                Whether or not the submission has been clicked by the
                               client.
    ``comments``               Provides an instance of :class:`.CommentForest`.
    ``created_utc``            Time the submission was created, represented in `Unix
                               Time`_.
    ``distinguished``          Whether or not the submission is distinguished.
    ``edited``                 Whether or not the submission has been edited.
    ``id``                     ID of the submission.
    ``is_original_content``    Whether or not the submission has been set as original
                               content.
    ``is_self``                Whether or not the submission is a selfpost (text-only).
    ``link_flair_template_id`` The link flair's ID.
    ``link_flair_text``        The link flair's text content, or ``None`` if not
                               flaired.
    ``locked``                 Whether or not the submission has been locked.
    ``name``                   Fullname of the submission.
    ``num_comments``           The number of comments on the submission.
    ``over_18``                Whether or not the submission has been marked as NSFW.
    ``permalink``              A permalink for the submission.
    ``poll_data``              A :class:`.PollData` object representing the data of this
                               submission, if it is a poll submission.
    ``saved``                  Whether or not the submission is saved.
    ``score``                  The number of upvotes for the submission.
    ``selftext``               The submissions' selftext - an empty string if a link
                               post.
    ``spoiler``                Whether or not the submission has been marked as a
                               spoiler.
    ``stickied``               Whether or not the submission is stickied.
    ``subreddit``              Provides an instance of :class:`.Subreddit`.
    ``title``                  The title of the submission.
    ``upvote_ratio``           The percentage of upvotes from all votes on the
                               submission.
    ``url``                    The URL the submission links to, or the permalink if a
                               selfpost.
    ========================== =========================================================

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

    rM   r9   r<   r,   c                 C  s   t | }d|vrd|vr|d }d|v rt| ddn#d|v r*||dd  }n|d dkr6t| dd||dd  }| sGt| |S )	a  Return the ID contained within a submission URL.

        :param url: A url to a submission in one of the following formats (http urls
            will also work):

            - ``"https://redd.it/2gmzqe"``
            - ``"https://reddit.com/comments/2gmzqe/"``
            - ``"https://www.reddit.com/r/redditdev/comments/2gmzqe/praw_https/"``
            - ``"https://www.reddit.com/gallery/2gmzqe"``

        :raises: :class:`.InvalidURL` if ``url`` is not a valid submission URL.

        commentsgalleryrZ   z+Invalid URL (subreddit, not submission): {})messager   z+Invalid URL (submission ID not present): {})r   
_url_partsr   indexisalnum)r9   partssubmission_idr(   r(   r)   id_from_url  s    
zSubmission.id_from_urlr"   c                 C     t | S )a\  Provide an instance of :class:`.SubmissionFlair`.

        This attribute is used to work with flair as a regular user of the subreddit the
        submission belongs to. Moderators can directly use :meth:`.flair`.

        For example, to select an arbitrary editable flair text (assuming there is one)
        and set a custom value try:

        .. code-block:: python

            choices = submission.flair.choices()
            template_id = next(x for x in choices if x["flair_text_editable"])["flair_template_id"]
            submission.flair.select(template_id, text="my custom value")

        )r"   rT   r(   r(   r)   rQ     s   zSubmission.flairrE   c                 C  r{   )zProvide an instance of :class:`.SubmissionModeration`.

        Example usage:

        .. code-block:: python

            submission = reddit.submission("8dmv8z")
            submission.mod.approve()

        )rE   rT   r(   r(   r)   mod  s   zSubmission.modc                 C  s   | j jjd S )zReturn the class's kind.r#   )r6   configkindsrT   r(   r(   r)   _kind  s   zSubmission._kindr   c                 C  s   | j S )a  Provide an instance of :class:`.CommentForest`.

        This attribute can be used, for example, to obtain a flat list of comments, with
        any :class:`.MoreComments` removed:

        .. code-block:: python

            submission.comments.replace_more(limit=0)
            comments = submission.comments.list()

        Sort order and comment limit can be set with the ``comment_sort`` and
        ``comment_limit`` attributes before comments are fetched, including any call to
        :meth:`.replace_more`:

        .. code-block:: python

            submission.comment_sort = "new"
            comments = submission.comments.list()

        .. note::

            The appropriate values for ``"comment_sort"`` include ``"confidence"``,
            ``"controversial"``, ``"new"``, ``"old"``, ``"q&a"``, and ``"top"``

        See :ref:`extracting_comments` for more on working with a
        :class:`.CommentForest`.

        )	_commentsrT   r(   r(   r)   rq     s   zSubmission.commentsc                 C  s   t | jjj| jS )zReturn a shortlink to the submission.

        For example, https://redd.it/eorhm is a shortlink for
        https://www.reddit.com/r/announcements/comments/eorhm/reddit_30_less_typing/.

        )r   r6   r}   	short_urlrM   rT   r(   r(   r)   	shortlink8  s   zSubmission.shortlinkNredditpraw.Redditr=   _datadict[str, Any] | Nonec                   sh   |||f ddkrd}t|d| _d| _|r|| _n|r$| || _t j||d i | _i | _	dS )a2  Initialize a :class:`.Submission` instance.

        :param reddit: An instance of :class:`.Reddit`.
        :param id: A reddit base36 submission ID, e.g., ``"2gmzqe"``.
        :param url: A URL supported by :meth:`.id_from_url`.

        Either ``id`` or ``url`` can be provided, but not both.

        Nr   z8Exactly one of 'id', 'url', or '_data' must be provided.i   
confidencer   )
count	TypeErrorcomment_limitcomment_sortrM   rz   superr*   _additional_fetch_params_comments_by_id)r'   r   rM   r9   r   msg	__class__r(   r)   r*   B  s   
zSubmission.__init__	attributevaluer   c                   s   |dkrt | j|}n2|dkrt| j|}n'|dkr"t| j|}n|dkr>t| dr>| jr>t| dr>| jjjr>t	ddd	 t
 || d
S )z6Objectify author, subreddit, and poll data attributes.authorr0   	poll_datar   _fetchedr6   zqThe comments for this submission have already been fetched, so the updated comment_sort will not have any effect.r   
stacklevelN)r   	from_datar6   r   r   hasattrr   r}   warn_comment_sortr   r   __setattr__)r'   r   r   r   r(   r)   r   d  s(   zSubmission.__setattr__
chunk_sizerl   other_submissions#list[praw.models.Submission] | NoneGenerator[str, None, None]c                c  sR    | j g}|r|dd |D 7 }tdt||D ]}d|||d  V  qd S )Nc                 S  s   g | ]}|j qS r(   )r8   ).0xr(   r(   r)   
<listcomp>  s    z%Submission._chunk.<locals>.<listcomp>r   ,2   )r8   rangelenjoin)r'   r   r   all_submissionspositionr(   r(   r)   _chunkz  s   zSubmission._chunkF)preserve_inline_mediainline_mediabodyr   rI   r   )dict[str, praw.models.InlineMedia] | Noner$   c          	        s    j  jjd}d}t|r jrd}|r)|jdi  fdd| D }d}|r? j	|}|r8 
| t||d< n||d<  jjtd |d	}|sk|d
 }dD ]}||jv rat|| qU j|j  S  j|  S )a  Replace the body of the object with ``body``.

        :param body: The Markdown formatted content for the updated object.
        :param preserve_inline_media: Attempt to preserve inline media in ``body``.

            .. danger::

                This method is experimental. It is reliant on undocumented API endpoints
                and may result in existing inline media not displaying correctly and/or
                creating a malformed body. Use at your own risk. This method may be
                removed in the future without warning.

        :param inline_media: A dict of :class:`.InlineMedia` objects where the key is
            the placeholder name in ``body``.

        :returns: The current instance after updating its attributes.

        Example usage:

        .. code-block:: python

            from praw.models import InlineGif, InlineImage, InlineVideo

            submission = reddit.submission("5or86n")
            gif = InlineGif(path="path/to/image.gif", caption="optional caption")
            image = InlineImage(path="path/to/image.jpg", caption="optional caption")
            video = InlineVideo(path="path/to/video.mp4", caption="optional caption")
            body = "New body with a gif {gif1} an image {image1} and a video {video1} inline"
            media = {"gif1": gif, "image1": image, "video1": video}
            submission._edit_experimental(submission.selftext + body, inline_media=media)

        )thing_idvalidate_on_submitFTc                   s   i | ]\}}| j |qS r(   )r0   _upload_inline_media)r   placeholdermediarT   r(   r)   
<dictcomp>      z1Submission._edit_experimental.<locals>.<dictcomp>richtext_jsonr;   editr2   r   )r   r6   _submissionrepliesr0   Nr(   )r8   r6   r   INLINE_MEDIA_PATTERNsearchmedia_metadatar5   itemsr0   _convert_to_fancypants_replace_richtext_linksr   r7   r   __dict__delattrupdate)	r'   r   r   r   r3   is_richtext_jsonr   updatedr   r(   rT   r)   _edit_experimental  s<   (



zSubmission._edit_experimentalc                   s   |   }|\}}t| j|d d}|d d d d }t| | j|d}t|d t|d t| |_| j|j | j	
|j t   d S )Nr3   r   childrenr   r   r   )_fetch_datar   r6   typer   r   r   r   r   rq   _updater   r   _fetch)r'   r3   submission_listingcomment_listingsubmission_datar#   r   r(   r)   r     s   


zSubmission._fetchc                 C  sD   |   \}}}|| j  t| jdi |}| jjd||dS )NGET)methodparamspathr(   )_fetch_infor   r   copyr   r5   r6   request)r'   namefieldsr   r   r(   r(   r)   r     s   zSubmission._fetch_datac                 C  s   dd| j i| j| jdfS )Nr#   rM   )limitrf   )rM   r   r   rT   r(   r(   r)   r     s   zSubmission._fetch_infor   dictc                 C  s   dd | j  D }t|d d d  D ]g\}}|d}t|tr.|ddv s-J dq|dD ]G}|ddkrzt|}|d	 d
d dd }|t	d|}	|	rz|	
 }	||	 |	d}
|d|d	krt|d |
d< |
|d |< q3qd S )Nc                 S  s   i | ]\}}|t |d   qS )e)MEDIA_TYPE_MAPPING)r   media_idr   r(   r(   r)   r     r   z6Submission._replace_richtext_links.<locals>.<dictcomp>documentcr   )r   r   r   zDUnexpected richtext JSON schema. Please file a bug report with PRAW.r1   uzhttps://r   ?r   z[./])r   rM   t)r   r   	enumerateget
isinstancer<   setsplitintersectionrepop)r'   r   parsed_media_typesrv   elementelement_itemsitemidsr9   
matched_idcorrect_elementr(   r(   r)   r     s4   

z"Submission._replace_richtext_linkskeyc                 C  sN   t | dr | jr t | dr | jjjr td| jj  ddd || j	|< dS )a  Add a parameter to be used for the next fetch.

        :param key: The key of the fetch parameter.
        :param value: The value of the fetch parameter.

        For example, to fetch a submission with the ``rtjson`` attribute populated:

        .. code-block:: python

            submission = reddit.submission("mcqjl8")
            submission.add_fetch_param("rtj", "all")
            print(submission.rtjson)

        r   r6   zThis zZ has already been fetched, so adding additional fetch parameters will not have any effect.r   r   N)
r   r   r6   r}   warn_additional_fetch_paramsr   r   rA   lowerr   )r'   r   r   r(   r(   r)   add_fetch_param  s   zSubmission.add_fetch_paramr0   titlesend_repliesflair_id
flair_textrU   ra   T)r   r   rU   r   ra   r   praw.models.Subredditc                C  sr   |du r| j }t||t|d| jt|t|d}d|fd|ffD ]\}	}
|
dur.|
||	< q"| jjtd |dS )a)  Crosspost the submission to a subreddit.

        .. note::

            Be aware you have to be subscribed to the target subreddit.

        :param subreddit: Name of the subreddit or :class:`.Subreddit` object to
            crosspost into.
        :param flair_id: The flair template to select (default: ``None``).
        :param flair_text: If the template's ``flair_text_editable`` value is ``True``,
            this value will set a custom text (default: ``None``).
        :param nsfw: Whether the submission should be marked NSFW (default: ``False``).
        :param send_replies: When ``True``, messages will be sent to the created
            submission's author when comments are made to the submission (default:
            ``True``).
        :param spoiler: Whether the submission should be marked as a spoiler (default:
            ``False``).
        :param title: Title of the submission. Will use this submission's title if
            ``None`` (default: ``None``).

        :returns: A :class:`.Submission` object for the newly created submission.

        Example usage:

        .. code-block:: python

            submission = reddit.submission("5or86n")
            cross_post = submission.crosspost("learnprogramming", send_replies=False)

        .. seealso::

            :meth:`.hide`

        N	crosspost)srr   sendreplieskindcrosspost_fullnamerU   ra   r   r   submitr2   )r   r<   rI   r8   r6   r7   r   )r'   r0   r   r   rU   r   ra   r   r3   r   r   r(   r(   r)   r   ,  s   6	zSubmission.crosspost)r   c                C  0   | j d|dD ]}| jjtd d|id qdS )a  Hide :class:`.Submission`.

        :param other_submissions: When provided, additionally hide this list of
            :class:`.Submission` instances as part of a single request (default:
            ``None``).

        Example usage:

        .. code-block:: python

            submission = reddit.submission("5or86n")
            submission.hide()

        .. seealso::

            :meth:`.unhide`

        r   r   r   hiderM   r2   Nr   r6   r7   r   r'   r   submissionsr(   r(   r)   r  t  
   
zSubmission.hidec                 C  s"   d| j i}| jjtd |d dS )zMark submission as visited.

        This method requires a subscription to reddit premium.

        Example usage:

        .. code-block:: python

            submission = reddit.submission("5or86n")
            submission.mark_visited()

        linksstore_visitsr2   N)r8   r6   r7   r   r]   r(   r(   r)   mark_visited  s   
zSubmission.mark_visitedc                C  r  )a  Unhide :class:`.Submission`.

        :param other_submissions: When provided, additionally unhide this list of
            :class:`.Submission` instances as part of a single request (default:
            ``None``).

        Example usage:

        .. code-block:: python

            submission = reddit.submission("5or86n")
            submission.unhide()

        .. seealso::

            :meth:`.hide`

        r   r  unhiderM   r2   Nr  r  r(   r(   r)   r    r  zSubmission.unhide)r9   r<   r,   r<   )r,   r"   )r,   rE   )r,   r<   )r,   r   )NNN)r   r   rM   r=   r9   r=   r   r   )r   r<   r   r   )r   rl   r   r   r,   r   )r   r<   r   rI   r   r   r,   r$   )r   r   )r   r<   r   r<   )r0   r   r   r=   r   r=   rU   rI   r   rI   ra   rI   r   r=   r,   r$   )r   r   )rA   rB   rC   rD   	STR_FIELDstaticmethodrz   r   rQ   r|   propertyr   rq   r   r*   r   r   r   r   r   r   r   r   r   r   r  r
  r  __classcell__r(   r(   r   r)   rp     sd    2# "
N

?rp   )3rD   
__future__r   r   jsonr   typingr   r   r   urllib.parser   warningsr   prawcorer	   constr   
exceptionsr   utilr   r   comment_forestr   listing.listingr   listing.mixinsr   baser   mixinsr   r   r   r   pollr   redditorr   r0   r   praw.modelsprawcompiler   r   r"   rE   rp   _submission_classr(   r(   r(   r)   <module>   sL    8  <    
#