Skip to content

Commit 114a657

Browse files
authored
TYP: Use Mapping instead of dict to support dict-like objects (#4026)
1 parent 170f82e commit 114a657

File tree

3 files changed

+6
-5
lines changed

3 files changed

+6
-5
lines changed

pygmt/datasets/load_remote_dataset.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"""
44

55
import contextlib
6-
from collections.abc import Sequence
6+
from collections.abc import Mapping, Sequence
77
from typing import Any, Literal, NamedTuple
88

99
import xarray as xr
@@ -58,8 +58,8 @@ class GMTRemoteDataset(NamedTuple):
5858
description: str
5959
kind: Literal["grid", "image"]
6060
units: str | None
61-
resolutions: dict[str, Resolution]
62-
extra_attributes: dict[str, Any]
61+
resolutions: Mapping[str, Resolution]
62+
extra_attributes: Mapping[str, Any]
6363
crs: str | None = None
6464

6565

pygmt/datatypes/header.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
"""
44

55
import ctypes as ctp
6+
from collections.abc import Mapping
67
from typing import Any, ClassVar
78

89
import numpy as np
@@ -199,7 +200,7 @@ def name(self) -> str:
199200
return "z"
200201

201202
@property
202-
def data_attrs(self) -> dict[str, Any]:
203+
def data_attrs(self) -> Mapping[str, Any]:
203204
"""
204205
Attributes for the data variable from the grid header.
205206
"""

pygmt/helpers/utils.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -481,7 +481,7 @@ def non_ascii_to_octal(argstr: str, encoding: Encoding = "ISOLatin1+") -> str:
481481

482482

483483
def build_arg_list( # noqa: PLR0912
484-
kwdict: dict[str, Any],
484+
kwdict: Mapping[str, Any],
485485
confdict: Mapping[str, Any] | None = None,
486486
infile: PathLike | Sequence[PathLike] | None = None,
487487
outfile: PathLike | None = None,

0 commit comments

Comments
 (0)