DriveFile#
- class nominal.experimental.drives.DriveFile(path, size_bytes, state, download_availability, observed_at)#
Bases:
DriveEntry,ABCA file in a drive, managed or mirrored from an external provider.
Both kinds share these fields and can be downloaded. Only a
ManagedDriveFilehas a revision history and can be moved or removed; narrow withisinstanceto reach those.- path#
Drive-relative path, with no leading or trailing slash.
- state: DriveFileState#
- download_availability: DownloadAvailability#
Whether the observed content can be downloaded.
- observed_at: IntegralNanosecondsUTC | None#
When the backend last observed this file.
- download(output_directory, *, part_size=DEFAULT_CHUNK_SIZE, num_retries=3)#
Download this file’s current content into a directory.
The download uses this snapshot’s revision reference. Nominal resolves virtual references and may fetch their content from the provider as it streams.
- Parameters:
- Returns:
Path the file was written to.
- Raises:
ValueError – The file’s name would not stay inside
output_directory, for example because it contains a backslash.NotADirectoryError –
output_directoryexists but is not a directory.FileNotFoundError –
output_directorydoes not exist.FileExistsError – A file already exists at the destination.
NominalFileStoreError – This managed file has no current revision.
NominalNotFoundError – This file’s bytes are no longer retained.
requests.HTTPError – A virtual file’s provider can no longer serve the observed content, or can’t be reached.
- Return type: