
    cf                     ^    d dl Z d dlZd dlZd dlZddlmZ d Zd Zd Z	d Z
d ZddZd ZdS )    N   )corec                 .    d}| D ]}|d         |dz  }|S )z"
    Count boosts in statuses
    r   reblogNr    statusesiitems      e/home/feoh/.local/pipx/venvs/mastodon-archive/lib/python3.11/site-packages/mastodon_archive/report.pyboostsr      s1     	
A  >%FAH    c                 D    d}| D ]}|t          |d                   z  }|S )z-
    Count media attachments in statuses
    r   media_attachments)lenr   s      r   mediar       s7     	
A , ,	S)*+++Hr   c                     i }| D ]C}|r|d         |d         }d |d         D             D ]}||v r||xx         dz  cc<   d||<   D|S )z,
    Count all the hashtags in statuses
    r   Nc                     g | ]
}|d          S )namer   ).0tags     r   
<listcomp>ztags.<locals>.<listcomp>2   s    999SS[999r   tagsr   r   )r	   include_boostscountr   r   s        r   r   r   *   s     E     	"d8n8>D99DL999 	  	 Du}}dq d		 
 Lr   c           
      t   |dk    rt          d           n"t          dt          |          z   dz              t          | |          t                                          fd          }t          t          j        d                    fd|d	|         D                                            d
S )z)
    Print hashtags used in statuses
    zAll the hashtags:zTop z
 hashtags:c                     |           S Nr   )r   r   s    r   <lambda>zprint_tags.<locals>.<lambda>B   s    5:+ r   key c                 R    g | ]#}d |z   dz   t          |                   z   dz   $S )#())str)r   r   r   s     r   r   zprint_tags.<locals>.<listcomp>D   s5    @@@SSSs__	$S	(@@@r   r   N)printr(   r   sortedkeystextwrapfilljoin)r	   maxr   mostr   s       @r   
print_tagsr1   9   s     byy!""""fs3xx,.///>**E%**,,&=&=&=&=>>>D	(-@@@@D3K@@@B B C C D D D D Dr   c                     i }| D ]?}|d         D ]4}t          j        |          dk    r||v r||xx         dz  cc<   /d||<   5@|S )z)
    Count all the emoji in statuses
    contentSor   )unicodedatacategory)r	   r   r   chars       r   emojir8   F   sx     E $ $O 	$ 	$D#D))T115==$KKK1$KKKK"#E$K	$ Lr   
      c           
      ^   t          d           t          |           fd                                D             t                                          fd          }t          t          j        d                    d |d|         D                                            dS )	z;
    Print emoji used in statuses, sorted by frequency
    zMost frequeny Emoji:c                 (    i | ]\  }}|k    ||S r   r   )r   kvmins      r   
<dictcomp>zprint_emoji.<locals>.<dictcomp>Z   s$    999daqCxxQxxxr   c                     |           S r   r   )r8   r   s    r   r    zprint_emoji.<locals>.<lambda>[   s    U5\M r   r!   r#   c                     g | ]}|S r   r   )r   r8   s     r   r   zprint_emoji.<locals>.<listcomp>\   s    !E!E!EE%!E!E!Er   r   N)r)   r8   itemsr*   r+   r,   r-   r.   )r	   r?   max_numr0   r   s    `  @r   print_emojirE   T   s     

 !!!(OOE9999ekkmm999E%**,,&A&A&A&ABBBD	(-!E!ET!G)_!E!E!EFF
G
GHHHHHr   c                 	   | j                             d          \  }}|dz   |z   dz   }t          j        |dd| j                  }| j        r4t          d           d|v r|d         }d|v r|d         }d	|v r|d	         }nt          d
t          | j                  z   dz              d|v r t          j	        |d         | j                  }d|v r t          j	        |d         | j                  }d	|v r t          j	        |d	         | j                  }d|v r=t          d
                    d          t          t          |                                        d                     t          d
                    d          t          t          |                                        d                     t          d
                    d          t          t          |                                        d                     t                       t          || j        | j                   | j        rt                       t'          |           d|v rd|v rt                       d|v rt          d
                    d          t          t          |                                        d                     t          d
                    d          t          t          |                                        d                     t          d
                    d          t          t          |                                        d                     t                       t          || j        | j                   d|v rd	|v rt                       d	|v rt          d
                    d          t          t          |                                        d                     t          d
                    d          t          t          |                                        d                     t          d
                    d          t          t          |                                        d                     t                       t          || j        | j                   dS dS )z8
    Report on your toots, favourites and bookmarks
    @z.user.z.jsonT)requiredquietcombinezConsidering the entire archiver	   
favourites	bookmarkszConsidering the last z weeksz	Statuses:      zBoosts:zMedia:zFavourites:z
Bookmarks:N)usersplitr   loadrJ   allr)   r(   weekskeepljustr   rjustr   r   r1   topr   
with_emojirE   )argsusernamedomainstatus_filedatar	   rK   rL   s           r   reportr^   ^   s0   
 --Xv8#h.8K9[4tT\RRRDx A.///J'H4l+J$[)I%DJ  	 	 	 yj!14:>>H44#5tzBBJ$	${"3TZ@@ITk##SX%7%7%=%=a%@%@AAAioob!!3vh'7'7#8#8#>#>q#A#ABBBhnnR  #eHoo"6"6"<"<Q"?"?@@@8TXt':;;;? 	"GGG!!!Tld22tm!!"%%s3z??';';'A'A!'D'DEEEioob!!3vj'9'9#:#:#@#@#C#CDDDhnnR  #eJ&7&7"8"8">">q"A"ABBB:tx)<===tt 3 3dl  $$c#i..&9&9&?&?&B&BCCCioob!!3vi'8'8#9#9#?#?#B#BCCChnnR  #eI&6&6"7"7"="=a"@"@AAA9dh(;<<<<< r   )r9   r:   )sysos.pathosr,   r5    r   r   r   r   r1   r8   rE   r^   r   r   r   <module>rc      s     


                  D D D  I I I I== == == == ==r   