From 635ffa4af6d4ec5846a24ebf71671bd947a8b2b5 Mon Sep 17 00:00:00 2001 From: chuan Date: Wed, 4 Feb 2026 12:32:09 +0800 Subject: [PATCH 01/13] update text,project,decorators with "at_most_one" --- pygmt/helpers/decorators.py | 43 ++++++++++++++++--------------------- pygmt/src/project.py | 5 ++--- pygmt/src/text.py | 10 ++++----- pygmt/tests/test_project.py | 4 ++-- pygmt/tests/test_text.py | 7 +++--- 5 files changed, 30 insertions(+), 39 deletions(-) diff --git a/pygmt/helpers/decorators.py b/pygmt/helpers/decorators.py index 529e8047dd6..89fc6c7fd16 100644 --- a/pygmt/helpers/decorators.py +++ b/pygmt/helpers/decorators.py @@ -12,7 +12,7 @@ from inspect import Parameter, signature import numpy as np -from pygmt.exceptions import GMTInvalidInput, GMTValueError +from pygmt.exceptions import GMTParameterError, GMTValueError from pygmt.helpers.utils import is_nonstr_iter COMMON_DOCSTRINGS = { @@ -534,8 +534,8 @@ def use_alias(**aliases): >>> my_module(region="bla", projection="meh", J="bla") Traceback (most recent call last): ... - pygmt.exceptions.GMTInvalidInput: - Parameters in short-form (J) and long-form (projection) can't coexist. + pygmt.exceptions.GMTParameterError: + Mutually exclusive parameters: 'J', 'projection'. Specify at most one of them. """ def alias_decorator(module_func): @@ -550,11 +550,7 @@ def new_module(*args, **kwargs): """ for short_param, long_alias in aliases.items(): if long_alias in kwargs and short_param in kwargs: - msg = ( - f"Parameters in short-form ({short_param}) and " - f"long-form ({long_alias}) can't coexist." - ) - raise GMTInvalidInput(msg) + raise GMTParameterError(at_most_one={short_param, long_alias}) if long_alias in kwargs: kwargs[short_param] = kwargs.pop(long_alias) elif short_param in kwargs: @@ -566,27 +562,27 @@ def new_module(*args, **kwargs): # timestamp (U) is deprecated since v0.9.0 and removed in v0.12.0. if "U" in kwargs or "timestamp" in kwargs: - msg = ( - "Parameters 'U' and 'timestamp' are no longer supported since v0.12.0. " - "Use Figure.timestamp() instead." + raise GMTParameterError( + at_most_one={"U", "timestamp"}, + reason="Parameters 'U' and 'timestamp' are no longer supported since v0.12.0. " + "Use Figure.timestamp() instead.", ) - raise GMTInvalidInput(msg) # xshift (X) is deprecated since v0.8.0 and removed in v0.12.0. if "X" in kwargs or "xshift" in kwargs: - msg = ( - "Parameters 'X' and 'xshift' are no longer supported since v0.12.0. " - "Use Figure.shift_origin(xshift=...) instead." + raise GMTParameterError( + at_most_one={"X", "xshift"}, + reason="Parameters 'X' and 'xshift' are no longer supported since v0.12.0. " + "Use Figure.shift_origin(xshift=...) instead.", ) - raise GMTInvalidInput(msg) # yshift (Y) is deprecated since v0.8.0 and removed in v0.12.0. if "Y" in kwargs or "yshift" in kwargs: - msg = ( - "Parameters 'Y' and 'yshift' are no longer supported since v0.12.0. " - "Use Figure.shift_origin(yshift=...) instead." + raise GMTParameterError( + at_most_one={"Y", "yshift"}, + reason="Parameters 'Y' and 'yshift' are no longer supported since v0.12.0. " + "Use Figure.shift_origin(yshift=...) instead.", ) - raise GMTInvalidInput(msg) return module_func(*args, **kwargs) @@ -802,9 +798,9 @@ def deprecate_parameter(oldname, newname, deprecate_version, remove_version): ... assert issubclass(w[i].category, FutureWarning) ... assert "deprecated" in str(w[i].message) data=table.txt, size=5.0, color=red - >>> # using both old and new names will raise an GMTInvalidInput exception + >>> # using both old and new names will raise an GMTParameterError exception >>> import pytest - >>> with pytest.raises(GMTInvalidInput): + >>> with pytest.raises(GMTParameterError): ... module(data="table.txt", size=5.0, sizes=4.0) """ @@ -821,8 +817,7 @@ def new_module(*args, **kwargs): """ if oldname in kwargs: if newname in kwargs: - msg = f"Can't provide both '{newname}' and '{oldname}'." - raise GMTInvalidInput(msg) + raise GMTParameterError(at_most_one={newname, oldname}) msg = ( f"The '{oldname}' parameter has been deprecated since {deprecate_version}" f" and will be removed in {remove_version}." diff --git a/pygmt/src/project.py b/pygmt/src/project.py index 2dc069b644a..8f1be185843 100644 --- a/pygmt/src/project.py +++ b/pygmt/src/project.py @@ -10,7 +10,7 @@ from pygmt._typing import PathLike, TableLike from pygmt.alias import Alias, AliasSystem from pygmt.clib import Session -from pygmt.exceptions import GMTInvalidInput, GMTParameterError +from pygmt.exceptions import GMTParameterError from pygmt.helpers import ( build_arg_list, fmt_docstring, @@ -227,8 +227,7 @@ def project( # noqa: PLR0913 required="data", reason="Required unless 'generate' is set." ) if kwargs.get("G") is not None and kwargs.get("F") is not None: - msg = "The 'convention' parameter is not allowed with 'generate'." - raise GMTInvalidInput(msg) + raise GMTParameterError(at_most_one={"convention", "generate"}) output_type = validate_output_table_type(output_type, outfile=outfile) diff --git a/pygmt/src/text.py b/pygmt/src/text.py index 7f3f2b2b9c8..58a3469b644 100644 --- a/pygmt/src/text.py +++ b/pygmt/src/text.py @@ -9,7 +9,7 @@ from pygmt._typing import AnchorCode, PathLike, StringArrayTypes, TableLike from pygmt.alias import Alias, AliasSystem from pygmt.clib import Session -from pygmt.exceptions import GMTInvalidInput, GMTParameterError, GMTTypeError +from pygmt.exceptions import GMTParameterError, GMTTypeError from pygmt.helpers import ( _check_encoding, build_arg_list, @@ -34,7 +34,7 @@ it="use_word", w="wrap", ) -def text_( # noqa: PLR0912, PLR0913, PLR0915 +def text_( # noqa: PLR0912, PLR0913 self, textfiles: PathLike | TableLike | None = None, x=None, @@ -191,8 +191,7 @@ def text_( # noqa: PLR0912, PLR0913, PLR0915 + (position is not None) + (x is not None or y is not None) ) != 1: - msg = "Provide either 'textfiles', 'x'/'y'/'text', or 'position'/'text'." - raise GMTInvalidInput(msg) + raise GMTParameterError(at_most_one={"textfiles", "position", "x/y"}) data_is_required = position is None kind = data_kind(textfiles, required=data_is_required) @@ -209,8 +208,7 @@ def text_( # noqa: PLR0912, PLR0913, PLR0915 ) if textfiles is not None and text is not None: - msg = "'text' can't be specified when 'textfiles' is given." - raise GMTInvalidInput(msg) + raise GMTParameterError(at_most_one={"text", "textfiles"}) if kind == "empty" and text is None: raise GMTParameterError( required="text", reason="Required when 'x' and 'y' are set." diff --git a/pygmt/tests/test_project.py b/pygmt/tests/test_project.py index cdf71a236f5..f6580aa6fa5 100644 --- a/pygmt/tests/test_project.py +++ b/pygmt/tests/test_project.py @@ -10,7 +10,7 @@ import pytest import xarray as xr from pygmt import project -from pygmt.exceptions import GMTInvalidInput, GMTParameterError +from pygmt.exceptions import GMTParameterError from pygmt.helpers import GMTTempFile @@ -87,6 +87,6 @@ def test_project_incorrect_parameters(): with pytest.raises(GMTParameterError): # No `data` or `generate` project(center=[0, -1], azimuth=45, flat_earth=True) - with pytest.raises(GMTInvalidInput): + with pytest.raises(GMTParameterError): # Using `generate` with `convention` project(center=[0, -1], generate=0.5, convention="xypqrsz") diff --git a/pygmt/tests/test_text.py b/pygmt/tests/test_text.py index a3fcdf05b0f..0364eb1b4aa 100644 --- a/pygmt/tests/test_text.py +++ b/pygmt/tests/test_text.py @@ -9,7 +9,6 @@ from pygmt import Figure, config from pygmt.exceptions import ( GMTCLibError, - GMTInvalidInput, GMTParameterError, GMTTypeError, ) @@ -151,11 +150,11 @@ def test_text_invalid_inputs(region): Run text by providing invalid combinations of inputs. """ fig = Figure() - with pytest.raises(GMTInvalidInput): + with pytest.raises(GMTParameterError): fig.text( region=region, projection="x1c", x=1.2, y=2.4, position="MC", text="text" ) - with pytest.raises(GMTInvalidInput): + with pytest.raises(GMTParameterError): fig.text(region=region, projection="x1c", textfiles="file.txt", text="text") with pytest.raises(GMTParameterError): fig.text(region=region, projection="x1c", position="MC", text=None) @@ -163,7 +162,7 @@ def test_text_invalid_inputs(region): fig.text( region=region, projection="x1c", position="MC", text=["text1", "text2"] ) - with pytest.raises(GMTInvalidInput): + with pytest.raises(GMTParameterError): fig.text(region=region, projection="x1c", textfiles="file.txt", x=1.2, y=2.4) From 267c76b9d6d7d0662a6aca1cfe17efaaaf80002d Mon Sep 17 00:00:00 2001 From: chuan Date: Wed, 4 Feb 2026 12:43:44 +0800 Subject: [PATCH 02/13] update test file --- pygmt/tests/test_shift_origin.py | 10 +++++----- pygmt/tests/test_timestamp.py | 6 +++--- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/pygmt/tests/test_shift_origin.py b/pygmt/tests/test_shift_origin.py index 45b329fcfd2..956f82a6f70 100644 --- a/pygmt/tests/test_shift_origin.py +++ b/pygmt/tests/test_shift_origin.py @@ -4,7 +4,7 @@ import pytest from pygmt import Figure -from pygmt.exceptions import GMTInvalidInput +from pygmt.exceptions import GMTParameterError def _numbered_basemap(fig, number, size=3): @@ -104,11 +104,11 @@ def test_shift_origin_unsupported_xshift_yshift(): """ fig = Figure() fig.basemap(region=[0, 1, 0, 1], projection="X1c/1c", frame=True) - with pytest.raises(GMTInvalidInput): + with pytest.raises(GMTParameterError): fig.plot(x=1, y=1, style="c3c", xshift="3c") - with pytest.raises(GMTInvalidInput): + with pytest.raises(GMTParameterError): fig.plot(x=1, y=1, style="c3c", X="3c") - with pytest.raises(GMTInvalidInput): + with pytest.raises(GMTParameterError): fig.plot(x=1, y=1, style="c3c", yshift="3c") - with pytest.raises(GMTInvalidInput): + with pytest.raises(GMTParameterError): fig.plot(x=1, y=1, style="c3c", Y="3c") diff --git a/pygmt/tests/test_timestamp.py b/pygmt/tests/test_timestamp.py index d89a06c6c03..dec33041b4a 100644 --- a/pygmt/tests/test_timestamp.py +++ b/pygmt/tests/test_timestamp.py @@ -4,7 +4,7 @@ import pytest from pygmt import Figure -from pygmt.exceptions import GMTInvalidInput +from pygmt.exceptions import GMTParameterError @pytest.fixture(scope="module", name="faketime") @@ -104,9 +104,9 @@ def test_timestamp_unsupported_u_timestamp(): Parameters U and timestamp are no longer supported since v0.12.0. """ fig = Figure() - with pytest.raises(GMTInvalidInput): + with pytest.raises(GMTParameterError): fig.plot(x=0, y=0, style="p", projection="X1c", region=[1, 2, 1, 2], U=True) - with pytest.raises(GMTInvalidInput): + with pytest.raises(GMTParameterError): fig.plot( x=0, y=0, style="p", projection="X1c", region=[1, 2, 1, 2], timestamp=True ) From 5e1ecadb870992199c3e9e6c846b4e4cf1cb5207 Mon Sep 17 00:00:00 2001 From: Xingchen He Date: Wed, 4 Feb 2026 12:57:57 +0800 Subject: [PATCH 03/13] Update pygmt/src/text.py Co-authored-by: Dongdong Tian --- pygmt/src/text.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pygmt/src/text.py b/pygmt/src/text.py index 58a3469b644..3db86139266 100644 --- a/pygmt/src/text.py +++ b/pygmt/src/text.py @@ -191,7 +191,7 @@ def text_( # noqa: PLR0912, PLR0913 + (position is not None) + (x is not None or y is not None) ) != 1: - raise GMTParameterError(at_most_one={"textfiles", "position", "x/y"}) + raise GMTParameterError(at_most_one={"textfiles", "position/text", "x/y/text"}) data_is_required = position is None kind = data_kind(textfiles, required=data_is_required) From 30261727964c77b1ca9c32cb9deb1b3695063f1e Mon Sep 17 00:00:00 2001 From: Xingchen He Date: Wed, 4 Feb 2026 12:58:07 +0800 Subject: [PATCH 04/13] Update pygmt/helpers/decorators.py Co-authored-by: Dongdong Tian --- pygmt/helpers/decorators.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/pygmt/helpers/decorators.py b/pygmt/helpers/decorators.py index 89fc6c7fd16..06931605124 100644 --- a/pygmt/helpers/decorators.py +++ b/pygmt/helpers/decorators.py @@ -817,7 +817,10 @@ def new_module(*args, **kwargs): """ if oldname in kwargs: if newname in kwargs: - raise GMTParameterError(at_most_one={newname, oldname}) + raise GMTParameterError( + at_most_one={newname, oldname}, + reason="{oldname!r} is deprecated and {newname!r} is recommended.", + ) msg = ( f"The '{oldname}' parameter has been deprecated since {deprecate_version}" f" and will be removed in {remove_version}." From 20e3366d0996406eccc328cb09c57fa04285d47f Mon Sep 17 00:00:00 2001 From: chuan Date: Wed, 4 Feb 2026 12:58:58 +0800 Subject: [PATCH 05/13] update test file for text --- pygmt/tests/test_text.py | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/pygmt/tests/test_text.py b/pygmt/tests/test_text.py index 0364eb1b4aa..b05ac8a42ac 100644 --- a/pygmt/tests/test_text.py +++ b/pygmt/tests/test_text.py @@ -7,11 +7,7 @@ import numpy as np import pytest from pygmt import Figure, config -from pygmt.exceptions import ( - GMTCLibError, - GMTParameterError, - GMTTypeError, -) +from pygmt.exceptions import GMTCLibError,GMTParameterError,GMTTypeError from pygmt.helpers import GMTTempFile from pygmt.helpers.testing import skip_if_no From 893c3d46b8842956c58de169df92473b6a197c8c Mon Sep 17 00:00:00 2001 From: chuan Date: Wed, 4 Feb 2026 13:01:03 +0800 Subject: [PATCH 06/13] fix check --- pygmt/helpers/decorators.py | 4 ++-- pygmt/tests/test_text.py | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/pygmt/helpers/decorators.py b/pygmt/helpers/decorators.py index 06931605124..360f90c412e 100644 --- a/pygmt/helpers/decorators.py +++ b/pygmt/helpers/decorators.py @@ -818,8 +818,8 @@ def new_module(*args, **kwargs): if oldname in kwargs: if newname in kwargs: raise GMTParameterError( - at_most_one={newname, oldname}, - reason="{oldname!r} is deprecated and {newname!r} is recommended.", + at_most_one={newname, oldname}, + reason=f"{oldname!r} is deprecated and {newname!r} is recommended.", ) msg = ( f"The '{oldname}' parameter has been deprecated since {deprecate_version}" diff --git a/pygmt/tests/test_text.py b/pygmt/tests/test_text.py index b05ac8a42ac..d871b223f22 100644 --- a/pygmt/tests/test_text.py +++ b/pygmt/tests/test_text.py @@ -7,7 +7,7 @@ import numpy as np import pytest from pygmt import Figure, config -from pygmt.exceptions import GMTCLibError,GMTParameterError,GMTTypeError +from pygmt.exceptions import GMTCLibError, GMTParameterError, GMTTypeError from pygmt.helpers import GMTTempFile from pygmt.helpers.testing import skip_if_no From 1663a024334a945fef1bdf4d3fc1478ba9a10d15 Mon Sep 17 00:00:00 2001 From: chuan Date: Wed, 4 Feb 2026 13:12:04 +0800 Subject: [PATCH 07/13] revert decorators and test file --- pygmt/helpers/decorators.py | 26 +++++++++++++------------- pygmt/tests/test_shift_origin.py | 10 +++++----- pygmt/tests/test_timestamp.py | 6 +++--- 3 files changed, 21 insertions(+), 21 deletions(-) diff --git a/pygmt/helpers/decorators.py b/pygmt/helpers/decorators.py index 360f90c412e..3255a2b5061 100644 --- a/pygmt/helpers/decorators.py +++ b/pygmt/helpers/decorators.py @@ -12,7 +12,7 @@ from inspect import Parameter, signature import numpy as np -from pygmt.exceptions import GMTParameterError, GMTValueError +from pygmt.exceptions import GMTInvalidInput, GMTParameterError, GMTValueError from pygmt.helpers.utils import is_nonstr_iter COMMON_DOCSTRINGS = { @@ -562,27 +562,27 @@ def new_module(*args, **kwargs): # timestamp (U) is deprecated since v0.9.0 and removed in v0.12.0. if "U" in kwargs or "timestamp" in kwargs: - raise GMTParameterError( - at_most_one={"U", "timestamp"}, - reason="Parameters 'U' and 'timestamp' are no longer supported since v0.12.0. " - "Use Figure.timestamp() instead.", + msg = ( + "Parameters 'U' and 'timestamp' are no longer supported since v0.12.0. " + "Use Figure.timestamp() instead." ) + raise GMTInvalidInput(msg) # xshift (X) is deprecated since v0.8.0 and removed in v0.12.0. if "X" in kwargs or "xshift" in kwargs: - raise GMTParameterError( - at_most_one={"X", "xshift"}, - reason="Parameters 'X' and 'xshift' are no longer supported since v0.12.0. " - "Use Figure.shift_origin(xshift=...) instead.", + msg = ( + "Parameters 'X' and 'xshift' are no longer supported since v0.12.0. " + "Use Figure.shift_origin(xshift=...) instead." ) + raise GMTInvalidInput(msg) # yshift (Y) is deprecated since v0.8.0 and removed in v0.12.0. if "Y" in kwargs or "yshift" in kwargs: - raise GMTParameterError( - at_most_one={"Y", "yshift"}, - reason="Parameters 'Y' and 'yshift' are no longer supported since v0.12.0. " - "Use Figure.shift_origin(yshift=...) instead.", + msg = ( + "Parameters 'Y' and 'yshift' are no longer supported since v0.12.0. " + "Use Figure.shift_origin(yshift=...) instead." ) + raise GMTInvalidInput(msg) return module_func(*args, **kwargs) diff --git a/pygmt/tests/test_shift_origin.py b/pygmt/tests/test_shift_origin.py index 956f82a6f70..45b329fcfd2 100644 --- a/pygmt/tests/test_shift_origin.py +++ b/pygmt/tests/test_shift_origin.py @@ -4,7 +4,7 @@ import pytest from pygmt import Figure -from pygmt.exceptions import GMTParameterError +from pygmt.exceptions import GMTInvalidInput def _numbered_basemap(fig, number, size=3): @@ -104,11 +104,11 @@ def test_shift_origin_unsupported_xshift_yshift(): """ fig = Figure() fig.basemap(region=[0, 1, 0, 1], projection="X1c/1c", frame=True) - with pytest.raises(GMTParameterError): + with pytest.raises(GMTInvalidInput): fig.plot(x=1, y=1, style="c3c", xshift="3c") - with pytest.raises(GMTParameterError): + with pytest.raises(GMTInvalidInput): fig.plot(x=1, y=1, style="c3c", X="3c") - with pytest.raises(GMTParameterError): + with pytest.raises(GMTInvalidInput): fig.plot(x=1, y=1, style="c3c", yshift="3c") - with pytest.raises(GMTParameterError): + with pytest.raises(GMTInvalidInput): fig.plot(x=1, y=1, style="c3c", Y="3c") diff --git a/pygmt/tests/test_timestamp.py b/pygmt/tests/test_timestamp.py index dec33041b4a..d89a06c6c03 100644 --- a/pygmt/tests/test_timestamp.py +++ b/pygmt/tests/test_timestamp.py @@ -4,7 +4,7 @@ import pytest from pygmt import Figure -from pygmt.exceptions import GMTParameterError +from pygmt.exceptions import GMTInvalidInput @pytest.fixture(scope="module", name="faketime") @@ -104,9 +104,9 @@ def test_timestamp_unsupported_u_timestamp(): Parameters U and timestamp are no longer supported since v0.12.0. """ fig = Figure() - with pytest.raises(GMTParameterError): + with pytest.raises(GMTInvalidInput): fig.plot(x=0, y=0, style="p", projection="X1c", region=[1, 2, 1, 2], U=True) - with pytest.raises(GMTParameterError): + with pytest.raises(GMTInvalidInput): fig.plot( x=0, y=0, style="p", projection="X1c", region=[1, 2, 1, 2], timestamp=True ) From a0391649bbb1f2a7ecbb15de6e53b32593aad542 Mon Sep 17 00:00:00 2001 From: Xingchen He Date: Wed, 4 Feb 2026 13:28:26 +0800 Subject: [PATCH 08/13] Update pygmt/helpers/decorators.py Co-authored-by: Dongdong Tian --- pygmt/helpers/decorators.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/pygmt/helpers/decorators.py b/pygmt/helpers/decorators.py index 3255a2b5061..3ac2ed5843f 100644 --- a/pygmt/helpers/decorators.py +++ b/pygmt/helpers/decorators.py @@ -550,7 +550,10 @@ def new_module(*args, **kwargs): """ for short_param, long_alias in aliases.items(): if long_alias in kwargs and short_param in kwargs: - raise GMTParameterError(at_most_one={short_param, long_alias}) + raise GMTParameterError( + at_most_one={long_alias, short_param}, + reason="Long-form parameter {long_alias!r} is recommended." + ) if long_alias in kwargs: kwargs[short_param] = kwargs.pop(long_alias) elif short_param in kwargs: From 615e294c3933a6311c30fd9f5971f03c4402e5ed Mon Sep 17 00:00:00 2001 From: Xingchen He Date: Wed, 4 Feb 2026 14:25:39 +0800 Subject: [PATCH 09/13] Update pygmt/helpers/decorators.py Co-authored-by: Dongdong Tian --- pygmt/helpers/decorators.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pygmt/helpers/decorators.py b/pygmt/helpers/decorators.py index 3ac2ed5843f..96f4bb3aa7f 100644 --- a/pygmt/helpers/decorators.py +++ b/pygmt/helpers/decorators.py @@ -552,7 +552,7 @@ def new_module(*args, **kwargs): if long_alias in kwargs and short_param in kwargs: raise GMTParameterError( at_most_one={long_alias, short_param}, - reason="Long-form parameter {long_alias!r} is recommended." + reason=f"Long-form parameter {long_alias!r} is recommended." ) if long_alias in kwargs: kwargs[short_param] = kwargs.pop(long_alias) From 8457e90e7251af02582c6ee9365c6457d99407bc Mon Sep 17 00:00:00 2001 From: Xingchen He Date: Wed, 4 Feb 2026 14:25:46 +0800 Subject: [PATCH 10/13] Update pygmt/helpers/decorators.py Co-authored-by: Dongdong Tian --- pygmt/helpers/decorators.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pygmt/helpers/decorators.py b/pygmt/helpers/decorators.py index 96f4bb3aa7f..de9fbec42b5 100644 --- a/pygmt/helpers/decorators.py +++ b/pygmt/helpers/decorators.py @@ -535,7 +535,7 @@ def use_alias(**aliases): Traceback (most recent call last): ... pygmt.exceptions.GMTParameterError: - Mutually exclusive parameters: 'J', 'projection'. Specify at most one of them. + Mutually exclusive parameters: 'J', 'projection'. Specify at most one of them.... """ def alias_decorator(module_func): From 66efa54b2cfce4304658daf93c05c91804c92de5 Mon Sep 17 00:00:00 2001 From: chuan Date: Wed, 4 Feb 2026 14:27:31 +0800 Subject: [PATCH 11/13] fix check --- pygmt/helpers/decorators.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/pygmt/helpers/decorators.py b/pygmt/helpers/decorators.py index de9fbec42b5..8a9abec4a72 100644 --- a/pygmt/helpers/decorators.py +++ b/pygmt/helpers/decorators.py @@ -535,7 +535,8 @@ def use_alias(**aliases): Traceback (most recent call last): ... pygmt.exceptions.GMTParameterError: - Mutually exclusive parameters: 'J', 'projection'. Specify at most one of them.... + Mutually exclusive parameters: 'J', 'projection'. Specify at most one + of them.... """ def alias_decorator(module_func): @@ -552,7 +553,7 @@ def new_module(*args, **kwargs): if long_alias in kwargs and short_param in kwargs: raise GMTParameterError( at_most_one={long_alias, short_param}, - reason=f"Long-form parameter {long_alias!r} is recommended." + reason=f"Long-form parameter {long_alias!r} is recommended.", ) if long_alias in kwargs: kwargs[short_param] = kwargs.pop(long_alias) From 0daee256836eebc6ed48f1b136cefb61cc83343d Mon Sep 17 00:00:00 2001 From: Xingchen He Date: Wed, 4 Feb 2026 16:18:38 +0800 Subject: [PATCH 12/13] Update pygmt/helpers/decorators.py Co-authored-by: Dongdong Tian --- pygmt/helpers/decorators.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/pygmt/helpers/decorators.py b/pygmt/helpers/decorators.py index 8a9abec4a72..5317a8139aa 100644 --- a/pygmt/helpers/decorators.py +++ b/pygmt/helpers/decorators.py @@ -535,8 +535,7 @@ def use_alias(**aliases): Traceback (most recent call last): ... pygmt.exceptions.GMTParameterError: - Mutually exclusive parameters: 'J', 'projection'. Specify at most one - of them.... + Mutually exclusive parameters: 'J', 'projection'. Specify at most... """ def alias_decorator(module_func): From d8de0b333b8adf70eabe61e3189c688bdff47cbe Mon Sep 17 00:00:00 2001 From: Dongdong Tian Date: Wed, 4 Feb 2026 16:36:51 +0800 Subject: [PATCH 13/13] Update pygmt/helpers/decorators.py --- pygmt/helpers/decorators.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/pygmt/helpers/decorators.py b/pygmt/helpers/decorators.py index 5317a8139aa..94917a5fa61 100644 --- a/pygmt/helpers/decorators.py +++ b/pygmt/helpers/decorators.py @@ -534,8 +534,7 @@ def use_alias(**aliases): >>> my_module(region="bla", projection="meh", J="bla") Traceback (most recent call last): ... - pygmt.exceptions.GMTParameterError: - Mutually exclusive parameters: 'J', 'projection'. Specify at most... + pygmt.exceptions.GMTParameterError: Mutually exclusive parameters: ... """ def alias_decorator(module_func):