tlcurl.url_adapters.s3_url_adapter¶

An adapter for resolving reads/writes to URLs starting with s3://

Module Contents¶

Classes¶

Class

Description

S3UrlAdapter

An adapter for resolving reads/writes to URLs starting with s3://

S3UrlAdapterDirEntry

A directory entry for an S3UrlAdapter

Data¶

Data

Description

logger

API¶

class S3UrlAdapter¶

Bases: tlcurl.url_adapters.fsspec_url_adapter.FSSpecUrlAdapter

An adapter for resolving reads/writes to URLs starting with s3://

is_file_hierarchy_flat() bool¶
read_string_content_from_url(
url: Url,
encoding: str = 'utf-8',
) str¶

Read the content of a file as a string.

This function overrides the FSSpecUrlAdapter base class implementation which uses read_text(). We use read_bytes().decode() instead since S3FileSystem.read_text() makes an unnecessary and expensive head_object API call to S3.

Parameters:

url – The URL of the file to read

Returns:

The content of the file as a string

s3_protocol = None¶
s3_scheme = None¶
schemes() list[Scheme]¶
touch(
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

class S3UrlAdapterDirEntry(
ls_info: dict[str, Any],
)¶

Bases: tlcurl.url_adapters.fsspec_url_adapter.FSSpecUrlAdapterDirEntry

A directory entry for an S3UrlAdapter

mtime() 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

property name: str¶
property path: str¶
logger = getLogger(...)¶