chesscog.core.io package¶
Core file system operations.
This module is included by default to set up the paths for use with recap.URI
.
Submodules¶
chesscog.core.io.download module¶
Module for downloading and extracting ZIP files from various sources.
- chesscog.core.io.download.download_file(url: str, destination: os.PathLike, show_size: bool = False)¶
Download a file from a URL to a destination.
- Parameters
url (str) – the URL
destination (os.PathLike) – the destination
show_size (bool, optional) – whether to display a progress bar. Defaults to False.
- chesscog.core.io.download.download_zip_folder(url: str, destination: os.PathLike, show_size: bool = False, skip_if_exists: bool = True)¶
Download and extract a ZIP folder from a URL.
The file is first downloaded to a temporary location and then extracted to the target folder.
- Parameters
url (str) – the URL of the ZIP file
destination (os.PathLike) – the destination folder
show_size (bool, optional) – whether to display a progress bar. Defaults to False.
skip_if_exists (bool, optional) – if true, will do nothing when the destination path exists already. Defaults to True.
- chesscog.core.io.download.download_zip_folder_from_google_drive(file_id: str, destination: os.PathLike, show_size: bool = False, skip_if_exists: bool = True)¶
Download and extract a ZIP file from Google Drive.
- Parameters
file_id (str) – the Google Drive file ID
destination (os.PathLike) – the destination folder
show_size (bool, optional) – whether to display a progress bar. Defaults to False.
skip_if_exists (bool, optional) – if true, will do nothing when the destination path exists already. Defaults to True.