Skip to content

Commit 0cf981e

Browse files
committed
Widen properties annotation to Iterable[str] for consistency
Previous commit kept `properties: str | list[str] | None` based on a wrong premise — that `",".join(...)` downstream "requires a list." It doesn't: `_get_args` runs `_normalize_str_iterable` for properties exactly like every other multi-value string filter, materializing pd.Series, np.ndarray, generators, and tuples into a list before any downstream code sees them. The stress test already proved all five iterable shapes work at runtime. Bring the annotation and docstring in line with the others: 11 signatures (`str | list[str] | None` -> `str | Iterable[str] | None`) and 11 docstring lines ("string or list of strings" -> "string or iterable of strings").
1 parent 463912a commit 0cf981e

1 file changed

Lines changed: 22 additions & 22 deletions

File tree

dataretrieval/waterdata/api.py

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ def get_daily(
4242
monitoring_location_id: str | Iterable[str] | None = None,
4343
parameter_code: str | Iterable[str] | None = None,
4444
statistic_id: str | Iterable[str] | None = None,
45-
properties: str | list[str] | None = None,
45+
properties: str | Iterable[str] | None = None,
4646
time_series_id: str | Iterable[str] | None = None,
4747
daily_id: str | Iterable[str] | None = None,
4848
approval_status: str | Iterable[str] | None = None,
@@ -90,7 +90,7 @@ def get_daily(
9090
Example codes include 00001 (max), 00002 (min), and 00003 (mean).
9191
A complete list of codes and their descriptions can be found at
9292
https://help.waterdata.usgs.gov/code/stat_cd_nm_query?stat_nm_cd=%25&fmt=html.
93-
properties : string or list of strings, optional
93+
properties : string or iterable of strings, optional
9494
A vector of requested columns to be returned from the query.
9595
Available options are: geometry, id, time_series_id,
9696
monitoring_location_id, parameter_code, statistic_id, time, value,
@@ -244,7 +244,7 @@ def get_continuous(
244244
monitoring_location_id: str | Iterable[str] | None = None,
245245
parameter_code: str | Iterable[str] | None = None,
246246
statistic_id: str | Iterable[str] | None = None,
247-
properties: str | list[str] | None = None,
247+
properties: str | Iterable[str] | None = None,
248248
time_series_id: str | Iterable[str] | None = None,
249249
continuous_id: str | Iterable[str] | None = None,
250250
approval_status: str | Iterable[str] | None = None,
@@ -297,7 +297,7 @@ def get_continuous(
297297
typically return no results. A complete list of codes and their
298298
descriptions can be found at
299299
https://help.waterdata.usgs.gov/code/stat_cd_nm_query?stat_nm_cd=%25&fmt=html.
300-
properties : string or list of strings, optional
300+
properties : string or iterable of strings, optional
301301
A vector of requested columns to be returned from the query.
302302
Available options are: geometry, id, time_series_id,
303303
monitoring_location_id, parameter_code, statistic_id, time, value,
@@ -469,7 +469,7 @@ def get_monitoring_locations(
469469
well_constructed_depth: str | Iterable[str] | None = None,
470470
hole_constructed_depth: str | Iterable[str] | None = None,
471471
depth_source_code: str | Iterable[str] | None = None,
472-
properties: str | list[str] | None = None,
472+
properties: str | Iterable[str] | None = None,
473473
skip_geometry: bool | None = None,
474474
time: str | Iterable[str] | None = None,
475475
bbox: list[float] | None = None,
@@ -650,7 +650,7 @@ def get_monitoring_locations(
650650
A code indicating the source of water-level data. A `list of
651651
codes <https://help.waterdata.usgs.gov/code/water_level_src_cd_query?fmt=html>`_
652652
is available.
653-
properties : string or list of strings, optional
653+
properties : string or iterable of strings, optional
654654
A vector of requested columns to be returned from the query. Available
655655
options are: geometry, id, agency_code, agency_name,
656656
monitoring_location_number, monitoring_location_name, district_code,
@@ -730,7 +730,7 @@ def get_time_series_metadata(
730730
monitoring_location_id: str | Iterable[str] | None = None,
731731
parameter_code: str | Iterable[str] | None = None,
732732
parameter_name: str | Iterable[str] | None = None,
733-
properties: str | list[str] | None = None,
733+
properties: str | Iterable[str] | None = None,
734734
statistic_id: str | Iterable[str] | None = None,
735735
hydrologic_unit_code: str | Iterable[str] | None = None,
736736
state_name: str | Iterable[str] | None = None,
@@ -779,7 +779,7 @@ def get_time_series_metadata(
779779
https://help.waterdata.usgs.gov/codes-and-parameters/parameters.
780780
parameter_name : string or iterable of strings, optional
781781
A human-understandable name corresponding to parameter_code.
782-
properties : string or list of strings, optional
782+
properties : string or iterable of strings, optional
783783
A vector of requested columns to be returned from the query.
784784
Available options are: geometry, id, time_series_id,
785785
monitoring_location_id, parameter_code, statistic_id, time, value,
@@ -1005,7 +1005,7 @@ def get_combined_metadata(
10051005
well_constructed_depth: str | Iterable[str] | None = None,
10061006
hole_constructed_depth: str | Iterable[str] | None = None,
10071007
depth_source_code: str | Iterable[str] | None = None,
1008-
properties: str | list[str] | None = None,
1008+
properties: str | Iterable[str] | None = None,
10091009
skip_geometry: bool | None = None,
10101010
bbox: list[float] | None = None,
10111011
limit: int | None = None,
@@ -1091,7 +1091,7 @@ def get_combined_metadata(
10911091
altitude, vertical/horizontal datum, drainage area, aquifer,
10921092
well construction, …); see :func:`get_monitoring_locations` for
10931093
descriptions of each.
1094-
properties : string or list of strings, optional
1094+
properties : string or iterable of strings, optional
10951095
Subset of columns to return. Defaults to every available
10961096
property.
10971097
skip_geometry : boolean, optional
@@ -1185,7 +1185,7 @@ def get_latest_continuous(
11851185
monitoring_location_id: str | Iterable[str] | None = None,
11861186
parameter_code: str | Iterable[str] | None = None,
11871187
statistic_id: str | Iterable[str] | None = None,
1188-
properties: str | list[str] | None = None,
1188+
properties: str | Iterable[str] | None = None,
11891189
time_series_id: str | Iterable[str] | None = None,
11901190
latest_continuous_id: str | Iterable[str] | None = None,
11911191
approval_status: str | Iterable[str] | None = None,
@@ -1231,7 +1231,7 @@ def get_latest_continuous(
12311231
Example codes include 00001 (max), 00002 (min), and 00003 (mean).
12321232
A complete list of codes and their descriptions can be found at
12331233
https://help.waterdata.usgs.gov/code/stat_cd_nm_query?stat_nm_cd=%25&fmt=html.
1234-
properties : string or list of strings, optional
1234+
properties : string or iterable of strings, optional
12351235
A vector of requested columns to be returned from the query. Available
12361236
options are: geometry, id, time_series_id, monitoring_location_id,
12371237
parameter_code, statistic_id, time, value, unit_of_measure,
@@ -1380,7 +1380,7 @@ def get_latest_daily(
13801380
monitoring_location_id: str | Iterable[str] | None = None,
13811381
parameter_code: str | Iterable[str] | None = None,
13821382
statistic_id: str | Iterable[str] | None = None,
1383-
properties: str | list[str] | None = None,
1383+
properties: str | Iterable[str] | None = None,
13841384
time_series_id: str | Iterable[str] | None = None,
13851385
latest_daily_id: str | Iterable[str] | None = None,
13861386
approval_status: str | Iterable[str] | None = None,
@@ -1428,7 +1428,7 @@ def get_latest_daily(
14281428
Example codes include 00001 (max), 00002 (min), and 00003 (mean).
14291429
A complete list of codes and their descriptions can be found at
14301430
https://help.waterdata.usgs.gov/code/stat_cd_nm_query?stat_nm_cd=%25&fmt=html.
1431-
properties : string or list of strings, optional
1431+
properties : string or iterable of strings, optional
14321432
A vector of requested columns to be returned from the query. Available
14331433
options are: geometry, id, time_series_id, monitoring_location_id,
14341434
parameter_code, statistic_id, time, value, unit_of_measure,
@@ -1576,7 +1576,7 @@ def get_field_measurements(
15761576
monitoring_location_id: str | Iterable[str] | None = None,
15771577
parameter_code: str | Iterable[str] | None = None,
15781578
observing_procedure_code: str | Iterable[str] | None = None,
1579-
properties: str | list[str] | None = None,
1579+
properties: str | Iterable[str] | None = None,
15801580
field_visit_id: str | Iterable[str] | None = None,
15811581
approval_status: str | Iterable[str] | None = None,
15821582
unit_of_measure: str | Iterable[str] | None = None,
@@ -1618,7 +1618,7 @@ def get_field_measurements(
16181618
observing_procedure_code : string or iterable of strings, optional
16191619
A short code corresponding to the observing procedure for the field
16201620
measurement.
1621-
properties : string or list of strings, optional
1621+
properties : string or iterable of strings, optional
16221622
A vector of requested columns to be returned from the query. Available
16231623
options are: geometry, id, time_series_id, monitoring_location_id,
16241624
parameter_code, statistic_id, time, value, unit_of_measure,
@@ -1770,7 +1770,7 @@ def get_field_measurements_metadata(
17701770
begin: str | Iterable[str] | None = None,
17711771
end: str | Iterable[str] | None = None,
17721772
last_modified: str | Iterable[str] | None = None,
1773-
properties: str | list[str] | None = None,
1773+
properties: str | Iterable[str] | None = None,
17741774
skip_geometry: bool | None = None,
17751775
bbox: list[float] | None = None,
17761776
limit: int | None = None,
@@ -1813,7 +1813,7 @@ def get_field_measurements_metadata(
18131813
interval (``"start/end"``, optionally half-bounded with ``..``),
18141814
or an ISO 8601 duration (e.g. ``"P1M"``, ``"PT36H"``). See
18151815
:func:`get_time_series_metadata` for the full grammar.
1816-
properties : string or list of strings, optional
1816+
properties : string or iterable of strings, optional
18171817
Subset of columns to return. Defaults to every available property.
18181818
skip_geometry : boolean, optional
18191819
Skip per-feature geometries; the returned object will be a plain
@@ -1891,7 +1891,7 @@ def get_peaks(
18911891
month: int | list[int] | None = None,
18921892
day: int | list[int] | None = None,
18931893
peak_since: int | list[int] | None = None,
1894-
properties: str | list[str] | None = None,
1894+
properties: str | Iterable[str] | None = None,
18951895
skip_geometry: bool | None = None,
18961896
bbox: list[float] | None = None,
18971897
limit: int | None = None,
@@ -1937,7 +1937,7 @@ def get_peaks(
19371937
Filter on the year since which the peak value has stood as the
19381938
record (the API serves this field as an integer; many rows are
19391939
``null``).
1940-
properties : string or list of strings, optional
1940+
properties : string or iterable of strings, optional
19411941
Subset of columns to return. Defaults to every available property.
19421942
skip_geometry : boolean, optional
19431943
Skip per-feature geometries; the returned object will be a plain
@@ -2688,7 +2688,7 @@ def get_channel(
26882688
measurement_type: str | Iterable[str] | None = None,
26892689
last_modified: str | Iterable[str] | None = None,
26902690
channel_measurement_type: str | Iterable[str] | None = None,
2691-
properties: str | list[str] | None = None,
2691+
properties: str | Iterable[str] | None = None,
26922692
skip_geometry: bool | None = None,
26932693
bbox: list[float] | None = None,
26942694
limit: int | None = None,
@@ -2789,7 +2789,7 @@ def get_channel(
27892789
CQL2 queries.
27902790
channel_measurement_type : string or iterable of strings, optional
27912791
The channel measurement type.
2792-
properties : string or list of strings, optional
2792+
properties : string or iterable of strings, optional
27932793
A vector of requested columns to be returned from the query. Available
27942794
options are: geometry, channel_measurements_id, monitoring_location_id,
27952795
field_visit_id, measurement_number, time, channel_name, channel_flow,

0 commit comments

Comments
 (0)