Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support tab completion in Jupyter by inserting aliases into the method signature #1282

Merged
merged 14 commits into from
Jun 16, 2021
Merged
Prev Previous commit
Next Next commit
Make inserted alias parameters KEYWORD_ONLY
  • Loading branch information
maxrjones committed May 23, 2021
commit f37faeaf519e7cbc6be9a5f5cd6b5086b1c1f500
4 changes: 2 additions & 2 deletions pygmt/helpers/decorators.py
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,7 @@ def fmt_docstring(module_func):
return module_func


def insert_alias(module_func):
def insert_alias(module_func, default_value=None):
"""
Decorator insertings aliases into the signature of a method.
"""
Expand All @@ -275,7 +275,7 @@ def insert_alias(module_func):
for alias in module_func.aliases.values():
if alias not in sig.parameters.keys():
new_param = Parameter(
alias, kind=Parameter.POSITIONAL_OR_KEYWORD, default=None
alias, kind=Parameter.KEYWORD_ONLY, default=default_value
)
wrapped_params = wrapped_params + [new_param]
all_params = wrapped_params + [kwargs_param]
Expand Down