o
    az                     @   s>   d dl Z d dlZd dlZd dlZd dlmZ G dd dZdS )    N)Papidc                   @   s(   e Zd Zdd Zd	ddZd	ddZdS )
Plumic                 C   s   || _ t | _d S )N)er   papid)selferimp r   !/home/ernad/ernad/python/plumi.py__init__   s   zPlumi.__init__Fc                 C   s  | j }||jvrtd|  dS |j| }|jd }|jd }|jd }|jd }t|j| }	|j|}
|j|}tj	
|sJt| |
D ]}|
| }||	vr]t|d  qL||v rf|| }n1d| d	}|d
| 7 }d|jvrt|ds|  |j}||v r|| }n
t| qLt| qL|jd d | d }||g}t||sqL| j|}| j|}g }g }|D ]}||v r|| q|| qd}|D ]
}|d| d 7 }q|D ]
}|d| d 7 }qt|d}||  |  qLdS )zupdate for a reportI don't know your report Fplumiselectedsentsourcez is not sent.z$plumi has no source for selected at  z at truncateissues/z.txt.gz z+1 
z-1 wbN)r   reportprintdirslistdlastskeysospathisdirmakedirsconfhasattrfill_issuesr   filerdonerer   readappendgzipopenwriteencodeclose)r   repcode
do_verboser   r   	plumi_dirZ
select_dirsent_dirZ
source_dirZknown_issuedatesZselect_dafusZsource_dafusZselect_dateZselect_fufiZsource_fufierrZissue_dafus
plumi_fufiZinput_fufisZsource_papidsZselect_papidsZplusesZminussr   string
plumi_filer   r   r	   update   sl   











zPlumi.updatec           
      C   s   | j }||jvrtd|  dS |j| }|jd }i }tj|s'| | tt		|d D ]}tj
|}|dd }	|||	< q0|S )z return the list of normal plumisr   Fr   z/*.gzr   
   )r   r   r   r   r   r   r    r6   sortedglobbasename)
r   r.   r/   r   r   r0   outfufibana	issuedater   r   r	   fufisS   s   




zPlumi.fufisN)F)__name__
__module____qualname__r
   r6   r?   r   r   r   r	   r      s    
?r   )r9   r)   r   r%   r   r   r   r   r   r   r	   <module>   s   