How to use new_event method in localstack

Best Python code snippet using localstack_python

test_feed_ctrl_connection.py

Source:test_feed_ctrl_connection.py Github

copy

Full Screen

1import secrets # Comes with python2from contextlib import contextmanager3import os4from nacl.signing import SigningKey5from logStore.funcs.EventCreationTool import EventFactory6from logStore.appconn.feed_ctrl_connection import FeedCtrlConnection7from logStore.appconn.chat_connection import ChatFunction8from logStore.funcs.log import create_logger9logger = create_logger('test_feed_ctrl_connection')10def test_add_event_and_get_host_master_id():11 with session_scope():12 ecf = EventFactory()13 cf = ChatFunction()14 new_event = ecf.next_event('MASTER/MASTER', {})15 fcc = FeedCtrlConnection()16 fcc.add_event(new_event)17 feed = EventFactory()18 new_event = feed.next_event('chat/MASTER', {'master_feed': ecf.get_feed_id()})19 fcc.add_event(new_event)20 new_event = feed.next_event('chat/whateveraction',21 {'messagekey': 'hallo zusammen', 'chat_id': '1', 'timestampkey': 10})22 fcc.add_event(new_event)23 new_event = feed.next_event('chat/whateveraction',24 {'messagekey': 'hallo zusammen', 'chat_id': '1', 'timestampkey': 10})25 fcc.add_event(new_event)26 trust_id5 = generate_random_feed_id()27 new_event = ecf.next_event('MASTER/Trust', {'feed_id': trust_id5})28 fcc.add_event(new_event)29 trust_id5 = generate_random_feed_id()30 new_event = ecf.next_event('MASTER/Name', {'name': trust_id5})31 fcc.add_event(new_event)32 trust_id5 = generate_random_feed_id()33 new_event = ecf.next_event('MASTER/NewFeed', {'feed_id': trust_id5, 'app_name': 'TestApp'})34 fcc.add_event(new_event)35 new_event = ecf.next_event('MASTER/Radius', {'radius': 5})36 fcc.add_event(new_event)37 result = cf.get_full_chat('1')38 logger.error(result)39 result = fcc.get_host_master_id()40 assert result == ecf.get_feed_id()41def test_get_trusted():42 with session_scope():43 ecf = EventFactory()44 new_event = ecf.next_event('MASTER/MASTER', {})45 fcc = FeedCtrlConnection()46 fcc.add_event(new_event)47 trust_id1 = generate_random_feed_id()48 new_event = ecf.next_event('MASTER/Trust', {'feed_id': trust_id1})49 fcc.add_event(new_event)50 trust_id2 = generate_random_feed_id()51 new_event = ecf.next_event('MASTER/Trust', {'feed_id': trust_id2})52 fcc.add_event(new_event)53 trust_id3 = generate_random_feed_id()54 new_event = ecf.next_event('MASTER/Trust', {'feed_id': trust_id3})55 fcc.add_event(new_event)56 trust_id4 = generate_random_feed_id()57 new_event = ecf.next_event('MASTER/Name', {'name': trust_id4})58 fcc.add_event(new_event)59 trust_id4 = generate_random_feed_id()60 new_event = ecf.next_event('MASTER/NewFeed', {'feed_id': trust_id4, 'app_name': 'TestApp'})61 fcc.add_event(new_event)62 new_event = ecf.next_event('MASTER/Radius', {'radius': 5})63 fcc.add_event(new_event)64 result = fcc.get_trusted(ecf.get_feed_id())65 assert result[0] == trust_id166 assert result[1] == trust_id267 assert result[2] == trust_id368 assert len(result) == 369def test_trash():70 with session_scope():71 ecf = EventFactory()72 cf = ChatFunction()73 new_event = ecf.next_event('MASTER/MASTER', {})74 fcc = FeedCtrlConnection()75 fcc.add_event(new_event)76 trust_id1 = generate_random_feed_id()77 new_event1 = ecf.next_event('MASTER/Trust', {'feed_id': trust_id1})78 fcc.add_event(new_event1)79 new_event2 = ecf.next_event('MASTER/Trash', {'feed_id': trust_id1})80 fcc.add_event(new_event2)81 new_event2 = ecf.next_event('MASTER/Trash', {'feed_id': trust_id1})82 fcc.add_event(new_event2)83 new_event2 = ecf.next_event('MASTER/Trash', {'feed_id': trust_id1})84 fcc.add_event(new_event2)85 result = cf.get_current_event(ecf.get_feed_id())86 assert result == new_event287def test_get_blocked():88 with session_scope():89 ecf = EventFactory()90 new_event = ecf.next_event('MASTER/MASTER', {})91 fcc = FeedCtrlConnection()92 fcc.add_event(new_event)93 trust_id1 = generate_random_feed_id()94 new_event = ecf.next_event('MASTER/Trust', {'feed_id': trust_id1})95 fcc.add_event(new_event)96 trust_id2 = generate_random_feed_id()97 new_event = ecf.next_event('MASTER/Trust', {'feed_id': trust_id2})98 fcc.add_event(new_event)99 new_event = ecf.next_event('MASTER/Block', {'feed_id': trust_id2})100 fcc.add_event(new_event)101 trust_id3 = generate_random_feed_id()102 new_event = ecf.next_event('MASTER/Trust', {'feed_id': trust_id3})103 fcc.add_event(new_event)104 trust_id4 = generate_random_feed_id()105 new_event = ecf.next_event('MASTER/Block', {'feed_id': trust_id4})106 fcc.add_event(new_event)107 trust_id5 = generate_random_feed_id()108 new_event = ecf.next_event('MASTER/Trust', {'feed_id': trust_id5})109 fcc.add_event(new_event)110 trust_id5 = generate_random_feed_id()111 new_event = ecf.next_event('MASTER/Name', {'name': trust_id5})112 fcc.add_event(new_event)113 trust_id5 = generate_random_feed_id()114 new_event = ecf.next_event('MASTER/NewFeed', {'feed_id': trust_id5, 'app_name': 'TestApp'})115 fcc.add_event(new_event)116 new_event = ecf.next_event('MASTER/Radius', {'radius': 5})117 fcc.add_event(new_event)118 result1 = fcc.get_blocked(ecf.get_feed_id())119 result2 = fcc.get_trusted(ecf.get_feed_id())120 assert result1[0] == trust_id2121 assert result1[1] == trust_id4122 assert result2[0] == trust_id1123 assert result2[1] == trust_id3124 assert len(result1) == 2125 assert len(result2) == 3126def test_get_all_master_ids():127 with session_scope():128 ecf = EventFactory()129 fcc = FeedCtrlConnection()130 new_event = ecf.next_event('MASTER/MASTER', {})131 fcc.add_event(new_event)132 ecf2 = EventFactory()133 new_event1 = ecf2.next_event('MASTER/MASTER', {})134 fcc.add_event(new_event1)135 trust_id2 = generate_random_feed_id()136 new_event = ecf.next_event('MASTER/Trust', {'feed_id': trust_id2})137 fcc.add_event(new_event)138 new_event = ecf.next_event('MASTER/Block', {'feed_id': trust_id2})139 fcc.add_event(new_event)140 fcc.add_event(new_event)141 trust_id5 = generate_random_feed_id()142 new_event = ecf.next_event('MASTER/Trust', {'feed_id': trust_id5})143 fcc.add_event(new_event)144 trust_id5 = generate_random_feed_id()145 new_event = ecf.next_event('MASTER/Name', {'name': trust_id5})146 fcc.add_event(new_event)147 trust_id5 = generate_random_feed_id()148 new_event = ecf.next_event('MASTER/NewFeed', {'feed_id': trust_id5, 'app_name': 'TestApp'})149 fcc.add_event(new_event)150 new_event = ecf.next_event('MASTER/Radius', {'radius': 5})151 fcc.add_event(new_event)152 result1 = fcc.get_all_master_ids()153 assert result1[0] == ecf2.get_feed_id()154 assert len(result1) == 1155def test_get_all_master_ids_feed_ids():156 with session_scope():157 ecf = EventFactory()158 fcc = FeedCtrlConnection()159 new_event = ecf.next_event('MASTER/MASTER', {})160 fcc.add_event(new_event)161 trust_id1 = generate_random_feed_id()162 new_event = ecf.next_event('MASTER/NewFeed', {'feed_id': trust_id1, 'app_name': 'Test1'})163 fcc.add_event(new_event)164 trust_id2 = generate_random_feed_id()165 new_event = ecf.next_event('MASTER/NewFeed', {'feed_id': trust_id2, 'app_name': 'Test2'})166 fcc.add_event(new_event)167 trust_id3 = generate_random_feed_id()168 new_event = ecf.next_event('MASTER/NewFeed', {'feed_id': trust_id3, 'app_name': 'Test3'})169 fcc.add_event(new_event)170 new_event = ecf.next_event('MASTER/Trust', {'feed_id': trust_id3})171 fcc.add_event(new_event)172 trust_id5 = generate_random_feed_id()173 new_event = ecf.next_event('MASTER/Trust', {'feed_id': trust_id5})174 fcc.add_event(new_event)175 trust_id5 = generate_random_feed_id()176 new_event = ecf.next_event('MASTER/Name', {'name': trust_id5})177 fcc.add_event(new_event)178 new_event = ecf.next_event('MASTER/Radius', {'radius': 5})179 fcc.add_event(new_event)180 result = fcc.get_all_master_ids_feed_ids(ecf.get_feed_id())181 assert result[0] == trust_id1182 assert result[1] == trust_id2183 assert result[2] == trust_id3184 assert len(result) == 3185def test_get_username():186 with session_scope():187 ecf = EventFactory()188 fcc = FeedCtrlConnection()189 new_event = ecf.next_event('MASTER/MASTER', {})190 fcc.add_event(new_event)191 new_event = ecf.next_event('MASTER/Name', {'name': 'Alice'})192 fcc.add_event(new_event)193 ecf2 = EventFactory()194 new_event = ecf2.next_event('MASTER/MASTER', {})195 fcc.add_event(new_event)196 new_event = ecf2.next_event('MASTER/Name', {'name': 'Bob'})197 fcc.add_event(new_event)198 trust_id5 = generate_random_feed_id()199 new_event = ecf.next_event('MASTER/Trust', {'feed_id': trust_id5})200 fcc.add_event(new_event)201 trust_id5 = generate_random_feed_id()202 new_event = ecf.next_event('MASTER/NewFeed', {'feed_id': trust_id5, 'app_name': 'TestApp'})203 fcc.add_event(new_event)204 new_event = ecf.next_event('MASTER/Radius', {'radius': 5})205 fcc.add_event(new_event)206 new_event = ecf.next_event('MASTER/Name', {'name': 'Patrice'})207 fcc.add_event(new_event)208 result1 = fcc.get_username(ecf.get_feed_id())209 result2 = fcc.get_username(ecf2.get_feed_id())210 assert result1 == 'Patrice'211 assert result2 == 'Bob'212def test_get_my_last_event():213 with session_scope():214 ecf = EventFactory()215 fcc = FeedCtrlConnection()216 new_event = ecf.next_event('MASTER/MASTER', {})217 fcc.add_event(new_event)218 trust_id5 = generate_random_feed_id()219 new_event = ecf.next_event('MASTER/Trust', {'feed_id': trust_id5})220 fcc.add_event(new_event)221 trust_id5 = generate_random_feed_id()222 new_event = ecf.next_event('MASTER/NewFeed', {'feed_id': trust_id5, 'app_name': 'TestApp'})223 fcc.add_event(new_event)224 new_event = ecf.next_event('MASTER/Radius', {'radius': 5})225 fcc.add_event(new_event)226 new_event = ecf.next_event('MASTER/Name', {'name': 'Patrice'})227 fcc.add_event(new_event)228 last_event = ecf.next_event('MASTER/Name', {'name': 'Alice'})229 fcc.add_event(last_event)230 ecf2 = EventFactory()231 new_event = ecf2.next_event('MASTER/MASTER', {})232 fcc.add_event(new_event)233 new_event = ecf2.next_event('MASTER/Name', {'name': 'Bob'})234 fcc.add_event(new_event)235 result = fcc.get_my_last_event()236 assert result == last_event237def test_get_radius():238 with session_scope():239 ecf = EventFactory()240 fcc = FeedCtrlConnection()241 new_event = ecf.next_event('MASTER/MASTER', {})242 fcc.add_event(new_event)243 last_event = ecf.next_event('MASTER/Radius', {'radius': 5})244 fcc.add_event(last_event)245 ecf2 = EventFactory()246 new_event = ecf2.next_event('MASTER/MASTER', {})247 fcc.add_event(new_event)248 new_event = ecf2.next_event('MASTER/Radius', {'radius': 3})249 fcc.add_event(new_event)250 new_event = ecf2.next_event('MASTER/Name', {'name': 'Alice'})251 fcc.add_event(new_event)252 trust_id5 = generate_random_feed_id()253 new_event = ecf.next_event('MASTER/Trust', {'feed_id': trust_id5})254 fcc.add_event(new_event)255 trust_id5 = generate_random_feed_id()256 new_event = ecf.next_event('MASTER/NewFeed', {'feed_id': trust_id5, 'app_name': 'TestApp'})257 fcc.add_event(new_event)258 new_event = ecf.next_event('MASTER/Radius', {'radius': 5})259 fcc.add_event(new_event)260 new_event = ecf.next_event('MASTER/Name', {'name': 'Patrice'})261 fcc.add_event(new_event)262 result = fcc.get_radius()263 assert result == 5264def test_get_master_id_from_feed():265 with session_scope():266 ecf = EventFactory()267 fcc = FeedCtrlConnection()268 new_event = ecf.next_event('MASTER/MASTER', {})269 fcc.add_event(new_event)270 trust_id1 = generate_random_feed_id()271 new_event = ecf.next_event('MASTER/NewFeed', {'feed_id': trust_id1, 'app_name': 'Test1'})272 fcc.add_event(new_event)273 ecf2 = EventFactory()274 new_event = ecf2.next_event('MASTER/MASTER', {})275 fcc.add_event(new_event)276 trust_id2 = generate_random_feed_id()277 new_event = ecf2.next_event('MASTER/NewFeed', {'feed_id': trust_id2, 'app_name': 'Test2'})278 fcc.add_event(new_event)279 new_event = ecf2.next_event('MASTER/Name', {'name': 'Alice'})280 fcc.add_event(new_event)281 trust_id5 = generate_random_feed_id()282 new_event = ecf.next_event('MASTER/Trust', {'feed_id': trust_id5})283 fcc.add_event(new_event)284 trust_id5 = generate_random_feed_id()285 new_event = ecf.next_event('MASTER/NewFeed', {'feed_id': trust_id5, 'app_name': 'TestApp'})286 fcc.add_event(new_event)287 new_event = ecf.next_event('MASTER/Radius', {'radius': 5})288 fcc.add_event(new_event)289 new_event = ecf.next_event('MASTER/Name', {'name': 'Patrice'})290 fcc.add_event(new_event)291 result1 = fcc.get_master_id_from_feed(trust_id1)292 result2 = fcc.get_master_id_from_feed(trust_id2)293 assert result1 == ecf.get_feed_id()294 assert result2 == ecf2.get_feed_id()295def test_get_application_name():296 with session_scope():297 ecf = EventFactory()298 fcc = FeedCtrlConnection()299 new_event = ecf.next_event('MASTER/MASTER', {})300 fcc.add_event(new_event)301 trust_id1 = generate_random_feed_id()302 new_event = ecf.next_event('MASTER/NewFeed', {'feed_id': trust_id1, 'app_name': 'Test1'})303 fcc.add_event(new_event)304 ecf2 = EventFactory()305 new_event = ecf2.next_event('MASTER/MASTER', {})306 fcc.add_event(new_event)307 trust_id2 = generate_random_feed_id()308 new_event = ecf2.next_event('MASTER/NewFeed', {'feed_id': trust_id2, 'app_name': 'Test2'})309 fcc.add_event(new_event)310 new_event = ecf2.next_event('MASTER/Name', {'name': 'Alice'})311 fcc.add_event(new_event)312 trust_id5 = generate_random_feed_id()313 new_event = ecf.next_event('MASTER/Trust', {'feed_id': trust_id5})314 fcc.add_event(new_event)315 trust_id5 = generate_random_feed_id()316 new_event = ecf.next_event('MASTER/NewFeed', {'feed_id': trust_id5, 'app_name': 'TestApp'})317 fcc.add_event(new_event)318 new_event = ecf.next_event('MASTER/Radius', {'radius': 5})319 fcc.add_event(new_event)320 new_event = ecf.next_event('MASTER/Name', {'name': 'Patrice'})321 fcc.add_event(new_event)322 result1 = fcc.get_application_name(trust_id1)323 result2 = fcc.get_application_name(trust_id2)324 logger.error(result1)325 assert result1 == 'Test1'326 assert result2 == 'Test2'327def test_get_feed_ids_from_application_in_master_id():328 with session_scope():329 ecf = EventFactory()330 fcc = FeedCtrlConnection()331 new_event = ecf.next_event('MASTER/MASTER', {})332 fcc.add_event(new_event)333 trust_id1 = generate_random_feed_id()334 new_event = ecf.next_event('MASTER/NewFeed', {'feed_id': trust_id1, 'app_name': 'Test1'})335 fcc.add_event(new_event)336 trust_id3 = generate_random_feed_id()337 new_event = ecf.next_event('MASTER/NewFeed', {'feed_id': trust_id3, 'app_name': 'Test1'})338 fcc.add_event(new_event)339 ecf2 = EventFactory()340 new_event = ecf2.next_event('MASTER/MASTER', {})341 fcc.add_event(new_event)342 trust_id2 = generate_random_feed_id()343 new_event = ecf2.next_event('MASTER/NewFeed', {'feed_id': trust_id2, 'app_name': 'Test2'})344 fcc.add_event(new_event)345 new_event = ecf2.next_event('MASTER/Name', {'name': 'Alice'})346 fcc.add_event(new_event)347 trust_id5 = generate_random_feed_id()348 new_event = ecf.next_event('MASTER/Trust', {'feed_id': trust_id5})349 fcc.add_event(new_event)350 trust_id5 = generate_random_feed_id()351 new_event = ecf.next_event('MASTER/NewFeed', {'feed_id': trust_id5, 'app_name': 'TestApp'})352 fcc.add_event(new_event)353 new_event = ecf.next_event('MASTER/Radius', {'radius': 5})354 fcc.add_event(new_event)355 new_event = ecf.next_event('MASTER/Name', {'name': 'Patrice'})356 fcc.add_event(new_event)357 result1 = fcc.get_feed_ids_from_application_in_master_id(ecf.get_feed_id(), 'Test1')358 result2 = fcc.get_feed_ids_from_application_in_master_id(ecf2.get_feed_id(), 'Test2')359 logger.error(result1)360 assert result1[0] == trust_id1361 assert result2[0] == trust_id2362 assert result1[1] == trust_id3363def test_get_feed_ids_in_radius():364 with session_scope():365 ecf = EventFactory()366 fcc = FeedCtrlConnection()367 new_event = ecf.next_event('MASTER/MASTER', {})368 fcc.add_event(new_event)369 new_event = ecf.next_event('MASTER/Radius', {'radius': 3})370 fcc.add_event(new_event)371 ecf2 = EventFactory()372 new_event = ecf2.next_event('MASTER/MASTER', {})373 fcc.add_event(new_event)374 new_event = ecf2.next_event('MASTER/Radius', {'radius': 5})375 fcc.add_event(new_event)376 ecf3 = EventFactory()377 new_event = ecf3.next_event('MASTER/MASTER', {})378 fcc.add_event(new_event)379 new_event = ecf3.next_event('MASTER/Radius', {'radius': 1})380 fcc.add_event(new_event)381 ecf4 = EventFactory()382 new_event = ecf4.next_event('MASTER/MASTER', {})383 fcc.add_event(new_event)384 new_event = ecf4.next_event('MASTER/Radius', {'radius': 2})385 fcc.add_event(new_event)386 new_event = ecf4.next_event('MASTER/Name', {'name': 'Alice'})387 fcc.add_event(new_event)388 new_event = ecf2.next_event('MASTER/Name', {'name': 'Alice'})389 fcc.add_event(new_event)390 trust_id5 = generate_random_feed_id()391 new_event = ecf.next_event('MASTER/Trust', {'feed_id': trust_id5})392 fcc.add_event(new_event)393 trust_id5 = generate_random_feed_id()394 new_event = ecf.next_event('MASTER/NewFeed', {'feed_id': trust_id5, 'app_name': 'TestApp'})395 fcc.add_event(new_event)396 new_event = ecf.next_event('MASTER/Radius', {'radius': 5})397 fcc.add_event(new_event)398 new_event = ecf.next_event('MASTER/Name', {'name': 'Patrice'})399 fcc.add_event(new_event)400 result = fcc.get_feed_ids_in_radius()401 assert result[0] == ecf.get_feed_id()402 assert result[1] == ecf3.get_feed_id()403 assert result[2] == ecf4.get_feed_id()404 assert len(result) == 3405def test_set_radius():406 with session_scope():407 ecf = EventFactory()408 fcc = FeedCtrlConnection()409 new_event = ecf.next_event('MASTER/MASTER', {})410 fcc.add_event(new_event)411 last_event = ecf.next_event('MASTER/Radius', {'radius': 5})412 fcc.add_event(last_event)413 ecf2 = EventFactory()414 new_event = ecf2.next_event('MASTER/MASTER', {})415 fcc.add_event(new_event)416 new_event = ecf2.next_event('MASTER/Radius', {'radius': 3})417 fcc.add_event(new_event)418 new_event = ecf2.next_event('MASTER/Name', {'name': 'Alice'})419 fcc.add_event(new_event)420 new_event = ecf2.next_event('MASTER/Name', {'name': 'Alice'})421 fcc.add_event(new_event)422 trust_id5 = generate_random_feed_id()423 new_event = ecf.next_event('MASTER/Trust', {'feed_id': trust_id5})424 fcc.add_event(new_event)425 trust_id5 = generate_random_feed_id()426 new_event = ecf.next_event('MASTER/NewFeed', {'feed_id': trust_id5, 'app_name': 'TestApp'})427 fcc.add_event(new_event)428 new_event = ecf.next_event('MASTER/Radius', {'radius': 5})429 fcc.add_event(new_event)430 new_event = ecf.next_event('MASTER/Name', {'name': 'Patrice'})431 fcc.add_event(new_event)432 fcc.set_feed_ids_radius(ecf.get_feed_id(), 6)433 fcc.set_feed_ids_radius(ecf2.get_feed_id(), 10)434 result = fcc.get_radius()435 assert result == 6436def generate_random_feed_id():437 private_key = secrets.token_bytes(32)438 signing_key = SigningKey(private_key)439 public_key_feed_id = signing_key.verify_key.encode()440 return public_key_feed_id441@contextmanager442def session_scope():443 """Provide a transactional scope around a series of operations."""444 try:445 yield446 except Exception as e:447 logger.error(e)448 raise449 finally:450 try:451 if os.path.exists('cborDatabase.sqlite'):452 os.remove('cborDatabase.sqlite')453 if os.path.exists('eventDatabase.sqlite'):454 os.remove('eventDatabase.sqlite')455 directory = "./"456 files_in_directory = os.listdir(directory)457 filtered_files = [file for file in files_in_directory if file.endswith(".key")]458 for file in filtered_files:459 path_to_file = os.path.join(directory, file)460 os.remove(path_to_file)461 else:462 assert False463 except Exception as e:...

Full Screen

Full Screen

get_event.py

Source:get_event.py Github

copy

Full Screen

1import pandas as pd2 3def champ_kill(event): 4 new_event = {}5 6 new_event['timestamp'] = event['timestamp']7 new_event['positionX'] = event['position']['x']8 new_event['positionY'] = event['position']['y']9 new_event['killerId'] = event['killerId']10 new_event['victimId'] = event['victimId']11 new_event['assistIds'] = ' '.join(map(str,event['assistingParticipantIds']))12 13 return new_event14 15def ward(event):16 new_event = {}17 18 new_event['timestamp'] = event['timestamp']19 new_event['eventType'] = event['type']20 new_event['wardType'] = event['wardType']21 if event['type'] == 'WARD_PLACED':22 new_event['participantId'] = event['creatorId']23 else:24 new_event['participantId'] = event['killerId']25 26 return new_event27def item(event):28 new_event = {}29 30 new_event['timestamp'] = event['timestamp']31 new_event['eventType'] = event['type']32 new_event['participantId'] = event['participantId']33 34 if event['type'] == 'ITEM_UNDO':35 new_event['itemId'] = event['afterId']36 new_event['fromItemId'] = event['beforeId']37 else:38 new_event['itemId'] = event['itemId']39 40 return new_event41def skillup(event):42 new_event = {}43 44 new_event['timestamp'] = event['timestamp']45 new_event['participantId'] = event['participantId']46 new_event['skillSlot'] = event['skillSlot']47 new_event['levelupType'] = event['levelUpType']48 49 return new_event50def building(event):51 new_event = {}52 53 new_event['timestamp'] = event['timestamp']54 if event['killerId'] < 6:55 new_event['teamId'] = 'BLUE'56 else:57 new_event['teamId'] = 'RED'58 new_event['killerId'] = event['killerId']59 new_event['assistIds'] = ' '.join(map(str,event['assistingParticipantIds']))60 new_event['buildingType'] = event['buildingType']61 new_event['laneType'] = event['laneType']62 new_event['towerType'] = event['towerType']63 64 return new_event65def monster(event):66 new_event = {}67 68 new_event['timestamp'] = event['timestamp']69 if event['killerId'] < 6:70 new_event['teamId'] = 'BLUE'71 else:72 new_event['teamId'] = 'RED'73 new_event['killerId'] = event['killerId']74 new_event['monsterType'] = event['monsterType']75 if 'monsterSubType' in event:76 new_event['dragonSubType'] = event['monsterSubType']77 78 return new_event79 80 81def events(event):82 event_list = [[] for _ in range(5)]83 84 for i in range(len(event)):85 for j in range(len(event.iloc[i])):86 one_event = event.iloc[i][j]87 if one_event['type'] == 'CHAMPION_KILL':88 event_list[0].append(champ_kill(one_event))89 #elif one_event['type'] == 'WARD_PLACED' and one_event['wardType'] != 'UNDEFINED':90 # event_list[1].append(ward(one_event))91 #elif one_event['type'] == 'WARD_KILL':92 # event_list[1].append(ward(one_event))93 elif one_event['type'] in ['ITEM_PURCHASED', 'ITEM_SOLD']:94 if one_event['itemId'] not in [2003, 2055, 3330, 3340, 3363, 3364]:95 event_list[1].append(item(one_event))96 elif one_event['type'] == 'ITEM_UNDO':97 event_list[1].append(item(one_event))98 elif one_event['type'] == 'SKILL_LEVEL_UP':99 event_list[2].append(skillup(one_event))100 elif one_event['type'] == 'BUILDING_KILL':101 event_list[3].append(building(one_event))102 elif one_event['type'] == 'ELITE_MONSTER_KILL':103 event_list[4].append(monster(one_event))104 event_df_list = [pd.DataFrame(event_list[i]) for i in range(5)]105 ...

Full Screen

Full Screen

Automation Testing Tutorials

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.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run localstack automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful