Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 1 addition & 31 deletions pygmt/helpers/decorators.py
Original file line number Diff line number Diff line change
Expand Up @@ -450,9 +450,7 @@ def fmt_docstring(module_func):
aliases.append(" :columns: 3\n")
for arg in sorted(module_func.aliases):
alias = module_func.aliases[arg]
# Trailing dash means it's not aliased but should be listed.
# Remove the trailing dash if it exists.
aliases.append(f" - {arg} = {alias.rstrip('-')}")
aliases.append(f" - {arg} = {alias}")
filler_text["aliases"] = "\n".join(aliases)

filler_text["table-classes"] = (
Expand Down Expand Up @@ -486,9 +484,6 @@ def _insert_alias(module_func, default_value=None):
kwargs_param = wrapped_params.pop(-1)
# Add new parameters from aliases
for alias in module_func.aliases.values():
if alias.endswith("-"):
# Trailing dash means it's not aliased but should be listed.
continue
if alias not in sig.parameters:
new_param = Parameter(
alias, kind=Parameter.KEYWORD_ONLY, default=default_value
Expand Down Expand Up @@ -553,31 +548,6 @@ def new_module(*args, **kwargs):
New module that parses and replaces the registered aliases.
"""
for short_param, long_alias in aliases.items():
if long_alias.endswith("-"):
_long_alias = long_alias.rstrip("-")
# Trailing dash means it's not aliased but should be listed.
_alias_list = _long_alias.split("/")
if (
any(_alias in kwargs for _alias in _alias_list)
and short_param in kwargs
): # Both long- and short- forms are given.
msg = (
f"Parameters in short-form ({short_param}) and "
f"long-form ({_long_alias}) can't coexist."
)
raise GMTInvalidInput(msg)
if short_param in kwargs: # Only short-alias is given
if len(_alias_list) > 1: # Aliased to multiple long-forms
msg = (
f"Short-form parameter ({short_param}) is not "
f"recognized. Use long-form parameter(s) "
f"'{_long_alias}' instead."
)
raise GMTInvalidInput(msg)
# If there is only one long-form parameter, use it.
kwargs[_long_alias] = kwargs.pop(short_param)
continue

if long_alias in kwargs and short_param in kwargs:
msg = (
f"Parameters in short-form ({short_param}) and "
Expand Down
2 changes: 1 addition & 1 deletion pygmt/src/meca.py
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,6 @@ def _auto_offset(spec) -> bool:
L="outline",
N="no_clip",
R="region",
S="scale/convention/component-",
T="nodal",
V="verbose",
W="pen",
Expand Down Expand Up @@ -203,6 +202,7 @@ def meca( # noqa: PLR0913

{aliases}
- J = projection
- S = scale/convention/component

Parameters
----------
Expand Down
2 changes: 1 addition & 1 deletion pygmt/src/text.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@
B="frame",
C="clearance",
D="offset",
F="position/angle/font/justify-",
G="fill",
N="no_clip",
V="verbose",
Expand Down Expand Up @@ -73,6 +72,7 @@ def text_( # noqa: PLR0912
Full GMT docs at :gmt-docs:`text.html`.

{aliases}
- F = **+a**: angle, **+c**: position, **+j**: justify, **+f**: font
- J = projection

Parameters
Expand Down
Loading