Skip to content

Commit ab69392

Browse files
committed
pygmt.config: Support autocompletion of all parameters
1 parent 3e33467 commit ab69392

1 file changed

Lines changed: 11 additions & 0 deletions

File tree

pygmt/src/config.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
"""
22
config - set GMT defaults globally or locally.
33
"""
4+
from inspect import Parameter, Signature
5+
46
from pygmt.clib import Session
57

68

@@ -20,6 +22,15 @@ class config: # pylint: disable=invalid-name
2022
Full GMT defaults list at :gmt-docs:`gmt.conf.html`
2123
"""
2224

25+
# Manually set the __signature__ attribute to enable tab autocompletion
26+
_keywords = ["FONT_LABEL", "FONT_TAG", "FONT_TITLE"]
27+
__signature__ = Signature(
28+
parameters=[
29+
Parameter(key, kind=Parameter.KEYWORD_ONLY, default=None)
30+
for key in _keywords
31+
]
32+
)
33+
2334
def __init__(self, **kwargs):
2435
# Save values so that we can revert to their initial values
2536
self.old_defaults = {}

0 commit comments

Comments
 (0)