Skip to content
Roboto
Esc
↑↓navigate↵open⌘Jpreview
On this page

roboto.storage.object_store

Submodules

Package Contents

CredentialProvider

type roboto.storage.object_store.CredentialProvider = typing.Callable[[], Credentials]#View Source

Credentials

class roboto.storage.object_store.Credentials#View Source

Bases: TypedDict

This interface is driven by botocore.credentials.RefreshableCredentials

Attributes

Credentials.access_key

access_key str #

Credentials.expiry_time

expiry_time str | None #

Credentials.region

region str #

Credentials.secret_key

secret_key str #

Credentials.token

token str #

FutureLike

class roboto.storage.object_store.FutureLike#View Source

Bases: Protocol[T_co]

Protocol for future-like objects.

FutureLike.done()

done()#View Source

Return True if the future is done.

Return type

bool

FutureLike.result()

result()#View Source

Wait for and return the result.

Return type

ObjectStore

class roboto.storage.object_store.ObjectStore#View Source

Bases: Protocol

Base class for protocol classes.

Protocol classes are defined as:

class Proto(Protocol):
    def meth(self) -> int:
        ...

Such classes are primarily used with static type checkers that recognize structural subtyping (static duck-typing).

For example:

class C:
    def meth(self) -> int:
        return 0

def func(x: Proto) -> int:
    return x.meth()

func(C())  # Passes static type check

See PEP 544 for details. Protocol classes decorated with @typing.runtime_checkable act as simple-minded runtime protocols that check only the presence of given attributes, ignoring their type signatures. Protocol classes can be generic, they are defined as:

class GenProto[T](Protocol):
    def meth(self) -> T:
        ...

ObjectStore.create()

classmethod create(credential_provider, **kwargs)#View Source

Parameters

credential_provider CredentialProvider

Return type

ObjectStore.get()

get(source_uri, destination, on_progress=None)#View Source

Downloads a file from a cloud URI to a local path.

Parent directories of the destination path are created automatically if they don’t exist.

Parameters

source_uri str

Full URI (e.g., ‘s3://my-bucket/folder/data.csv’)

destination pathlib.Path

Local path where the file should be saved.

on_progress Optional[OnProgress]

Optional callback to be periodically called with the number of bytes downloaded.

Return type

ObjectStore.put()

put(source, destination_uri, on_progress=None)#View Source

Uploads a local file to a specific cloud URI.

Parameters

source pathlib.Path

Local path to the file.

destination_uri str

Full URI (e.g., ‘s3://my-bucket/folder/data.csv’)

on_progress Optional[OnProgress]

Optional callback to be periodically called with the number of bytes uploaded.

Return type

OnProgress

type roboto.storage.object_store.OnProgress = typing.Callable[[int], None]#View Source

S3Store

class roboto.storage.object_store.S3Store(s3_client, transfer_config=None)#View Source

Bases: roboto.storage.object_store.object_store.ObjectStore

Base class for protocol classes.

Protocol classes are defined as:

class Proto(Protocol):
    def meth(self) -> int:
        ...

Such classes are primarily used with static type checkers that recognize structural subtyping (static duck-typing).

For example:

class C:
    def meth(self) -> int:
        return 0

def func(x: Proto) -> int:
    return x.meth()

func(C())  # Passes static type check

See PEP 544 for details. Protocol classes decorated with @typing.runtime_checkable act as simple-minded runtime protocols that check only the presence of given attributes, ignoring their type signatures. Protocol classes can be generic, they are defined as:

class GenProto[T](Protocol):
    def meth(self) -> T:
        ...

Parameters

s3_client botocore.client.BaseClient
transfer_config Optional[boto3.s3.transfer.TransferConfig]

S3Store.create()

classmethod create(credential_provider, **kwargs)#View Source

Factory function to assemble an S3Store with refreshable credentials.

S3Store.get()

get(source_uri, destination, on_progress=None)#View Source

Downloads a file from a cloud URI to a local path.

Parent directories of the destination path are created automatically if they don’t exist.

Parameters

source_uri str

Full URI (e.g., ‘s3://my-bucket/folder/data.csv’)

destination pathlib.Path

Local path where the file should be saved.

Optional callback to be periodically called with the number of bytes downloaded.

S3Store.put()

put(source, destination_uri, on_progress=None)#View Source

Uploads a local file to a specific cloud URI.

Parameters

source pathlib.Path

Local path to the file.

destination_uri str

Full URI (e.g., ‘s3://my-bucket/folder/data.csv’)

Optional callback to be periodically called with the number of bytes uploaded.

StoreRegistry

class roboto.storage.object_store.StoreRegistry#View Source

StoreRegistry.get_store_for_uri()

classmethod get_store_for_uri(uri, credential_provider, **kwargs)#View Source

StoreRegistry.register()

classmethod register(scheme)#View Source

Class Decorator. Registers the decorated class to handle the specific URI scheme.

Parameters

scheme str

Was this page helpful?