s3torchconnector.s3writer

Classes

S3Writer

A write-only, file like representation of a single object stored in S3.

Module Contents

class s3torchconnector.s3writer.S3Writer(stream: s3torchconnectorclient._mountpoint_s3_client.PutObjectStream)[source]

Bases: io.BufferedIOBase

A write-only, file like representation of a single object stored in S3.

stream[source]
write(data: bytes | memoryview) int[source]

Write bytes to S3 Object specified by bucket and key

Parameters:

data (bytes | memoryview) – bytes to write

Returns:

Number of bytes written

Return type:

int

Raises:

S3Exception – An error occurred accessing S3.

close()[source]

Close write-stream to S3. Ensures all bytes are written successfully.

Raises:

S3Exception – An error occurred accessing S3.

flush()[source]

No-op

readable() bool[source]
Returns:

Return whether object was opened for reading.

Return type:

bool

writable() bool[source]
Returns:

Return whether object was opened for writing.

Return type:

bool

tell() int[source]
Returns:

Current stream position.

Return type:

int