Upload module for elements.

Classes:

FileUploadDict

UploadProcess(settings, *uploads)

A process to upload multiple files.

Functions:

resolve_uploads(*uploads[, recursive, ...])

Resolve files and folders into individual upload files.

upload(*files, **setting_kws)

Convenience function to upload multiple files.

class elements_http_upload.upload.FileUploadDict

Bases: TypedDict

Attributes:

source

target

source: Path | str
target: Path | str
class elements_http_upload.upload.UploadProcess(settings: UploadSettings, *uploads: FileUpload)

Bases: object

A process to upload multiple files.

Methods:

finish_uploads_worker()

A worker to finish uploads

register_upload_worker()

Register the upload for the individual file uploads

split_files_worker()

Worker to split files input smaller chunks for upload.

start()

Start the upload process.

upload_chunk_worker()

A worker function to upload chunks

finish_uploads_worker() None

A worker to finish uploads

register_upload_worker() None

Register the upload for the individual file uploads

split_files_worker() None

Worker to split files input smaller chunks for upload.

start()

Start the upload process.

upload_chunk_worker() None

A worker function to upload chunks

elements_http_upload.upload.resolve_uploads(*uploads: FileUpload, recursive: bool = False, target_root: Path | None = None) List[FileUpload]

Resolve files and folders into individual upload files.

Parameters:
  • *uploads (FileUpload) – The file or directory information for the upload. If a source points to a directory, recursive has to be true.

  • recursive (bool, optional) – Whether folders should be check recursively, by default False. If an uploads source points to a directory and this option is False, an error is raised.

  • target_root (Optional[Path], optional) – Root folder on the remote system, by default None. If this is set, all target paths in the uploads need to be relative and will be appended to the target_root. If this is not, all target paths in the uploads need to be absolute paths.

Returns:

_description_

Return type:

List[FileUpload]

elements_http_upload.upload.upload(*files: FileUpload | FileUploadDict | str, **setting_kws)

Convenience function to upload multiple files.

This function is a conventience method to upload multiple files. It starts an upload process with the given settings and uploads them in parallel.

Parameters: