-
Notifications
You must be signed in to change notification settings - Fork 41
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
Documentation of function parameters is inconsistent and sometimes misleading for new users #116
Comments
@horsburgh, no that seems odd and the more I look through the code there are several things I'm wondering about.
|
@thodson-usgs - should the sites argument in the dataretreival functions actually be anything that Pabitra just submitted a pull request with an initial implementation of type hints for just the one function so you can have a look and see if you like that. If you are OK with what he's done, we could work on the other functions. |
@horsburgh, his PR looks great. This is off the cuff, but I suspect it's as easy as if type(x) is string:
continue
elif is_list_like(x):
x = list(x)
else:
raise |
* [#116] initial implementation of type hints * Apply suggestions from code review - using Tuple from typing module Co-authored-by: Timothy Hodson <[email protected]> --------- Co-authored-by: Timothy Hodson <[email protected]>
* [DOI-USGS#116] adding type hints to public APIs of nwis module * [DOI-USGS#116] adding unit tests for some parameter value types * [DOI-USGS#116] type check to raise error
Using dataretrieval 1.0.6 in my class this week. Students noticed the following in PyCharm:
I told them they could pass a single site as a string or a list of sites as a list of strings, but they were confused because the highlighted message says "Expected type 'array.pyi' got 'str' instead".
The documentation of the get_discharge_peaks function says "array of strings":
I even had one student who converted his site code to a Numpy array and passed it to the get_discharge_peaks function. The function actually returns a response, but it's not just for the one site - it had data for lots of sites. Didn't dig in too deep there.
Documentation of the sites parameter for other functions is ambiguous, but not as confusing. In PyCharm:
In the code:
@thodson-usgs - we could take a crack at cleaning this up unless this is intentional or there's another reason not to?
The text was updated successfully, but these errors were encountered: