Skip to content

fix(wqp): WQP_Metadata.variable_info returns None instead of raising NotImplementedError#317

Draft
thodson-usgs wants to merge 1 commit into
DOI-USGS:mainfrom
thodson-usgs:fix/wqp-metadata-variable-info
Draft

fix(wqp): WQP_Metadata.variable_info returns None instead of raising NotImplementedError#317
thodson-usgs wants to merge 1 commit into
DOI-USGS:mainfrom
thodson-usgs:fix/wqp-metadata-variable-info

Conversation

@thodson-usgs
Copy link
Copy Markdown
Collaborator

Problem

WQP_Metadata defines site_info but not variable_info, so accessing wqp_md.variable_info falls through to the BaseMetadata.variable_info stub and raises NotImplementedError — even though WQP simply has no variable/parameter catalog to expose. (NWIS_Metadata.variable_info returns None with a deprecation warning; WQP had nothing.)

Change

  • Add WQP_Metadata.variable_info returning None, mirroring how site_info returns None when the query carried no siteid.
  • 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 stays a concrete value object (the modern getters instantiate it directly), so it is deliberately not an abc.ABC.

No behavior change beyond WQP variable_info no longer raising; the base stub still raises NotImplementedError (contract preserved). Regression test added.

Verification

WQP_Metadata(...).variable_info returns None without raising; BaseMetadata(...).variable_info still raises. 77 tests pass across tests/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.py god-module.

🤖 Generated with Claude Code

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>
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.

1 participant