Best Python code snippet using localstack_python
main.py
Source:main.py
...17 "OPTION 6: 2019 vs 2020 Jordi&Sara. \n"18 "OPTION 7: 2019 vs 2020 comparison. \n")192021def stop_query():22 print("Do you want to see other options ? ")23 stop_input = input("Respond Y or N: ").upper()24 if stop_input == "Y":25 select_query()26 elif stop_input == "N":27 print("I hope you are happy with the data, continue watching! :)")28 else:29 print("Make sure you respond Y for Yes or N for No")30 stop_query()313233def select_query():34 available_opt = ["1","2","3","4","5","6", "7"]35 select_opt = input("Input here the OPTION number: \n")36 if select_opt not in available_opt:37 print("Please ensure you input a number between 1 and 6")38 select_query()39 else:40 if select_opt == "1":41 output = watched_comparison("Angela", "Jordi&Sara")[0]42 print("OPTION 1: Shows watched by Angela and not by Jordi&Sara.")43 for i in range(len(output)):44 print(output[i])45 stop_query()46 elif select_opt == "2":47 output = watched_comparison("Jordi&Sara", "Angela")[0]48 print("OPTION 2: Shows watched by Jordi&Sara and not by Angela.")49 for i in range(len(output)):50 print(output[i])51 stop_query()52 elif select_opt == "3":53 output = watched_comparison("Angela", "Jordi&Sara")[1]54 print("OPTION 3: Shows both users have watched.")55 for i in range(len(output)):56 print(output[i])57 stop_query()58 elif select_opt == "4":59 print("OPTION 4: Total watch time by user since beginning.")60 print("***********************************")61 print("* Angela â " + str(time_sum(watched_time("Angela"))) + " *")62 print("* Jordi&Sara â " + str(time_sum(watched_time("Jordi&Sara"))) + " *")63 print("***********************************\n")64 stop_query()65 elif select_opt == "5":66 print("OPTION 5: 2019 vs 2020 Angela.")67 print("***********************************")68 print("* Angela 2019 â " + str(watch_time_year("Angela", "2019")) + " *")69 print("* Angela 2020 â " + str(watch_time_year("Angela", "2020")) + " *")70 print("***********************************\n")71 stop_query()72 elif select_opt == "6":73 print("OPTION 6: 2019 vs 2020 Jordi&Sara.")74 print("***************************************")75 print("* Jordi&Sara 2019 â " + str(watch_time_year("Jordi&Sara", "2019")) + " *")76 print("* Jordi&Sara 2020 â " + str(watch_time_year("Jordi&Sara", "2020")) + " *")77 print("***************************************\n")78 stop_query()79 elif select_opt == "7":80 print("OPTION 7: 2019 vs 2020 comparison.")81 print("**********************************************************************")82 print("* Usuario 2019 2020 Incremento *")83 print("* Angela "84 + str(watch_time_year("Angela", "2019"))85 + " " + str(watch_time_year("Angela", "2020"))86 + " " + str(increase("Angela", "2019", "2020")) + "%" + " *")87 print("* Jordi&Sara "88 + str(watch_time_year("Jordi&Sara", "2019"))89 + " " + str(watch_time_year("Jordi&Sara", "2020"))90 + " " + str(increase("Jordi&Sara", "2019", "2020")) + "%" + " *")91 print("**********************************************************************")92 print("\n"93 "Wohoooooo \n"94 "ANGELA ES LA CLARA GANADORA \n")95 stop_query()969798print("\n"99 "Welcome to the Netflix analysis for the data \n"100 "of Angela and Jordi&Sara. You can retrieve the following data: \n")101print(options())102
...
stop_queries.py
Source:stop_queries.py
1from __future__ import unicode_literals2from __future__ import print_function3from __future__ import division4from __future__ import absolute_import5from future import standard_library6standard_library.install_aliases()7from builtins import *8import logging9import pymongo10import emission.storage.timeseries.timequery as estt11import emission.storage.timeseries.abstract_timeseries as esta12import emission.core.get_database as edb13import emission.core.wrapper.stop as ecws14import emission.core.wrapper.entry as ecwe15def get_stops_for_trip(user_id, trip_id):16 curr_query = {"user_id": user_id, "data.trip_id": trip_id}17 return _get_stops_for_query(curr_query, "data.enter_ts")18def get_stops_for_trip_list(user_id, trip_list):19 curr_query = {"user_id": user_id, "data.trip_id": {"$in": trip_list}}20 return _get_stops_for_query(curr_query, "data.enter_ts")21def _get_stops_for_query(stop_query, sort_key):22 logging.debug("Returning stops for query %s" % stop_query)23 stop_query.update({"metadata.key": "segmentation/raw_stop"})24 logging.debug("updated query = %s" % stop_query)25 stop_doc_cursor = edb.get_analysis_timeseries_db().find(stop_query).sort(26 sort_key, pymongo.ASCENDING)27 logging.debug("result count = %d" % edb.get_analysis_timeseries_db().count_documents(stop_query))...
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!!