mekasu0124

Untitled

May 5th, 2024
55
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.25 KB | None | 0 0
  1. import time
  2. import asyncio
  3.  
  4. from .infrastructure.services.result import Result
  5. from .infrastructure.database.create_database import Database
  6. from .infrastructure.services.helpers import Helpers
  7.  
  8. from rich.progress import Progress
  9.  
  10. async def start_program():
  11.     helpers = Helpers()
  12.     database = Database()
  13.  
  14.     with Progress() as progress:
  15.       task = progress.add_task("Checking For Setup Files", total=100)
  16.  
  17.       setup_file_check = await helpers.check_infrastructure_setup(progress)
  18.  
  19.       if not setup_file_check.is_success:
  20.           return Result.fail(setup_file_check.message)
  21.  
  22.       task2 = progress.add_task("Checking For Database Files", total=100)
  23.      
  24.       database_file_check = database.check_for_db_file(progress)
  25.  
  26.       if not database_file_check.is_success:
  27.           return Result.fail(database_file_check.message)
  28.  
  29.       task3 = progress.add_task("Checking For Existing Users", total=100)
  30.       # database code here
  31.  
  32.       while not progress.finished:
  33.           progress.update(task, advance=33)
  34.           progress.update(task2, advance=33)
  35.           progress.update(task3, advance=34)
  36.           time.sleep(0.02)
  37.    
  38.     print(setup_file_check.message)
  39.     print(database_file_check.message)
  40.  
  41. start_program()
  42.  
Advertisement
Add Comment
Please, Sign In to add comment