o
    2g                     @  sJ   d Z ddlmZ ddlmZ ddlmZmZ erddlZG dd dZ	dS )z Provide the PRAWBase superclass.    )annotations)deepcopy)TYPE_CHECKINGAnyNc                   @  s6   e Zd ZdZeddd	ZedddZdddZdS )PRAWBasez"Superclass for all models in PRAW.	argumentsdict[str, Any]keystrnew_argumentsr   c                 K  s.   || v r
t | | ni }|| || |< dS )a*  Replace arguments[key] with a deepcopy and update.

        This method is often called when new parameters need to be added to a request.
        By calling this method and adding the new or updated parameters we can insure we
        don't modify the dictionary passed in by the caller.

        N)r   update)r   r	   r   value r   H/home/garg/my-data/venv/lib/python3.10/site-packages/praw/models/base.py_safely_add_arguments   s   
zPRAWBase._safely_add_argumentsdataredditpraw.Redditreturnc                 C  s   | ||dS )zReturn an instance of ``cls`` from ``data``.

        :param data: The structured data.
        :param reddit: An instance of :class:`.Reddit`.

        )_datar   )clsr   r   r   r   r   parse   s   zPRAWBase.parser   dict[str, Any] | Nonec                 C  s0   || _ |r| D ]\}}t| || q	dS dS )zlInitialize a :class:`.PRAWBase` instance.

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

        N)_reddititemssetattr)selfr   r   	attributer   r   r   r   __init__(   s   zPRAWBase.__init__N)r   r   r	   r
   r   r   )r   r   r   r   r   r   )r   r   r   r   )	__name__
__module____qualname____doc__staticmethodr   classmethodr   r   r   r   r   r   r      s    	r   )
r"   
__future__r   copyr   typingr   r   prawr   r   r   r   r   <module>   s    