Source code for reemote.callbacks.progress.progress_bar
# Copyright (c) 2025 Kim Jarvis TPF Software Services S.A. kim.jarvis@tpfsystems.com # This software is licensed under the MIT License. See the LICENSE file for details.#
[docs]defprogress_bar(src_path,dst_path,copied_bytes,total_bytes):""" Progress callback with ASCII progress bar Args: src_path: Source builtin path dst_path: Destination builtin path copied_bytes: Number of bytes copied so far total_bytes: Total bytes to copy (None if unknown) """iftotal_bytesandtotal_bytes>0:bar_length=40filled_length=int(bar_length*copied_bytes//total_bytes)bar='█'*filled_length+'-'*(bar_length-filled_length)percentage=(copied_bytes/total_bytes)*100print(f'\r{bar}{percentage:.1f}% | {copied_bytes}/{total_bytes} bytes',end='',flush=True)# Print newline when transfer completesifcopied_bytes==total_bytes:print()