Skip to content

Commit 7836d12

Browse files
thodson-usgsclaude
andcommitted
Tidy WQP_Metadata.site_info per /simplify review
Per /simplify review on PR #249: - Switch `site_info` from `@property` to `functools.cached_property`. Repeated access of `md.site_info` (common in notebooks) now reuses the resolved tuple instead of issuing a fresh `what_sites` HTTP call on every read. - Add a one-line comment explaining the legacy-alias -> `siteid` coercion: whichever of `siteid`/`sites`/`site`/`site_no` matched, the value is passed as `siteid` (what_sites' native WQP arg). Also confirmed the docstring's `comments` -> `comment` rename matches `BaseMetadata.comment` (singular) defined at `dataretrieval/utils.py:130`. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent add49eb commit 7836d12

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

dataretrieval/wqp.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
from __future__ import annotations
1313

1414
import warnings
15+
from functools import cached_property
1516
from io import StringIO
1617
from typing import TYPE_CHECKING
1718

@@ -687,8 +688,10 @@ def __init__(
687688
self._legacy = legacy
688689
self._ssl_check = ssl_check
689690

690-
@property
691+
@cached_property
691692
def site_info(self):
693+
# Walk WQP-native key first, then legacy NWIS-style aliases. Whichever
694+
# matched, pass the value as `siteid` -- that's what_sites' native arg.
692695
for key in ("siteid", "sites", "site", "site_no"):
693696
if key in self._parameters:
694697
return what_sites(

0 commit comments

Comments
 (0)