fix(wqp): WQP_Metadata.variable_info returns None instead of raising NotImplementedError#317
Draft
thodson-usgs wants to merge 1 commit into
Draft
Conversation
WQP_Metadata defines site_info but not variable_info, so accessing `wqp_md.variable_info` fell through to the BaseMetadata stub and raised NotImplementedError -- even though WQP simply has no variable/parameter catalog. Override it to return None (matching how site_info returns None when absent). Also document on BaseMetadata that site_info/variable_info are legacy hooks overridden by the nwis/wqp metadata subclasses and are not part of the modern waterdata contract -- BaseMetadata is a concrete value object the waterdata getters return directly, so it stays concrete (not an ABC). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
WQP_Metadatadefinessite_infobut notvariable_info, so accessingwqp_md.variable_infofalls through to theBaseMetadata.variable_infostub and raisesNotImplementedError— even though WQP simply has no variable/parameter catalog to expose. (NWIS_Metadata.variable_inforeturnsNonewith a deprecation warning; WQP had nothing.)Change
WQP_Metadata.variable_inforeturningNone, mirroring howsite_inforeturnsNonewhen the query carried nositeid.BaseMetadatathatsite_info/variable_infoare legacy hooks overridden by thenwis/wqpmetadata subclasses, and are not part of the modernwaterdatacontract.BaseMetadatastays a concrete value object (the modern getters instantiate it directly), so it is deliberately not anabc.ABC.No behavior change beyond WQP
variable_infono longer raising; the base stub still raisesNotImplementedError(contract preserved). Regression test added.Verification
WQP_Metadata(...).variable_inforeturnsNonewithout raising;BaseMetadata(...).variable_infostill raises. 77 tests pass acrosstests/utils_test.py+tests/wqp_test.py+tests/nwis_test.py; ruff clean.This is the small, zero-risk half of an architecture review's findings; a separate PR decomposes the
waterdata/utils.pygod-module.🤖 Generated with Claude Code