o gDf@s@ddlZddlZddlmZedddZGdddZdS)N) defaultdicticCsltddd&}tj|ddd}g}|D]}|ddd}||q|WdS1s/wYdS) Nzgenerator/responses.csv )newline,") delimiter quotechar )opencsvreaderreplaceappend)csvfile spamreaderquotesrowquoterl/mnt/c/Users/RobGra/OneDrive - Softwire Technology Limited/Desktop/Facultate/sd-tema-3/generator/commands.py handle_csvs $rc@seZdZd0ddZddZddZd d Zd1d dZd2ddZd3ddZ d4ddZ d4ddZ d3ddZ d4ddZ d5ddZd6ddZd7d d!Zd8d"d#Zd9d$d%Zd:d&d'Zd9d(d)Zd;d*d+Zd4d,d-Zd2d.d/ZdS)<TestreturnNcCs2t|_t|_||_d|_t|_tt|_ dSNr ) set connections names_usedusers post_counterrrrlistreposts)selfrrrr__init__s z Test.__init__cCs t|jSN)randomchoicerr"rrrget_name z Test.get_namecCst|j}|t|Sr$)r rsortr%r&)r"lstrrrget_existing_names  zTest.get_existing_namecCs t||Sr$)r%randint)r"bottomtoprrr get_random$r)zTest.get_randomTFcCs|r|jn|j}|dur|n|}|dur|n|}||f}|rJ||kr+|}||ks$||jvrJ|}|}||krA|}||ks:||f}||jvs0||jvrQdS|j||j||f|j||j|d|d|||fS)Nzadd r )r,r(raddr)r"name1name2generate useExistinggetter name_tuplerrr generate_add's.     zTest.generate_addcCsF|dur |dur ||fnt|j}|j|d|d|||fS)Nzremove r )r%r&rremove)r"r3r4 named_tuplerrrgenerate_removeEs   zTest.generate_removecC^|dur|n|}|dur|n|}|r$||kr$|}|r$||ksd|d|||fS)Nz distance r r,r(r"r3r4 is_uniquerrrgenerate_distanceM   zTest.generate_distancecC"|dur|n|}d||fS)Nz suggestions r,r"r3rrrgenerate_suggestionsVzTest.generate_suggestionscCrC)Nzfriends rDrErrrgenerate_friends[rGzTest.generate_friendscCr=)Nzcommon r r>r?rrrgenerate_common`rBzTest.generate_commoncCrC)Nzpopular rDrErrrgenerate_popularirGzTest.generate_popularr c s|dur|n}d}|rGttfddt|dD}||||D]}|D]}||kr5q.||\}} } ||d7}q.q*|d||fS)Nr1csg|]}qSr)r().0_r'rr ssz(Test.generate_clique..r rz common-group )r,r rrangerr*r9) r"r3r5sizeresultnamesnameFstnameSndmsgrLrr'rgenerate_cliquens" zTest.generate_cliquecCsZ|r|jn|j}|dur|n|}t|j}g|j|j<|jd7_d|d|dS)Nr zcreate z "r)r,r(r%r&rr!r)r"namer6r7linerrrgenerate_creates   zTest.generate_createcCs|r|jn|j}|dur|n|}|dur|n tt|j}z.|rN|dur*|nt|j|}|j||j|jd7_d|d|d|WSWnY|j||j|jd7_d|d|S)Nr zrepost r ) r,r(r%r&r r!keysrr)r"rVid repost_idisRepostr6r7rrrgenerate_reposts zTest.generate_repostcCs|dur|n tt|j}zt|j|dkr-tt|j}t|j|dksWnYt|j|}t|j|}||krSt|j|}||ksGd|d|d|S)Nzcommon-repost r )r%r&r r!rYlen)r"rZ repost_id1 repost_id2rrr generate_lcas zTest.generate_lcacCg}|r=t}ttd|D] }ztt|j}||t|j|fWqYqdd|D}|t |8}ttj t|j|d}|dd|DS)Nr cS g|] \}}d|d|qS) get-reposts r rrKnumrepostrrrrM z&Test.generate_show..kcSg|]}d|qS)rerrKrgrrrrM rrNr%r-r&r r!rYr2r_choicesr"rg with_repostsrepr+rLpostrrr generate_show zTest.generate_showcCs|dur|n|}|dur|n tt|j}z|r7|dur#|nt|j|}d|d|d|WSWnYd|d|S)Nzlike r )r(r%r&r r!rY)r"rVrZr[r\rrr generate_likes zTest.generate_likecCrc)Nr cSrd) get-likes r rrfrrrrMriz*Test.generate_get_like..rjcSrl)rxrrmrrrrMrnrorqrrrgenerate_get_likervzTest.generate_get_likecCs$|dur|n|}d|d|S)Nzfeed r rD)r"rVrOrrr generate_feedszTest.generate_feedcCs|dur|n|}d|S)Nz view-profile rD)r"rVrrrgenerate_profiles zTest.generate_profilecCsD|dur|n|}|dur|n tt|j}d|d|S)Nzfriends-repost r )r,r%r&r r!rY)r"rVrZrrrgenerate_friend_reposts zTest.generate_friend_repost)rN)NNTF)NN)NNTr$)NTr )NF)NNNFF)NNN)r F)NNNFr)__name__ __module__ __qualname__r#r(r,r0r9r<rArFrHrIrJrUrXr]rbrurwryrzr{r|rrrrrs,              r)r%r collectionsrseedrrrrrrs