o
    2g+                     @  sd   d 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 er(dd	lZG d
d deZd	S )zProvide the MoreComments class.    )annotations)TYPE_CHECKINGAny   )API_PATH)_deprecate_args   )PRAWBaseNc                      sp   e Zd ZdZd fddZd fddZd ddZd!ddZd"ddZd#ddZ	e
dddd$ddZ  ZS )%MoreCommentsz+A class indicating there are more comments.otherstr | MoreCommentsreturnboolc                   s0   t || jr| j|jko| j|jkS t |S )zGReturn ``True`` if these :class:`.MoreComments` instances are the same.)
isinstance	__class__countchildrensuper__eq__selfr   r    O/home/garg/my-data/venv/lib/python3.10/site-packages/praw/models/reddit/more.pyr      s   zMoreComments.__eq__redditpraw.Reddit_datadict[str, Any]c                   s2   d | _ | _g | _t j||d d| _d| _dS )z-Initialize a :class:`.MoreComments` instance.N)r   )r   	parent_idr   r   __init__	_comments
submission)r   r   r   r   r   r   r      s
   
zMoreComments.__init__c                 C  s   | j |j kS )z:Provide a sort order on the :class:`.MoreComments` object.)r   r   r   r   r   __lt__    s   zMoreComments.__lt__strc                 C  sB   | j dd }t| j dkrd|d< d| jj d| j d|dS )	z?Return an object initialization representation of the instance.N   z...<z count=z, children=>)r   lenr   __name__r   )r   r   r   r   r   __repr__'   s   zMoreComments.__repr__updatec                 C  sL   | j rJ d| | jddd }|j| _|r#| jD ]}| j|_q| jS )N#Please file a bug report with PRAW._   )r   _load_commentr   splitrepliesr    r!   )r   r+   parentcommentr   r   r   _continue_comments.   s   

zMoreComments._continue_comments
comment_idc                 C  s`   t d j| jjd d| }| jj|| jj| jjdd\}}t|j	dks+J d|j	d S )	Nr!   )idz_/)limitsort)paramsr.   r,   r   )
r   formatr!   r6   _redditgetcomment_limitcomment_sortr(   r   )r   r5   pathr-   commentsr   r   r   r/   7   s   

zMoreComments._load_commentT)r+   list[praw.models.Comment]c                C  s|   | j du r;| jdkr| |S | jsJ dd| j| jj| jjd}| jj	t
d |d| _ |r;| j D ]}| j|_q4| j S )zIFetch and return the comments for a single :class:`.MoreComments` object.Nr   r,   ,)r   link_idr8   morechildren)data)r    r   r4   r   joinr!   fullnamer>   r;   postr   )r   r+   rE   r3   r   r   r   r@   C   s   





zMoreComments.comments)r   r   r   r   )r   r   r   r   )r   r
   r   r   )r   r#   )r+   r   )r5   r#   )r+   r   r   rA   )r)   
__module____qualname____doc__r   r   r"   r*   r4   r/   r   r@   __classcell__r   r   r   r   r
      s    



	r
   )rK   
__future__r   typingr   r   constr   utilr   baser	   praw.modelsprawr
   r   r   r   r   <module>   s    