Skip to content

Commit d0211b8

Browse files
committed
Improve type hints for region
1 parent d1dbcba commit d0211b8

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

49 files changed

+96
-53
lines changed

pygmt/src/basemap.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
basemap - Plot base maps and frames.
33
"""
44

5+
from collections.abc import Sequence
56
from typing import Literal
67

78
from pygmt.alias import AliasSystem
@@ -25,7 +26,7 @@
2526
def basemap(
2627
self,
2728
projection=None,
28-
region=None,
29+
region: Sequence[float | str] | str | None = None,
2930
verbose: Literal["quiet", "error", "warning", "timing", "info", "compat", "debug"]
3031
| bool = False,
3132
panel: int | tuple[int, int] | bool = False,

pygmt/src/binstats.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
binstats - Bin spatial data and determine statistics per bin.
33
"""
44

5+
from collections.abc import Sequence
56
from typing import Literal
67

78
import xarray as xr
@@ -47,7 +48,7 @@ def binstats(
4748
"sum",
4849
] = "number",
4950
quantile_value: float = 50,
50-
region=None,
51+
region: Sequence[float | str] | str | None = None,
5152
verbose: Literal["quiet", "error", "warning", "timing", "info", "compat", "debug"]
5253
| bool = False,
5354
**kwargs,

pygmt/src/blockm.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
blockm - Block average (x, y, z) data tables by mean, median, or mode estimation.
33
"""
44

5+
from collections.abc import Sequence
56
from typing import Literal
67

78
import numpy as np
@@ -93,7 +94,7 @@ def blockmean(
9394
z=None,
9495
output_type: Literal["pandas", "numpy", "file"] = "pandas",
9596
outfile: PathLike | None = None,
96-
region=None,
97+
region: Sequence[float | str] | str | None = None,
9798
verbose: Literal["quiet", "error", "warning", "timing", "info", "compat", "debug"]
9899
| bool = False,
99100
**kwargs,
@@ -206,7 +207,7 @@ def blockmedian(
206207
z=None,
207208
output_type: Literal["pandas", "numpy", "file"] = "pandas",
208209
outfile: PathLike | None = None,
209-
region=None,
210+
region: Sequence[float | str] | str | None = None,
210211
verbose: Literal["quiet", "error", "warning", "timing", "info", "compat", "debug"]
211212
| bool = False,
212213
**kwargs,
@@ -313,7 +314,7 @@ def blockmode(
313314
z=None,
314315
output_type: Literal["pandas", "numpy", "file"] = "pandas",
315316
outfile: PathLike | None = None,
316-
region=None,
317+
region: Sequence[float | str] | str | None = None,
317318
verbose: Literal["quiet", "error", "warning", "timing", "info", "compat", "debug"]
318319
| bool = False,
319320
**kwargs,

pygmt/src/coast.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
coast - Plot continents, countries, shorelines, rivers, and borders.
33
"""
44

5+
from collections.abc import Sequence
56
from typing import Literal
67

78
from pygmt.alias import Alias, AliasSystem
@@ -41,7 +42,7 @@ def coast(
4142
"auto", "full", "high", "intermediate", "low", "crude", None
4243
] = None,
4344
box: Box | bool = False,
44-
region=None,
45+
region: Sequence[float | str] | str | None = None,
4546
verbose: Literal["quiet", "error", "warning", "timing", "info", "compat", "debug"]
4647
| bool = False,
4748
panel: int | tuple[int, int] | bool = False,

pygmt/src/colorbar.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
colorbar - Plot gray scale or color scale bar.
33
"""
44

5+
from collections.abc import Sequence
56
from typing import Literal
67

78
from pygmt.alias import Alias, AliasSystem
@@ -30,7 +31,7 @@ def colorbar(
3031
self,
3132
projection=None,
3233
box: Box | bool = False,
33-
region=None,
34+
region: Sequence[float | str] | str | None = None,
3435
verbose: Literal["quiet", "error", "warning", "timing", "info", "compat", "debug"]
3536
| bool = False,
3637
panel: int | tuple[int, int] | bool = False,

pygmt/src/contour.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
contour - Contour table data by direct triangulation.
33
"""
44

5+
from collections.abc import Sequence
56
from typing import Literal
67

78
from pygmt._typing import PathLike, TableLike
@@ -43,7 +44,7 @@ def contour(
4344
y=None,
4445
z=None,
4546
projection=None,
46-
region=None,
47+
region: Sequence[float | str] | str | None = None,
4748
verbose: Literal["quiet", "error", "warning", "timing", "info", "compat", "debug"]
4849
| bool = False,
4950
panel: int | tuple[int, int] | bool = False,

pygmt/src/dimfilter.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
dimfilter - Directional filtering of grids in the space domain.
33
"""
44

5+
from collections.abc import Sequence
56
from typing import Literal
67

78
import xarray as xr
@@ -20,7 +21,7 @@
2021
def dimfilter(
2122
grid: PathLike | xr.DataArray,
2223
outgrid: PathLike | None = None,
23-
region=None,
24+
region: Sequence[float | str] | str | None = None,
2425
verbose: Literal["quiet", "error", "warning", "timing", "info", "compat", "debug"]
2526
| bool = False,
2627
**kwargs,

pygmt/src/grd2cpt.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
grd2cpt - Make linear or histogram-equalized color palette table from grid.
33
"""
44

5+
from collections.abc import Sequence
56
from typing import Literal
67

78
import xarray as xr
@@ -36,7 +37,7 @@ def grd2cpt(
3637
no_bg: bool = False,
3738
log: bool = False,
3839
continuous: bool = False,
39-
region=None,
40+
region: Sequence[float | str] | str | None = None,
4041
verbose: Literal["quiet", "error", "warning", "timing", "info", "compat", "debug"]
4142
| bool = False,
4243
**kwargs,

pygmt/src/grd2xyz.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
grd2xyz - Convert grid to data table.
33
"""
44

5+
from collections.abc import Sequence
56
from typing import Literal
67

78
import numpy as np
@@ -39,7 +40,7 @@ def grd2xyz(
3940
grid: PathLike | xr.DataArray,
4041
output_type: Literal["pandas", "numpy", "file"] = "pandas",
4142
outfile: PathLike | None = None,
42-
region=None,
43+
region: Sequence[float | str] | str | None = None,
4344
verbose: Literal["quiet", "error", "warning", "timing", "info", "compat", "debug"]
4445
| bool = False,
4546
**kwargs,

pygmt/src/grdclip.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ def grdclip(
2929
below: Sequence[float] | None = None,
3030
between: Sequence[float] | Sequence[Sequence[float]] | None = None,
3131
replace: Sequence[float] | Sequence[Sequence[float]] | None = None,
32-
region=None,
32+
region: Sequence[float | str] | str | None = None,
3333
verbose: Literal["quiet", "error", "warning", "timing", "info", "compat", "debug"]
3434
| bool = False,
3535
**kwargs,

0 commit comments

Comments
 (0)