diff --git a/src/obspec/_attributes.py b/src/obspec/_attributes.py index 13be30b..0aa1f1f 100644 --- a/src/obspec/_attributes.py +++ b/src/obspec/_attributes.py @@ -1,6 +1,7 @@ from __future__ import annotations import sys +from collections.abc import Mapping from typing import Literal, Union if sys.version_info >= (3, 10): @@ -45,7 +46,7 @@ Any other string key specifies a user-defined metadata field for the object. """ -Attributes: TypeAlias = dict[Attribute, str] +Attributes: TypeAlias = Mapping[Attribute, str] """Additional attributes of an object Attributes can be specified in [`Put`][obspec.Put]/[`PutAsync`][obspec.PutAsync] and diff --git a/src/obspec/_put.py b/src/obspec/_put.py index 3591cdb..5d16f17 100644 --- a/src/obspec/_put.py +++ b/src/obspec/_put.py @@ -4,7 +4,13 @@ if TYPE_CHECKING: import sys - from collections.abc import AsyncIterable, AsyncIterator, Iterable, Iterator + from collections.abc import ( + AsyncIterable, + AsyncIterator, + Iterable, + Iterator, + Mapping, + ) from pathlib import Path from ._attributes import Attributes @@ -80,7 +86,7 @@ def put( # noqa: PLR0913 file: IO[bytes] | Path | bytes | Buffer | Iterator[Buffer] | Iterable[Buffer], *, attributes: Attributes | None = None, - tags: dict[str, str] | None = None, + tags: Mapping[str, str] | None = None, mode: PutMode | None = None, use_multipart: bool | None = None, chunk_size: int = ..., @@ -147,7 +153,7 @@ async def put_async( # noqa: PLR0913 | Iterable[Buffer], *, attributes: Attributes | None = None, - tags: dict[str, str] | None = None, + tags: Mapping[str, str] | None = None, mode: PutMode | None = None, use_multipart: bool | None = None, chunk_size: int = ...,