tlc.core.url_adapters.s3_url_adapter
¶
An adapter for resolving reads/writes to URLs starting with s3://
Module Contents¶
Classes¶
Class |
Description |
---|---|
A directory entry for an S3UrlAdapter |
|
An adapter for resolving reads/writes to URLs starting with |
API¶
- class tlc.core.url_adapters.s3_url_adapter.S3UrlAdapterDirEntry(ls_info: dict[str, Any])¶
Bases:
tlc.core.url_adapters.fsspec_url_adapter.FSSpecUrlAdapterDirEntry
A directory entry for an S3UrlAdapter
- mtime() datetime.datetime ¶
Get the last modification time of the file.
- Raises:
AttributeError if the modification time is not available
- Returns:
The modification time as a datetime
- class tlc.core.url_adapters.s3_url_adapter.S3UrlAdapter¶
Bases:
tlc.core.url_adapters.fsspec_url_adapter.FSSpecUrlAdapter
An adapter for resolving reads/writes to URLs starting with
s3://
- s3_scheme = None¶
- s3_protocol = None¶
- schemes() list[tlc.core.url.Scheme] ¶
- touch(url: tlc.core.url.Url) None ¶
Update the last modified timestamp of a file to the current time. Creates the file if it doesn’t exist.
- Parameters:
url – The URL of the file to touch
- read_string_content_from_url(url: tlc.core.url.Url) str ¶
Read the content of a file as a string.
This function overrides the FSSpecUrlAdapter base class implementation which uses
read_text()
. We useread_bytes().decode()
instead sinceS3FileSystem.read_text()
makes an unnecessary and expensivehead_object
API call to S3.- Parameters:
url – The URL of the file to read
- Returns:
The content of the file as a string