Skip to content

Commit 507009b

Browse files
authored
Update the frame type hints to support Axis and Frame (#4601)
1 parent add3a44 commit 507009b

21 files changed

Lines changed: 40 additions & 27 deletions

pygmt/src/basemap.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
from pygmt.alias import Alias, AliasSystem
1010
from pygmt.clib import Session
1111
from pygmt.helpers import build_arg_list, fmt_docstring, use_alias
12-
from pygmt.params import Box
12+
from pygmt.params import Axis, Box, Frame
1313

1414

1515
@fmt_docstring
@@ -20,7 +20,7 @@ def basemap( # noqa: PLR0913
2020
zscale: float | str | None = None,
2121
zsize: float | str | None = None,
2222
region: Sequence[float | str] | str | None = None,
23-
frame: str | Sequence[str] | Literal["none"] | bool = False,
23+
frame: Frame | Axis | Literal["none"] | str | Sequence[str] | bool = False,
2424
verbose: Literal["quiet", "error", "warning", "timing", "info", "compat", "debug"]
2525
| bool = False,
2626
map_scale: str | None = None,

pygmt/src/coast.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
from pygmt.clib import Session
1010
from pygmt.exceptions import GMTParameterError
1111
from pygmt.helpers import args_in_kwargs, build_arg_list, fmt_docstring, use_alias
12-
from pygmt.params import Box
12+
from pygmt.params import Axis, Box, Frame
1313

1414
__doctest_skip__ = ["coast"]
1515

@@ -30,7 +30,7 @@ def coast( # noqa: PLR0913
3030
box: Box | bool = False,
3131
projection: str | None = None,
3232
region: Sequence[float | str] | str | None = None,
33-
frame: str | Sequence[str] | Literal["none"] | bool = False,
33+
frame: Frame | Axis | Literal["none"] | str | Sequence[str] | bool = False,
3434
verbose: Literal["quiet", "error", "warning", "timing", "info", "compat", "debug"]
3535
| bool = False,
3636
panel: int | Sequence[int] | bool = False,

pygmt/src/colorbar.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -273,7 +273,7 @@ def colorbar( # noqa: PLR0913
273273
dpi: int | None = None,
274274
projection: str | None = None,
275275
region: Sequence[float | str] | str | None = None,
276-
frame: str | Sequence[str] | Literal["none"] | bool = False,
276+
frame: Frame | Axis | Literal["none"] | str | Sequence[str] | bool = False,
277277
verbose: Literal["quiet", "error", "warning", "timing", "info", "compat", "debug"]
278278
| bool = False,
279279
panel: int | Sequence[int] | bool = False,

pygmt/src/contour.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
is_nonstr_iter,
1515
use_alias,
1616
)
17+
from pygmt.params import Axis, Frame
1718

1819

1920
@fmt_docstring
@@ -40,7 +41,7 @@ def contour( # noqa: PLR0913
4041
no_clip: bool = False,
4142
projection: str | None = None,
4243
region: Sequence[float | str] | str | None = None,
43-
frame: str | Sequence[str] | Literal["none"] | bool = False,
44+
frame: Frame | Axis | Literal["none"] | str | Sequence[str] | bool = False,
4445
verbose: Literal["quiet", "error", "warning", "timing", "info", "compat", "debug"]
4546
| bool = False,
4647
panel: int | Sequence[int] | bool = False,

pygmt/src/grdcontour.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
kwargs_to_strings,
1818
use_alias,
1919
)
20+
from pygmt.params import Axis, Frame
2021

2122
__doctest_skip__ = ["grdcontour"]
2223

@@ -40,7 +41,7 @@ def grdcontour(
4041
grid: PathLike | xr.DataArray,
4142
projection: str | None = None,
4243
region: Sequence[float | str] | str | None = None,
43-
frame: str | Sequence[str] | Literal["none"] | bool = False,
44+
frame: Frame | Axis | Literal["none"] | str | Sequence[str] | bool = False,
4445
verbose: Literal["quiet", "error", "warning", "timing", "info", "compat", "debug"]
4546
| bool = False,
4647
panel: int | Sequence[int] | bool = False,

pygmt/src/grdimage.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
from pygmt.alias import Alias, AliasSystem
1111
from pygmt.clib import Session
1212
from pygmt.helpers import build_arg_list, fmt_docstring, use_alias
13+
from pygmt.params import Axis, Frame
1314

1415
__doctest_skip__ = ["grdimage"]
1516

@@ -32,7 +33,7 @@ def grdimage( # noqa: PLR0913
3233
no_clip: bool = False,
3334
projection: str | None = None,
3435
region: Sequence[float | str] | str | None = None,
35-
frame: str | Sequence[str] | Literal["none"] | bool = False,
36+
frame: Frame | Axis | Literal["none"] | str | Sequence[str] | bool = False,
3637
verbose: Literal["quiet", "error", "warning", "timing", "info", "compat", "debug"]
3738
| bool = False,
3839
panel: int | Sequence[int] | bool = False,

pygmt/src/grdview.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
from pygmt.clib import Session, __gmt_version__
1313
from pygmt.exceptions import GMTParameterError
1414
from pygmt.helpers import build_arg_list, deprecate_parameter, fmt_docstring, use_alias
15+
from pygmt.params import Axis, Frame
1516
from pygmt.src.grdinfo import grdinfo
1617

1718
__doctest_skip__ = ["grdview"]
@@ -138,7 +139,7 @@ def grdview( # noqa: PLR0913
138139
zscale: float | str | None = None,
139140
zsize: float | str | None = None,
140141
region: Sequence[float | str] | str | None = None,
141-
frame: str | Sequence[str] | Literal["none"] | bool = False,
142+
frame: Frame | Axis | Literal["none"] | str | Sequence[str] | bool = False,
142143
verbose: Literal["quiet", "error", "warning", "timing", "info", "compat", "debug"]
143144
| bool = False,
144145
panel: int | Sequence[int] | bool = False,

pygmt/src/histogram.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
kwargs_to_strings,
1717
use_alias,
1818
)
19+
from pygmt.params import Axis, Frame
1920

2021

2122
@fmt_docstring
@@ -49,7 +50,7 @@ def histogram( # noqa: PLR0913
4950
bar_offset: float | str | None = None,
5051
projection: str | None = None,
5152
region: Sequence[float | str] | str | None = None,
52-
frame: str | Sequence[str] | Literal["none"] | bool = False,
53+
frame: Frame | Axis | Literal["none"] | str | Sequence[str] | bool = False,
5354
verbose: Literal["quiet", "error", "warning", "timing", "info", "compat", "debug"]
5455
| bool = False,
5556
panel: int | Sequence[int] | bool = False,

pygmt/src/image.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
from pygmt.alias import Alias, AliasSystem
1010
from pygmt.clib import Session
1111
from pygmt.helpers import build_arg_list, fmt_docstring, use_alias
12-
from pygmt.params import Box, Position
12+
from pygmt.params import Axis, Box, Frame, Position
1313
from pygmt.src._common import _parse_position
1414

1515

@@ -28,7 +28,7 @@ def image( # noqa: PLR0913
2828
invert: bool = False,
2929
projection: str | None = None,
3030
region: Sequence[float | str] | str | None = None,
31-
frame: str | Sequence[str] | Literal["none"] | bool = False,
31+
frame: Frame | Axis | Literal["none"] | str | Sequence[str] | bool = False,
3232
verbose: Literal["quiet", "error", "warning", "timing", "info", "compat", "debug"]
3333
| bool = False,
3434
panel: int | Sequence[int] | bool = False,

pygmt/src/legend.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
from pygmt.clib import Session
1212
from pygmt.exceptions import GMTTypeError
1313
from pygmt.helpers import build_arg_list, data_kind, fmt_docstring, is_nonstr_iter
14-
from pygmt.params import Box, Position
14+
from pygmt.params import Axis, Box, Frame, Position
1515
from pygmt.src._common import _parse_position
1616

1717

@@ -27,7 +27,7 @@ def legend( # noqa: PLR0913
2727
scale: float | None = None,
2828
projection: str | None = None,
2929
region: Sequence[float | str] | str | None = None,
30-
frame: str | Sequence[str] | Literal["none"] | bool = False,
30+
frame: Frame | Axis | Literal["none"] | str | Sequence[str] | bool = False,
3131
verbose: Literal["quiet", "error", "warning", "timing", "info", "compat", "debug"]
3232
| bool = False,
3333
panel: int | Sequence[int] | bool = False,

0 commit comments

Comments
 (0)