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

Add type hints for GMT anchor codes #3459

Merged
merged 4 commits into from
Oct 11, 2024
Merged

Add type hints for GMT anchor codes #3459

merged 4 commits into from
Oct 11, 2024

Conversation

seisman
Copy link
Member

@seisman seisman commented Sep 27, 2024

Description of proposed changes

This PR adds typing hints for the GMT anchor codes like TL/TR.

The new module pygmt._typing is inspired by https://github.com/numpy/numpy/tree/main/numpy/_typing and https://github.com/pandas-dev/pandas/blob/main/pandas/_typing.py.

In GMT, the order of horizontal and vertical alignments doesn't matter, so both TL and LT are accepted, but here only codes like TL are added to avoid making the function signature to long.

@seisman seisman marked this pull request as draft September 27, 2024 05:26
@@ -90,7 +93,7 @@ def text_( # noqa: PLR0912
x/y : float or 1-D arrays
The x and y coordinates, or an array of x and y coordinates to plot
the text.
position : str
position
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Small nit, could you reverse the order of L102 and L103 below, so that Vertical (TMD) is on top of Horizontal (LCR)?

@seisman seisman marked this pull request as ready for review October 11, 2024 05:56
@seisman seisman added maintenance Boring but important stuff for the core devs skip-changelog Skip adding Pull Request to changelog typing Type hints and static type checking labels Oct 11, 2024
@seisman seisman added this to the 0.14.0 milestone Oct 11, 2024
@seisman seisman merged commit 3e3b575 into main Oct 11, 2024
19 of 21 checks passed
@seisman seisman deleted the typing/justify branch October 11, 2024 06:05
seisman added a commit that referenced this pull request Oct 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
maintenance Boring but important stuff for the core devs skip-changelog Skip adding Pull Request to changelog typing Type hints and static type checking
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants