luml_api.utils.progress
BaseProgressHandler Objects
class BaseProgressHandler(ABC)
Base class for handling progress updates during upload/download processes.
This abstract base class provides a framework for tracking progress of an upload or download operation.
start
def start(file_name: str, total: int) -> None
Called before upload / download starts.
update
def update(chunk_size: int) -> None
Called with each chunk's byte size. Accumulates and calls on_chunk.
on_chunk
@abstractmethod
def on_chunk(uploaded: int, total: int) -> None
Called with cumulative uploaded and total bytes after each chunk.
finish
@abstractmethod
def finish() -> None
Called when upload / download completes.
PrintProgressHandler Objects
class PrintProgressHandler(BaseProgressHandler)
Handles and displays progress updates for a file upload process.
This class provides visual feedback during the file upload process by printing a progress bar to the console. It tracks the progress of chunks uploaded, displays an indicative progress bar and percentage, and signals the completion of the upload.
Attributes:
_file_namestr - The name of the file currently being uploaded._description_shownbool - Indicates whether the file upload description has already been displayed.
on_chunk
def on_chunk(uploaded: int, total: int) -> None
Handles progress updates for file upload by processing chunks and printing a progress bar.
Arguments:
uploadedint - The number of bytes that have been uploaded so far.totalint - The total number of bytes to be uploaded.