3 9Pe"@sFddlmZddlTddlTddlTddlTddlZGdddZdS)) defaultdict)*Nc@sleZdZeddZeddZeZdZdZ e j dfddZ ddZ d d Z d d Ze j fd dZdS) keyseriescCsttS)N)rlistrr/usr/lib/python3.6/keyseries.pyszkeyseries.cCsttS)N)rrrrrrr sNcCs||_||_t|j|_x|jD]}|jj|x||jD]\}}xh|jD]\}|j r|j op|j |ks|j ||j |qT|j o|j |ksT|j ||j |qTW|j ||j|j ||jqBWq$WdS)N)_kdict_contextsetZmissing_zoneszonesadditemsvaluessepdelete_Kappend_Zsort)selfZkdictnowcontextzonealgkeyskrrr__init__s zkeyseries.__init__ccsbx\|jD]R}xL|j|jgD]<}||kr(qx,||jD]\}}x|D] }|VqDWq6WqWqWdS)N)r rrr)rr collectionrrkeyrrr__iter__.s  zkeyseries.__iter__cCs"x|D]}tdt|qWdS)Nz%s)printrepr)rrrrrdump7s zkeyseries.dumpcKs|jdd}|sdS|d}|jr>|j}|jp0d }|jp:d } n|j}|jpLd }|jpVd} |j} |j } | sv| |kr|j ||} | s| |kr|j ||} |j } d} |s|j d||jd|n| s| || kr| r(| |||| kr(|j | |f||j| || f|n| s`|j ||| f||j||| | f|n| |krln| || kr|j | |f||j| || f|np| |||| kr|j | |f||j| || f|n0|j ||| f||j||| | f|n|j}| s8| | || krL|j| | f|nN|sj|j|| | f|n0||| krzn || | kr|j| | f||j|jkr|j|j|}x|ddD]}|s|j d||j d||j d||jd||j|jkr|j|jq|j } | |} |j | f||j | f||j | |f||j| || f||j| | f||j|jkr|j|j|}qWx|r>|j r>|j ||jkr>|j|jdf||j|jd |jd |f|}|j |j |f||j|j | f||j||}qW|j d||jd|x"|D]}|j|jdf|q^WdS)NforceFriQi,rZ settime_path keygen_path randomdevi'i'i'i')N)N)N)N)N)N)N)N)getrZksk_rollperiodZksk_prepublishZksk_postpublishZzsk_rollperiodZzsk_prepublishZzsk_postpublishZpublishZactivateZ setpublishZ setactivateZinactiveZ setinactiveZ setdeleterkeyttlZttlZsetttlZcoverageZcommitr Zgenerate_successorr)rrpolicyrkwargsr&r!ZrpZprepubZpostpubpaiZfudgedprevrrr fixseries;s                        zkeyseries.fixseriescKs|jd|j}|jd|jjdd}|jdd}x|D]}g}|j|} |pX| jpXd}| j} tj| } d|ks||d rt|j || dkrtj |jd |jd ||| | j d| j pd f|} |j || j | |j |j |d |ks|d  rht|j|| dkrXtj |jd |jd ||| | jd | j prrrrrs   vr)r<rr7ZkeydictZkeyeventr,rBrrrrr s