Best Python code snippet using locust
kakao_user_report.py
Source:kakao_user_report.py
1def div_reporters(report): # ì ê³ ì 리ì¤í¸ìì ëì´ì°ê¸°ë¥¼ 기ì¤ì¼ë¡ ì ê³ ìì ê°í´ì를 ëëë¤.2 attackers_dict = {} # ê°í´ì ì´ë¦ê³¼ ì ê³ ë¹í íì3 for reporter in report:4 data = reporter.split(" ")5 if data[1] in attackers_dict:6 attackers_dict[data[1]] += 17 else:8 attackers_dict[data[1]] = 19 return attackers_dict10def stop_users_list(attackers_dict, k):11 stop_users = []12 for key, value in attackers_dict.items():13 if value >= k:14 stop_users.append(key)15 return stop_users16def send_mail(id_list, report, stop_users): #ë©ì¼ì ë°ì ì¬ëì 구íë í¨ì17 receivers = init_receivers(id_list)18 for reporter in report:19 data = reporter.split(" ")20 if data[1] in stop_users:21 if data[0] in receivers:22 receivers[data[0]] += 123 else:24 receivers[data[0]] = 125 else:26 continue27 return receivers28def init_receivers(id_list):29 receivers = {}30 for id in id_list:31 receivers[id] = 032 return receivers33def solution(id_list, report, k):34 answer = []35 init_receivers(id_list)36 report = list(set(report))37 attackers_dicts = div_reporters(report)38 stop_users = stop_users_list(attackers_dicts, k)39 receivers = send_mail(id_list, report, stop_users)40 answer = list(receivers.values())41 return answer...
신고 결과 받기.py
Source:신고 결과 받기.py
1def solution(id_list, report, k):2 answer = []3 reports = dict()4 stop_users = dict()5 for i in id_list:6 reports[i] = []7 stop_users[i] = 08 for i in report:9 name_A, name_B = i.split(' ')10 if name_B not in reports[name_A]:11 reports[name_A].append(name_B)12 stop_users[name_B] += 113 real_stop = [i for i in stop_users if stop_users[i] >= k]14 real_list = [i for i in list(reports.values())]15 for lst in real_list:16 count = 017 for name in real_stop:18 if name in lst:19 count += 120 answer.append(count)...
__init__.py
Source:__init__.py
1# from .helpers import *2from .classes import *3from .functions import *4from .test_tools import User, spin_users, stop_users, list_users...
Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.
You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.
Get 100 minutes of automation test minutes FREE!!