def check_proximity_option_value(value: int): if value == 0: print(simple_colors.red("Not a valid option...")) return "0" elif value == -1: print(simple_colors.red("No proximity option chosen...")) return "-1" elif value == 1: return "1" elif value == 2: return "2" return "0"
def check_export_value(value: int): if value == 0: print(simple_colors.red("Not a valid option...")) return "0" elif value == -1: print(simple_colors.red("No export chosen...")) return "-1" elif value == 1: return "json" elif value == 2: return "html" return "0"
def check_value(value): if value == 0: print(simple_colors.red("Not a valid option...")) return False elif value == -1: print(simple_colors.red("Quiting...")) return True elif value == 1: app.search() elif value == 2: app.report_crime() elif value == 3: app.proximity_search(crime_list=app.get_crime_list()) return False
def print_proximity_options(): print(simple_colors.green("\n--- Proximity Options ---")) print( simple_colors.magenta( "Enter 1: Input your own longitude and latitude \'38.57037029,-121.4885667\'\n" "Enter 2: Use your current location")) print(simple_colors.red("Enter -1: Go back\n"))
def print_main_menu(): print(simple_colors.green("\n--- Main Menu ---")) print( simple_colors.magenta("Enter 1: Search for a crime\n" "Enter 2: Report a crime\n" "Enter 3: Find crimes in proximity")) print(simple_colors.red("Enter -1: Quit\n"))
def imprimirSinonimos(self, palavra): if(self.sinonimos != "404"): print("Sinônimos de: "+ red(palavra,['bold'])) for sinonimo in self.sinonimos: print (sinonimo) else: print("Erro - 404")
def print_categories(): print(simple_colors.green("\n--- Categories ---")) print( simple_colors.magenta( "Enter 1: Date and time \'1/1/06 0:00\'\n" "Enter 2: Address \'3108 OCCIDENTAL DR\'\n" "Enter 3: District \'2\'\n" "Enter 4: Grid \'508\'\n" "Enter 5: Crime description \'10851(A)VC TAKE VEH W/O OWNER\'\n" "Enter 6: UCR NCIC CODE \'2404\'")) print(simple_colors.red("Enter -1: Go back\n"))
def check_search_value(value: int) -> str: if value == 0: print(simple_colors.red("Not a valid option...")) return "0" elif value == -1: print(simple_colors.red("Going back...")) return "-1" elif value == 1: return "cdatetime" elif value == 2: return "address" elif value == 3: return "district" elif value == 4: return "grid" elif value == 5: return "crimedescr" elif value == 6: return "ucr_ncic_code" return "0"
def resolve1(lista, printare=0): frec = [] sum = 0 for row in lista: if row == '\n': sum += len(frec) frec = [] else: for char in row: if char not in frec and char != "\n": frec.append(char) if printare == 0: print(simple_colors.yellow("Sum now: ", "bold"), sum) print(simple_colors.red("Frec now: ", "bold"), frec) sum += len(frec) return sum
def resolve2(lista, printare=0): frec = [] sum = 0 first = 1 for row in lista: if row == '\n': sum += len(frec) if printare == 0: print(simple_colors.red("Questions: ", "bold"), frec) print(simple_colors.yellow("Sum now: ", "bold"), sum) print("------------------------------") frec = [] first = 1 else: if first == 0: frec=[char for char in frec if row.find(char)!=-1] else: frec=[char for char in row if char!="\n"] first = 0 sum += len(frec) return sum
def jogar(self): while True: palavra = input("Informe a palavra: ") try: self.interarJogo(palavra) self.dicas={} self.sinonimos=[] self.getDicas() self.sinonimos = self.scraping(palavra) self.aplicarDicas() print(red("Sinônimos possíveis")) self.imprimirSinonimos(palavra) except WebDriverException as erro: print("Erro - : ", erro) pass if(self.sinonimos != "404"): try: for sinonimo in self.sinonimos: if(self.interarJogo(sinonimo) =="fim da rodada"): break except KeyboardInterrupt: pass
def print_export_options(): print(simple_colors.green("\n--- Export Options ---")) print( simple_colors.magenta("Enter 1: JSON format\n" "Enter 2: HTML format")) print(simple_colors.red("Enter -1: Don't export\n"))