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

TYP: Add type hints support for pygmt.datasets.load_sample_data #2859

Merged
merged 6 commits into from
Dec 15, 2023

Conversation

seisman
Copy link
Member

@seisman seisman commented Dec 7, 2023

Description of proposed changes

Address #2812.

Preview: https://pygmt-dev--2859.org.readthedocs.build/en/2859/api/generated/pygmt.datasets.load_sample_data.html#pygmt.datasets.load_sample_data

Reminders

  • Run make format and make check to make sure the code follows the style guide.
  • Add tests for new features or tests that would have caught the bug that you're fixing.
  • Add new public functions/methods/classes to doc/api/index.rst.
  • Write detailed docstrings for all functions/methods.
  • If wrapping a new module, open a 'Wrap new GMT module' issue and submit reasonably-sized PRs.
  • If adding new functionality, add an example to docstrings or tutorials.
  • Use underscores (not hyphens) in names of Python files and directories.

Slash Commands

You can write slash commands (/command) in the first line of a comment to perform
specific operations. Supported slash commands are:

  • /format: automatically format and lint the code
  • /test-gmt-dev: run full tests on the latest GMT development version

@seisman seisman added maintenance Boring but important stuff for the core devs typing Type hints and static type checking needs review This PR has higher priority and needs review. labels Dec 7, 2023
@seisman seisman added this to the 0.11.0 milestone Dec 7, 2023
@seisman seisman requested a review from a team December 11, 2023 01:45
Comment on lines +300 to +314
def load_sample_data(
name: Literal[
"bathymetry",
"earth_relief_holes",
"fractures",
"hotspots",
"japan_quakes",
"mars_shape",
"maunaloa_co2",
"notre_dame_topography",
"ocean_ridge_points",
"rock_compositions",
"usgs_quakes",
],
):
Copy link
Member

Choose a reason for hiding this comment

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

So far in line 313 (currently) or 324 (after this PR):

Parameters
----------
name : str
Name of the dataset to load.

was not changed to

name

Analogous as done for data_source in PR #2849.

for all resolutions except ``"15s"`` which is ``"pixel"`` only.
data_source
Select the source for the Earth relief data. Available options are:

Or was this intended because the list of available input names is a bit longer?

Copy link
Member Author

Choose a reason for hiding this comment

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

Fixed in 10a7ce4. Now it looks like:

image

Yes, it's a little bit longer, but I feel it's still acceptable.

@seisman seisman merged commit 7d98e66 into main Dec 15, 2023
17 checks passed
@seisman seisman deleted the typehints/load_sample_data branch December 15, 2023 12:52
@seisman seisman removed the needs review This PR has higher priority and needs review. label Dec 15, 2023
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 typing Type hints and static type checking
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants