def face_verify_clicked(self): if not os.path.exists("user_face/user.jpg"): Prompt("系统未录入人脸数据,请进行初始化系统!", self).show() return self.face_ui.set_mode(1) self.hide() self.face_ui.show()
def main(): """ Main execution thread """ options = Options().load_options() prompt = Prompt(options) prompt.prompt = 'falconbot> ' prompt.cmdloop('[+] Starting falconbot interface...')
def init_verify_clicked(self): if os.path.exists("user_face/user.jpg"): Prompt("已经录入人脸数据,请直接进行验证!", self).show() return self.face_ui.set_mode(0) self.hide() self.face_ui.show()
def main(): print(Banner("GUESS THE NUMBER APP").content) calibrator = Calibrator(random.randint(0, 100)) prompt = Prompt() success = False while not success: calibration = calibrator.calibrate(prompt.input()) print(calibration.message) success = calibration.is_equal
def main(): """ Main execution thread """ options = Options().load_options() connect_string = "host=" + options["host"] + " port=" + options[ "port"] + " dbname=" + options["db"] + " user="******"username"] + " password="******"password"] prompt = Prompt(connect_string) prompt.prompt = 'schemabridge> ' prompt.cmdloop('[+] Starting schemabridge interface...')
def key_clicked(self, number): self.save_password = self.save_password + str(number) self.show_passwd.setText(self.save_password) if len(self.save_password) == 6: if encryption(self.save_password) == ALApi.get_infor_data()[1]: Door.turn_on_door() self.hide() self.main.showFullScreen() else: Prompt("密码错误!", self).show() self.save_password = "" self.show_passwd.clear()
def main() -> None: """Main function to run the app.""" prompt = Prompt() prompt.greet() prompt.check_conditions() iterate_through_primary = prompt.iterate_through_primary() iterate_through_secondary = prompt.iterate_through_secondary() prompt.announce_start() clicker = Clicker(iterate_through_primary, iterate_through_secondary) clicker.run()
def face_verify(self): known_face_encodings = [self.face_encoding] known_face_names = ["user"] process_this_frame = True ret, frame = Monitor.cap.read() small_frame = cv2.resize(frame, (0, 0), fx=0.25, fy=0.25) rgb_small_frame = small_frame[:, :, ::-1] if process_this_frame: face_locations = face_recognition.face_locations(rgb_small_frame) face_encodings = face_recognition.face_encodings( rgb_small_frame, face_locations) for face_encoding in face_encodings: matches = face_recognition.compare_faces(known_face_encodings, face_encoding, tolerance=0.3) face_distances = face_recognition.face_distance( known_face_encodings, face_encoding) best_match_index = np.argmin(face_distances) if matches[best_match_index]: name = known_face_names[best_match_index] if name == "user": self.ui_prompt.setText("请保持不动!") self.verify_num = self.verify_num + 1 else: self.ui_prompt.clear() self.verify_num = 0 self.verify_count += 1 if self.verify_count == 50: Prompt("识别失败!", self).show() self.verify_count = 0 self.error += 1 if self.error == 3: self.error = 0 self.hide() self.main.showFullScreen() self.face_verify_timer.stop() frame = cv2.cvtColor(frame, cv2.COLOR_RGB2BGR) image = QImage(frame.data, frame.shape[1], frame.shape[0], QImage.Format_RGB888) self.video_label.setPixmap( QPixmap.fromImage(image).scaled(self.video_label.width(), self.video_label.height())) if self.verify_num == 10: self.verify_num = 0 Door.turn_on_door() self.face_verify_timer.stop() self.hide() self.main.showFullScreen() self.ui_prompt.clear()
from prompt import Prompt from candidate_program import CandidateProgram, JsonLogger import sys if __name__ == "__main__": instructions_json = JsonLogger() instructions = instructions_json.open_and_read() prompt = Prompt() json_location_string = 'installing all prorgams from {0}'.format(instructions_json.location) prompt.greet(add=json_location_string) prompt.write_to_prompt('here\'s the list of what I found:') prompt.write_separator() prompt.column_print(list(instructions.keys())) prompt.write_separator() if not prompt.ask_confirmation('would you like to procede?'): prompt.write_to_prompt('Ok, bye!') sys.exit(0) for program, install_instruction in instructions.items(): candidate = CandidateProgram(**install_instruction) candidate.add_repo_ppa() candidate.add_repo_key() candidate.add_repo_deb() candidate.install(v=1)
from manager_lxc_utils import (_change_container_key, _container_state, _create_container, _delete_container, _launch_container, _restart_container, _start_container, _stop_container) from prompt import Prompt from utils import (ContainerState, _check_container_name, _check_login, _check_password, _generate_container_name, _images_detail, _owning_containers_name, gen_keys) if __name__ == '__main__': current_path = os.path.split(os.path.abspath(__file__))[0] config = configparser.ConfigParser() config.read(os.path.join(current_path, 'config.ini')) ip_start = config['DEFAULT'].get('ip_start') port_start = config['DEFAULT'].getint('port_start') default_image_fingerprint = config['DEFAULT'].get( 'default_image_fingerprint') db_path = config['DEFAULT'].get('db_path') lxc_nvidia_profile = config['DEFAULT'].get('lxc_image_profile') nobody = config['DEFAULT'].get('nobody', 'nobody') client = pylxd.Client() prompt = Prompt(db_path, client, port_start, ip_start, default_image_fingerprint, profiles=[lxc_nvidia_profile, 'default'], nobody=nobody) prompt.cmdloop() exit()