Skip to content

BREAKING: Raise GMTParameterError exception for as_most_one parameters. Previously raise GMTInvalidInput - #4383

Merged
seisman merged 14 commits into
GenericMappingTools:mainfrom
Chuan1937:feature/exactly_one_parameter
Feb 4, 2026
Merged

BREAKING: Raise GMTParameterError exception for as_most_one parameters. Previously raise GMTInvalidInput#4383
seisman merged 14 commits into
GenericMappingTools:mainfrom
Chuan1937:feature/exactly_one_parameter

Conversation

@Chuan1937

@Chuan1937Chuan1937 commented Feb 3, 2026

Copy link
Copy Markdown
Member

Add GMTParameterError: at_most_one

@seisman
This is the third PR of #4003

Error typesPreferred Parameter NameAlternative Parameter NamesError Message Template
Requiredrequiredmust_have, neededMissing required parameter: '{param}'
Missing required parameters: '{a}', '{b}'
At least one is requiredat_least_oneneed_one_of, , , any_of``one_of``required_anyMissing required parameters: '{a}', '{b}', '{c}'. Must specify at least one.
Must specify at least one of the parameters: '{a}', '{b}', '{c}'
Exactly one is requiredexactly_onemutually_exclusiveMutually exclusive parameters: '{a}', '{b}', '{c}'. Specify exactly one.
At most oneat_most_onemutually_exclusiveMutually exclusive parameters: '{a}', '{b}', '{c}'. Specify at most one
Conflictingconflicts_withconflicts, incompatible_withConflicting parameters: '{a}' cannot be used with '{b}', '{c}'

Comment threadpygmt/src/grdproject.py Outdated
Comment threadpygmt/src/grdfill.py Outdated
Comment threadpygmt/exceptions.py
Xingchen Heand others added 2 commits February 3, 2026 12:49
Co-authored-by: Dongdong Tian <seisman.info@gmail.com>
@seisman

Copy link
Copy Markdown
Member

Please also update subplot.py/makecpt.py/grd2cpt.py

Comment threadpygmt/src/grdfill.py Outdated
@seismanseisman added the maintenance Boring but important stuff for the core devs label Feb 3, 2026
@seismanseisman added this to the 0.19.0 milestone Feb 3, 2026
Xingchen Heand others added 2 commits February 3, 2026 13:31
Co-authored-by: Dongdong Tian <seisman.info@gmail.com>
Comment threadpygmt/tests/test_grd2cpt.py Outdated
Comment threadpygmt/tests/test_makecpt.py Outdated
Comment threadpygmt/tests/test_subplot.py Outdated
Comment threadpygmt/src/grdfill.py Outdated
@seismanseisman changed the title BREAKING: Raise GMTParameterError exception for exactly_one parameters. Previously raise GMTInvalidInputBREAKING: Raise GMTParameterError exception for as_most_one parameters. Previously raise GMTInvalidInputFeb 3, 2026
Xingchen Heand others added 4 commits February 3, 2026 19:57
Co-authored-by: Dongdong Tian <seisman.info@gmail.com>
Co-authored-by: Dongdong Tian <seisman.info@gmail.com>
Co-authored-by: Dongdong Tian <seisman.info@gmail.com>
Co-authored-by: Dongdong Tian <seisman.info@gmail.com>
@seisman

Copy link
Copy Markdown
Member

I feel plot.py, plot3d.py, text.py (line 195) should also be updated in this PR.

Comment threadpygmt/src/text.py Outdated
@seisman

Copy link
Copy Markdown
Member

Hmmm, I meant to revert the changes for line 210 in text.py but keep changes in plot.py and plot3d.py.

Comment threadpygmt/src/plot.py Outdated
Comment threadpygmt/src/plot3d.py Outdated
Xingchen Heand others added 2 commits February 4, 2026 10:50
Co-authored-by: Dongdong Tian <seisman.info@gmail.com>
Co-authored-by: Dongdong Tian <seisman.info@gmail.com>
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

maintenanceBoring but important stuff for the core devs

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

@Chuan1937@seisman