How to use the rich.progress.Progress function in rich

To help you get started, we’ve selected a few rich examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github ccev / stopwatcher / stop_watcher.py View on Github external
if "removal" in fil["edit_types"]:
                config.console.log("Looking for Stop Removals")
                stops = queries.get_deleted_stops(deleted_timespan_stops, fil["area"])
                if len(stops) <= deleted_max_stops:
                    for s_id, s_lat, s_lon, s_name, s_img in stops:
                        if not s_id in deleted_cache["stops"]:
                            stop = waypoint(queries, config, "stop", s_id, s_name, s_img, s_lat, s_lon)
                            stop.send_deleted(fil)
                            if not s_id in new_deleted_cache["stops"]:
                                new_deleted_cache["stops"].append(s_id)
                else:
                    config.console.log(f"Stop amount exceeded the limit of {deleted_max_portals} - Check your Scanner Setup")
        
        if "gym" in fil["edits"]:
            with Progress(console=config.console) as progress:
                task = progress.add_task("Looking for Gym Edits", total=len(edit_list["gyms"][fil["area"]]))
                for g_id, g_lat, g_lon, g_name, g_img in edit_list["gyms"][fil["area"]]:
                    g = queries.get_full_gym_by_id(g_id)
                    #0=lat, 1=lon, 2=name, 3=img
                    check_edits(fil, g, "gym", g_id, g_lat, g_lon, g_name, g_img)
                    progress.update(task, advance=1)

            if "removal" in fil["edit_types"]:
                config.console.log("Looking for Gym Removals")
                gyms = queries.get_deleted_gyms(deleted_timespan_stops, fil["area"])
                if len(gyms) <= deleted_max_stops:
                    for g_id, g_lat, g_lon, g_name, g_img in gyms:
                        if not g_id in deleted_cache["gyms"]:
                            gym = waypoint(queries, config, "gym", g_id, g_name, g_img, g_lat, g_lon)
                            gym.send_deleted(fil)
                            if not g_id in new_deleted_cache["gyms"]: