zyra.connectors package

Subpackages

Module contents

Connectors package: ingest and egress submodules and shared backends.

Primary usage favors functional backends under zyra.connectors.backends. For flows that benefit from a light OO wrapper (e.g., persisting bucket/host config), thin connector classes are available in zyra.connectors.clients.

class zyra.connectors.ByteRanged(*args, **kwargs)[source]

Bases: Protocol

download_byteranges(*args: Any, **kwargs: Any) bytes[source]
class zyra.connectors.Connector[source]

Bases: object

Minimal abstract base for connector wrappers.

Provides only introspection helpers and context manager convenience. It does not impose a lifecycle or specific methods on subclasses. Concrete wrapper classes are free to delegate to functional backends.

property capabilities: set[str]
class zyra.connectors.Deletable(*args, **kwargs)[source]

Bases: Protocol

delete(*args: Any, **kwargs: Any) bool[source]
class zyra.connectors.Existsable(*args, **kwargs)[source]

Bases: Protocol

exists(*args: Any, **kwargs: Any) bool[source]
class zyra.connectors.FTPConnector(host: str, port: int = 21, username: str = 'anonymous', password: str = 'test@test.com', timeout: int = 30)[source]

Bases: Connector

Thin OO wrapper around the FTP backend for convenience.

Stores host/credentials and exposes methods that accept path-only inputs. All methods delegate to functional backends.

CAPABILITIES = {'fetch', 'list', 'upload'}
delete(path: str) bool[source]

Delete a remote path on this FTP host.

exists(path: str) bool[source]

Return True if the path exists on this FTP host.

fetch_bytes(path: str) bytes[source]

Fetch a remote file from this FTP host as bytes.

list_files(remote_dir: str, pattern: str | None = None, *, since: str | None = None, until: str | None = None, date_format: str | None = None) list[str] | None[source]

List files under a remote directory with optional filters.

stat(path: str)[source]

Return minimal metadata mapping for a remote path.

sync_directory(remote_dir: str, local_dir: str, *, pattern: str | None = None, since: str | None = None, until: str | None = None, date_format: str | None = None) None[source]

Mirror a remote directory on this FTP host to a local directory.

upload_bytes(data: bytes, path: str) bool[source]

Upload bytes to a remote path on this FTP host.

class zyra.connectors.Fetchable(*args, **kwargs)[source]

Bases: Protocol

fetch_bytes(*args: Any, **kwargs: Any) bytes[source]
class zyra.connectors.Indexable(*args, **kwargs)[source]

Bases: Protocol

get_idx_lines(*args: Any, **kwargs: Any) Iterable[str][source]
class zyra.connectors.Listable(*args, **kwargs)[source]

Bases: Protocol

list_files(*args: Any, **kwargs: Any) Iterable[str] | None[source]
class zyra.connectors.S3Connector(bucket: str, *, unsigned: bool = False)[source]

Bases: Connector

Thin OO wrapper around the S3 backend for convenience.

Stores bucket configuration and exposes familiar object operations.

CAPABILITIES = {'fetch', 'list', 'upload'}
delete(key: str) bool[source]

Delete an object from the configured bucket.

download_byteranges(key: str, byte_ranges: Iterable[str], *, max_workers: int = 10) bytes[source]

Download multiple byte ranges and concatenate them in order.

exists(key: str) bool[source]

Return True if the object exists in the configured bucket.

fetch_bytes(key: str) bytes[source]

Fetch object bytes from the configured bucket.

get_idx_lines(key: str) list[str][source]

Fetch and parse the GRIB .idx for an object in the bucket.

list_files(prefix: str | None = None, *, pattern: str | None = None, since: str | None = None, until: str | None = None, date_format: str | None = None) list[str] | None[source]

List keys under an optional prefix with optional filters.

stat(key: str)[source]

Return basic metadata mapping for an object in the bucket.

upload_bytes(data: bytes, key: str) bool[source]

Upload bytes as an object to the configured bucket.

class zyra.connectors.Statable(*args, **kwargs)[source]

Bases: Protocol

stat(*args: Any, **kwargs: Any) Any[source]
class zyra.connectors.Uploadable(*args, **kwargs)[source]

Bases: Protocol

upload_bytes(data: bytes, *args: Any, **kwargs: Any) bool[source]