Cf^ddlZddlZddlmZejddZGddZy)N) defaultdictictdd5}tj|dd}g}|D](}|djdd}|j |*|cdddS#1swYyxYw) Nzgenerator/responses.csv )newline,") delimiter quotechar )opencsvreaderreplaceappend)csvfile spamreaderquotesrowquotes 7/home/robert/Desktop/SD/sd-tema-3/generator/commands.py handle_csvrso ' 6'ZZ3#F  !CFNN4-E MM%  !s A A!!A*ceZdZddZdZdZdZddZddZddZ dd Z dd Z dd Z dd Z dd ZddZddZddZddZddZddZy)TestNct|_t|_||_d|_t |_tt|_ y)Nr ) set connections names_usedusers post_counterrrrlistreposts)selfrs r__init__z Test.__init__s95%  l "4( c@tj|jSN)randomchoicer)r#s rget_namez Test.get_names}}TZZ((r%cvt|j}|jtj|Sr')r!rsortr(r))r#lsts rget_existing_namezTest.get_existing_names(4??#  }}S!!r%c.tj||Sr')r(randint)r#bottomtops r get_randomzTest.get_random$s~~fc**r%c$|r |jn |j}||n|}||n|}||f}|rS||k(r |}||k(r ||jvr3|}|}||k(r |}||k(r ||f}||jvr3||jvry|jj||jj||f|jj||jj|d|d|||fS)Nzadd r )r.r*raddr)r#name1name2generate useExistinggetter name_tuples r generate_addzTest.generate_add's!+6''DMM**U^ 5.5. 0 00un"HEun$U^  0 00 )) ) Z( eU^, E" E"eWAeW%ue33r%c||||fntj|j}|jj|d|d|||fS)Nzremove r )r(r)rremove)r#r7r8 named_tuples rgenerate_removezTest.generate_removeEsZ(-(9e>Ouent//0   ,q(%66r%c||n|j}||n|j}|r||k(r|j}|r||k(rd|d|||fS)Nz distance r r.r*r#r7r8 is_uniques rgenerate_distancezTest.generate_distanceMsg*0F0F0H*0F0F0HEUNMMOEEUN5'5'*E588r%c8||n|j}d||fS)Nz suggestions r.r#r7s rgenerate_suggestionszTest.generate_suggestionsVs)*0F0F0HeW%u,,r%c8||n|j}d||fS)Nzfriends rHrIs rgenerate_friendszTest.generate_friends[)*0F0F0H%!5((r%c||n|j}||n|j}|r||k(r|j}|r||k(rd|d|||fS)Nzcommon r rCrDs rgenerate_commonzTest.generate_common`sg*0F0F0H*0F0F0HEUNMMOEEUNq(%66r%c8||n|j}d||fS)Nzpopular rHrIs rgenerate_popularzTest.generate_popularirMr%c l||n|j}d}|rttt|dz Dcgc]}|j c}}|j ||j |D]-}|D]&}||k(r |j||\} }}|| dz }(/|d||fScc}w)Nr5r rz common-group )r.r!rranger*rr,r=) r#r7r9sizeresult_namesnameFstnameSndmsgs rgenerate_cliquezTest.generate_cliquens*0F0F0H uTAXG!dmmoGHIE LL  JJL  )$)G') $ 1 1'7 CICARj(F ) )ug.55HsB1 c||n|j}tj|j}g|j|j <|xj dz c_d|d|dS)Nr zcreate z "r)r*r(r)rr"r )r#namelines rgenerate_createzTest.generate_creates`'tT]]_}}T[[)*, T&&' Qc$r**r%c||n|j}||n5tjt|jj } |rn||n!tj|j|}|j|j |j|xjdz c_d|d|d|S |j|j |j|xjdz c_d|d|S#YIxYw)Nr zrepost r )r*r(r)r!r"keysrr r#r]id repost_idisReposts rgenerate_repostzTest.generate_reposts'tT]]_>Rv}}T$,,:K:K:M5N'O )2)>IFMMRVR^R^_aRbDc  R ''(9(9:!!Q&! at1YK88  R 1 12 Qat$$   s A/DD cX||n5tjt|jj } t |j|dkrRtjt|jj }t |j|dkrRtj|j|}tj|j|}||k(r(tj|j|}||k(r(d|d|d|S#YxYw)Nzcommon-repost r )r(r)r!r"ralen)r#rc repost_id1 repost_id2s r generate_lcazTest.generate_lcas>Rv}}T$,,:K:K:M5N'O dll2&'!+]]4 (9(9(;#<=dll2&'!+ ]]4<<#34 ]]4<<#34 J&t||B'78JJ& t1ZL*>>  s A,D%%D)c\g}|rt}ttjd|D]l} tjt |j j}|j|tj|j |fn|Dcgc] \}}d|d|}}}t|z}ttjt |j j|}||Dcgc]}d| c}zS#YxYwcc}}wcc}w)Nr z get-reposts r k rrSr(r0r)r!r"rar6richoicesr#num with_repostsrepr-rVpostreposts r generate_showzTest.generate_shows %C6>>!S12 !==dll.?.?.A)BCDGGT6==d1C#DEF EHH[S&\#ax0HCH 3s8OC&..dll&7&7&9!:cBCc:s SE*:::H;A)D"D# D)D c&||n|j}||n5tjt|jj } |r1||n!tj|j|}d|d|d|S d|d|S#Y xYw)Nzlike r )r*r(r)r!r"rarbs r generate_likezTest.generate_likes'tT]]_>Rv}}T$,,:K:K:M5N'O )2)>IFMMRVR^R^_aRbDc tfAbT9+66tfAbT""  s 2B Bc\g}|rt}ttjd|D]l} tjt |j j}|j|tj|j |fn|Dcgc] \}}d|d|}}}t|z}ttjt |j j|}||Dcgc]}d| c}zS#YxYwcc}}wcc}w)Nr z get-likes r rnrprrs rgenerate_get_likezTest.generate_get_likes %C6>>!S12 !==dll.?.?.A)BCDGGT6==d1C#DEF CFF;3ZuAfX.FCF 3s8OC&..dll&7&7&9!:cBCC8S 3%(888F9ry)returnN)NNTF)NN)NNTr')NTr )NNNF)NNN)r F)__name__ __module__ __qualname__r$r*r.r3r=rArFrJrLrOrQr[r_rfrlrxr{r}r%rrrs\))" +4<79- ) 7) 6&+%&? ;" #9r%r)r(r collectionsrseedrrrr%rrs- #  C H9H9r%