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

Fix 160. **params arg in IVDataService.get now raises warning when case insensitively matches other parameters #174

Merged
merged 10 commits into from Feb 8, 2022

Conversation

aaraney
Copy link
Member

@aaraney aaraney commented Feb 7, 2022

IVDataService.get's **params argument is susceptible to malformed case entries (i.e. service.get(startdt="2022-01-01", ...) should instead be service.get(startDT="2022-01-01", ...)). This PR resolves this issue. Now, the above case, or any case where a **params argument case insensitively matches a non-**params argument, throws a RuntimeWarning and notes the parameters that are likely malformed. This behavior should change to an exception once nwis_client > 3.0.X.

fixes #160.

Changes

  • nwis_client.IVDataService.get throws RuntimeWarning when arguments in **params case insensitively match a non-**params argument. (i.e. service.get(startdt="2022-01-01", ...) the correct call is service.get(startDT="2022-01-01", ...))

Todos

  • Throw RuntimeError once nwis_client > 3.0.X

Checklist

  • PR has an informative and human-readable title
  • PR is well outlined and documented. See #12 for an example
  • Changes are limited to a single goal (no scope creep)
  • Code can be automatically merged (no conflicts)
  • Code follows project standards (see CONTRIBUTING.md)
  • Passes all existing automated tests
  • Any change in functionality is tested
  • New functions are documented (with a description, list of inputs, and expected output) using numpy docstring formatting
  • Placeholder code is flagged / future todos are captured in comments
  • Reviewers requested with the Reviewers tool ➡️

@jarq6c jarq6c self-requested a review February 8, 2022 12:51
@jarq6c
Copy link
Collaborator

jarq6c commented Feb 8, 2022

I like the plan to transition from warnings to exceptions. I think using the decorator was a good idea to facilitate this.

Thanks for the contribution!

@jarq6c jarq6c added bug Something isn't working enhancement New feature or request labels Feb 8, 2022
@aaraney
Copy link
Member Author

aaraney commented Feb 8, 2022

I like the plan to transition from warnings to exceptions. I think using the decorator was a good idea to facilitate this.

Thanks for the contribution!

For sure! It was fun to become more familiar with python's inspect library.

If there are no open other comments, I think we can merge.

@aaraney
Copy link
Member Author

aaraney commented Feb 8, 2022

See #176:

Changes

  • alteration to goal set out in 174. Now, nwis_client > 3.1 will raise RuntimeError exception instead of RuntimeWarning when arguments in **params case insensitively match a non-**params argument. (i.e. service.get(startdt="2022-01-01", ...) the correct call is service.get(startDT="2022-01-01", ...)). Previously, the proposed warning to error timeline was nwis_client > 3.0.

@aaraney aaraney deleted the fix_160 branch May 19, 2023 01:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

NWIS Client: Possible case sensitivity issue
2 participants