o
    Hëi+  ã                   @   sP   d Z ddlZddlZddlZddlmZ ddlmZ dd„ Zdd„ Zd	d
„ Z	dS )uy   
ä¿®æ”¹é€šçŸ¥å
1ã€æ‰‹åŠ¨æ·»åŠ é€šçŸ¥ååˆ°é…ç½®æ–‡ä»¶
2ã€å°†é€šçŸ¥åæ”¹ä¸ºå¦‚ä¸‹è¿™ç§å½¢å¼(å››ä¹_xxxxxx_å››ä¹)
é    N)Úoc_util)Úoc_yamlc               
   C   sÜ   t j} g ag atjD ]}t|ƒ q
tj| ddD ]S\}}}dd„ |D ƒ|d d …< |D ]@}tj	 
||¡}t|dƒ}| ¡ }t|ƒ}W d   ƒ n1 sKw   Y  t|dƒ}| |¡ W d   ƒ n1 sew   Y  q*qd S )NT)Útopdownc                 S   s$   g | ]}t j |¡d  dv r|‘qS )é   )z.hz.mz.mm)ÚosÚpathÚsplitext)Ú.0Úf© r   úG/data/storage/obfuscation/tool/ObjectiveC/oc_function/g_notification.pyÚ
<listcomp>   s   $ z/modify_project_notification.<locals>.<listcomp>ÚrÚw)r   Úpath_mix_projectÚold_notify_name_listÚnew_notify_name_listr   Ú"list_need_change_notification_nameÚrandom_one_notification_namer   Úwalkr   ÚjoinÚopenÚreadÚsearch_and_replace_notificationÚwrite)r   ÚnameÚrootÚ_ÚfilesÚ	file_pathr
   Úfile_contentr   r   r   Úmodify_project_notification
   s&   


þÿ€ûþr!   c                 C   s`   t  d¡}| | ¡}|D ]!}d |dd… ¡}t|ƒ}d |¡}| ||d¡}|  ||¡} q| S )Nu   (@")(å››ä¹_)(.*?)(_å››ä¹)(")Ú r   éÿÿÿÿ)ÚreÚcompileÚfindallr   r   Úreplace)r    Úp1Úa_listÚaÚstr_aÚnew_aÚold_nameÚnew_namer   r   r   r      s   


r   c                 C   sŒ   | t v rt  | ¡}t| S d}tt dd¡ƒD ]}|t tj¡ 	¡  }q|tv r,t
| ƒS t  | ¡ t |¡ tjj | ¡ tjj |¡ |S )NÚkNotificationr   é   )r   Úindexr   ÚrangeÚrandomÚrandintÚchoicer   Úlist_random_wordsÚ
capitalizer   ÚappendÚclass_oc_fileÚtotal_words)r-   r1   r.   r   r   r   r   r   %   s   


r   )
Ú__doc__r   r3   r$   Ú
ObjectiveCr   r   r!   r   r   r   r   r   r   Ú<module>   s    
