You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Six fixes from a multi-agent review pass on PR #269:
1. Narrow the per-feature except handler from a bare Exception to
(RequestException, ValueError, OSError). The previous catch-all
would swallow programming bugs (KeyError on a malformed feature,
AttributeError, ...) and silently drop rows.
2. Escape single quotes in CQL string literals via the standard
doubling rule. Most monitoring-location IDs cannot contain a
quote, but the function takes arbitrary strings — defending
against malformed filters and potential injection regardless.
New _quote_cql_str helper, applied to monitoring_location_id and
file_type. New unit test pins the behaviour.
3. Promote file_type to a Literal["exsa", "base", "corr"] and derive
_VALID_FILE_TYPES from it via typing.get_args, so the runtime
guard and the type hint can never drift apart.
4. Rename the `datetime` parameter to `time` to match the convention
used by every sibling waterdata getter (and to stop shadowing the
stdlib `datetime` module). The parameter is still passed through
as the STAC `datetime` query string under the hood; that's now
documented explicitly.
5. Switch the multi-type local filter from a substring check on the
asset URL to feature["properties"]["file_type"]. Substring
matching on URLs would false-match if a host or path ever
contained one of the literal type names; STAC features carry the
typed property already.
6. Skip the on-disk RDB write when file_path is None. tempfile.mkdtemp
leaks (no automatic cleanup), and df.attrs["url"] already records
the source — so by default we now return only the parsed frame.
Users who want a local copy can pass file_path=...; the contract
for that path is unchanged.
While here, dropped a "discrete analogue to the OGC waterdata getters"
sentence from the module docstring (it was internal-architecture
WHAT-narrating, not user-relevant guidance).
All 11 ratings tests pass (one new test for the CQL quote-escaping).
Live verification on USGS-01104475 confirms file_path=None still
returns the parsed frame with df.attrs populated, multi-type via
property filter returns the expected 4 tables, and the renamed
`time=` parameter still drives the STAC datetime filter.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
0 commit comments