Skip to content

Commit d5864f1

Browse files
authored
Remove the support of non-aliased aliases in use_alias/fmt_docstrings (#4042)
1 parent e9b4e5e commit d5864f1

File tree

3 files changed

+3
-33
lines changed

3 files changed

+3
-33
lines changed

pygmt/helpers/decorators.py

Lines changed: 1 addition & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -450,9 +450,7 @@ def fmt_docstring(module_func):
450450
aliases.append(" :columns: 3\n")
451451
for arg in sorted(module_func.aliases):
452452
alias = module_func.aliases[arg]
453-
# Trailing dash means it's not aliased but should be listed.
454-
# Remove the trailing dash if it exists.
455-
aliases.append(f" - {arg} = {alias.rstrip('-')}")
453+
aliases.append(f" - {arg} = {alias}")
456454
filler_text["aliases"] = "\n".join(aliases)
457455

458456
filler_text["table-classes"] = (
@@ -486,9 +484,6 @@ def _insert_alias(module_func, default_value=None):
486484
kwargs_param = wrapped_params.pop(-1)
487485
# Add new parameters from aliases
488486
for alias in module_func.aliases.values():
489-
if alias.endswith("-"):
490-
# Trailing dash means it's not aliased but should be listed.
491-
continue
492487
if alias not in sig.parameters:
493488
new_param = Parameter(
494489
alias, kind=Parameter.KEYWORD_ONLY, default=default_value
@@ -553,31 +548,6 @@ def new_module(*args, **kwargs):
553548
New module that parses and replaces the registered aliases.
554549
"""
555550
for short_param, long_alias in aliases.items():
556-
if long_alias.endswith("-"):
557-
_long_alias = long_alias.rstrip("-")
558-
# Trailing dash means it's not aliased but should be listed.
559-
_alias_list = _long_alias.split("/")
560-
if (
561-
any(_alias in kwargs for _alias in _alias_list)
562-
and short_param in kwargs
563-
): # Both long- and short- forms are given.
564-
msg = (
565-
f"Parameters in short-form ({short_param}) and "
566-
f"long-form ({_long_alias}) can't coexist."
567-
)
568-
raise GMTInvalidInput(msg)
569-
if short_param in kwargs: # Only short-alias is given
570-
if len(_alias_list) > 1: # Aliased to multiple long-forms
571-
msg = (
572-
f"Short-form parameter ({short_param}) is not "
573-
f"recognized. Use long-form parameter(s) "
574-
f"'{_long_alias}' instead."
575-
)
576-
raise GMTInvalidInput(msg)
577-
# If there is only one long-form parameter, use it.
578-
kwargs[_long_alias] = kwargs.pop(short_param)
579-
continue
580-
581551
if long_alias in kwargs and short_param in kwargs:
582552
msg = (
583553
f"Parameters in short-form ({short_param}) and "

pygmt/src/meca.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,6 @@ def _auto_offset(spec) -> bool:
126126
L="outline",
127127
N="no_clip",
128128
R="region",
129-
S="scale/convention/component-",
130129
T="nodal",
131130
V="verbose",
132131
W="pen",
@@ -203,6 +202,7 @@ def meca( # noqa: PLR0913
203202
204203
{aliases}
205204
- J = projection
205+
- S = scale/convention/component
206206
207207
Parameters
208208
----------

pygmt/src/text.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@
2727
B="frame",
2828
C="clearance",
2929
D="offset",
30-
F="position/angle/font/justify-",
3130
G="fill",
3231
N="no_clip",
3332
V="verbose",
@@ -73,6 +72,7 @@ def text_( # noqa: PLR0912
7372
Full GMT docs at :gmt-docs:`text.html`.
7473
7574
{aliases}
75+
- F = **+a**: angle, **+c**: position, **+j**: justify, **+f**: font
7676
- J = projection
7777
7878
Parameters

0 commit comments

Comments
 (0)