def print_posts(self, posts): for i, post in enumerate(posts): time.sleep(.2) Console.warn(f'{i+1} : {post.h2.a.text}') self.posts.append({ 'post_title': post.h2.a.text, 'post_link': post.h2.a['href'] })
def find_file(self, file_name): self.file_to_find = file_name[0] Console.log( f'Finding "{Console.green(self.file_to_find)}" in {Console.green(file_name[1][0])}. Please wait...' ) for file_obj in os.walk(file_name[1][0]): self.fnames = file_obj[2] self.dir_path = file_obj[0] multi_process_this(self.fnames, self.actual_finding_of_a_file) print('\n') print_out = f"found {len(self.found_files)} resluts of '{self.file_name}'" time.sleep(.2) Console.warn(line(print_out)) time.sleep(.2) Console.log(print_out) time.sleep(.2) Console.warn(line(print_out, '-')) if len(self.found_files): self.choose_to_copy_files()
def choose_operation(self): Console.warn('\t\t Choose ( 1 ) for compressing') time.sleep(.5) Console.warn('\t\t Choose ( 2 ) for decompressing') time.sleep(.3) operation = input(f"\n{Console.green('Operation > ')}") try: choice = int(operation) if choice not in [1, 2]: Console.error('Not among opertaion. Retry again...') time.sleep(.3) self.choose_operation() if choice == 1: return self.compress_operation() else: return self.decompress_operation() except Exception as e: # print(e.with_traceback()) Console.error('Invalid opertaion. Retry again...') time.sleep(.3) return self.choose_operation()
def remove_file(self, filename): Console.warn(f'Removing { filename }, Please wait...') delete_file(filename) time.sleep(.3) Console.info(f'All done.')