trajdl.datasets.open_source.utils module

trajdl.datasets.open_source.utils module#

trajdl.datasets.open_source.utils.decompress_gz(gz_path: str, output_path: str) None[source]#

Decompress a .gz file.

Parameters:
  • gz_path (str) – The path to the .gz file.

  • output_path (str) – The path where the decompressed file will be saved.

trajdl.datasets.open_source.utils.download_file(url: str, path: str, chunk_size: int = 8192) None[source]#

Download a file from a URL.

Parameters:
  • url (str) – The URL to download the file from.

  • path (str) – The path where the downloaded file will be saved.

  • chunk_size (int, optional) – The size of each download chunk (default is 8192).

Raises:

RuntimeError – If the download fails for any reason.

trajdl.datasets.open_source.utils.remove_path(path)[source]#

Remove the specified file or directory, making it non-existent.

Parameters:

path (str) – The path to the file or directory to be deleted.

Return type:

None

Raises:

Exception – If an error occurs while deleting the path.

Notes

  • If the specified path does not exist, a message indicating that will be printed.

  • If the path is a directory, it will be removed recursively.

trajdl.datasets.open_source.utils.unzip_file(zip_file_path: str, output_folder: str) None[source]#

Unzip a zip file to a specified folder.

Parameters:
  • zip_file_path (str) – The path to the zip file.

  • output_folder (str) – The directory where the zip file will be extracted.