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

Type hint for DataFrame #103

Merged
merged 2 commits into from
Jun 6, 2023
Merged

Type hint for DataFrame #103

merged 2 commits into from
Jun 6, 2023

Conversation

davetapley
Copy link
Contributor

@davetapley davetapley commented Jun 1, 2023

Before:
Screen Shot 2023-06-01 at 11 00 36 AM

After:
Screen Shot 2023-06-01 at 11 01 06 AM

#97

This is sufficient for Pyright to infer the complete return type for (at least) nwis.get_info and nwis.get_iv.

DOI-USGS#97
@elbeejay
Copy link
Contributor

elbeejay commented Jun 5, 2023

I'm fine with this type of type hinting, thank you for also providing those screenshots @davetapley, helps me understand where this is helpful -- otherwise I'd have likely asked why this is more useful than the typing specified in the doc-string immediately below the function.

What do you think @thodson-usgs ?

Copy link
Collaborator

@thodson-usgs thodson-usgs left a comment

Choose a reason for hiding this comment

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

Yes, I'd accept type-hinting PR's, though we should encourage a standard style.

I don't see it causing a problem in this case, but eventually we may need to modify the import section in order for type hinting work with our build process. The details are hazy, but I'll fix it when that occurs.

dataretrieval/nwis.py Outdated Show resolved Hide resolved
@thodson-usgs
Copy link
Collaborator

Primarily, type-hinting makes the linter aware of what objects are.

Co-authored-by: Timothy Hodson <34148978+thodson-usgs@users.noreply.github.com>
@thodson-usgs thodson-usgs merged commit 37f4190 into DOI-USGS:master Jun 6, 2023
@davetapley davetapley mentioned this pull request Sep 20, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants