o
    CU6gP                  
   @  s4  d Z ddlmZ dgZddl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mZmZmZmZmZ dd
lmZ ddlmZmZ ddlmZ eeZe	G dd deZd=ddZeeedZ zddl!m"Z" W n  e#y Z$ zddl%m&Z& e&de$e edZ"W Y dZ$[$ndZ$[$ww d>ddZ'e"j(Z)e"j*Z*e"j+Z+e"j,Z,e"j-Z-d?ddZ.ee'dZ/e/d@d!d"Z0e/dAd$d%Z1e/dBd'd(Z2e/dCd*d+Z3esze"j4 e"j5 e"j6 W n  e7y Z8 ze9e8 d, d-d. Z:d/Z;W Y dZ8[8ndZ8[8ww e/Z:d0Z;ne/Z:e:dDd2d3Z<e:dEd5d6Z=e:dFd8d9Z>dGd;d<Z?dS )Hz0
Reddit data: saved items/comments/upvotes/etc.
    )annotationsz(git+https://github.com/karlicoss/rexportN)IteratorSequence)	dataclass)Path)TYPE_CHECKING)PathsStats	get_filesmake_loggerstatwarnings)mcachew)Attrsmake_config)redditc                   @  s   e Zd ZU dZded< dS )r   zH
    Uses [[https://github.com/karlicoss/rexport][rexport]] output.
    r   export_pathN)__name__
__module____qualname____doc____annotations__ r   r   +/home/garg/my-data/HPI/my/reddit/rexport.pyr       s   
 r   attrsr   returnc                 C  sh   d| v rt | d ttfs| d }|j| d< | S td d}|| v r2| | | d< td| d | S )Nrexportr   zDEPRECATED! Please modify your reddit config to look like:

class reddit:
    class rexport:
        export_path: Paths = '/path/to/rexport/data'
            
export_dir"z3" is deprecated! Please use "export_path" instead.")
isinstancestrr   r   r   high)r   exr   r   r   r   	migration+   s   
r#   )r#   )dal)pre_pip_dal_handlerr   )requiresSequence[Path]c                   C  s
   t tjS N)r
   configr   r   r   r   r   inputsQ   s   
r*   dal.DALc                  C  sR   t t } d}|ttjjv }|rddlm} || i}ni }tj| fi |S )Ncpu_poolr   )get_cpu_pool)	listr*   inspect	signaturer$   DAL
parametersmy.core._cpu_poolr-   )sourcescpu_pool_argpass_cpu_poolr-   kwargsr   r   r   _dalc   s   
r8   )
depends_onIterator[Save]c                   C  
   t   S r(   )r8   savedr   r   r   r   r<   v      
r<   Iterator[Comment]c                   C  r;   r(   )r8   commentsr   r   r   r   r?   {   r=   r?   Iterator[Submission]c                   C  r;   r(   )r8   submissionsr   r   r   r   rA      r=   rA   Iterator[Upvote]c                   C  r;   r(   )r8   upvotedr   r   r   r   rC      r=   rC   z' : please update "rexport" installationc                 C  s   | S r(   r   )fr   r   r   <lambda>   s    rE   FTIterator[dal.Subreddit]c                   C  r;   r(   )r8   
subredditsr   r   r   r   rG      r=   rG   Iterator[dal.Multireddit]c                   C  r;   r(   )r8   multiredditsr   r   r   r   rI      r=   rI   dal.Profilec                   C  r;   r(   )r8   profiler   r   r   r   rK      r=   rK   r	   c                   C  s$   i t tt tt tt tS r(   )r   r<   r?   rA   rC   r   r   r   r   stats   s   rL   )r   r   r   r   )r   r'   )r   r+   )r   r:   )r   r>   )r   r@   )r   rB   )r   rF   )r   rH   )r   rJ   )r   r	   )@r   
__future__r   REQUIRESr/   collections.abcr   r   dataclassesr   pathlibr   typingr   my.corer   r	   r
   r   r   r   my.core.cachewr   my.core.cfgr   r   	my.configr   uconfigr   loggerr#   r)   r   r$   ModuleNotFoundErroremy.core.hpi_compatr%   r*   SidUidSaveComment
SubmissionUpvoter8   cacher<   r?   rA   rC   	SubredditProfileMultiredditAttributeErroraer!   _cache_USING_NEW_REXPORTrG   rI   rK   rL   r   r   r   r   <module>   s|     





	
