Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion src/obspec/_attributes.py
Original file line number Diff line number Diff line change
@@ -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):
Expand Down Expand Up @@ -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
Expand Down
12 changes: 9 additions & 3 deletions src/obspec/_put.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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 = ...,
Expand Down Expand Up @@ -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 = ...,
Expand Down
Loading