Skip to content

Commit c940fcc

Browse files
thodson-usgsclaude
andcommitted
style(waterdata): label the status line "Progress:" instead of "waterdata"
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent 4a0a3a8 commit c940fcc

3 files changed

Lines changed: 5 additions & 4 deletions

File tree

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ progress on a single, self-updating line on `stderr` — showing the chunk and
125125
page counts, rows retrieved so far, and the API requests remaining for the hour:
126126

127127
```text
128-
waterdata · chunk 2/5 · 14 pages · 8,421 rows · 4,870 requests left
128+
Progress: chunk 2/5 · 14 pages · 8,421 rows · 4,870 requests left
129129
```
130130

131131
The line appears automatically when `stderr` is an interactive terminal.

dataretrieval/waterdata/_progress.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
and ``utils.get_stats_data``). This module surfaces that work as one line on
77
stderr, rewritten in place as data arrives::
88
9-
waterdata · chunk 2/5 · 14 pages · 8,421 rows · 4,870 requests left
9+
Progress: chunk 2/5 · 14 pages · 8,421 rows · 4,870 requests left
1010
1111
It replaces the per-page ``logger.info`` calls that previously narrated the same
1212
events one line at a time.
@@ -102,7 +102,7 @@ def set_rate_remaining(self, value: str | int | None) -> None:
102102
self.rate_remaining = str(value)
103103

104104
def _format(self) -> str:
105-
parts = ["waterdata"]
105+
parts: list[str] = []
106106
if self.total_chunks > 1:
107107
parts.append(f"chunk {self.current_chunk}/{self.total_chunks}")
108108
parts.append(f"{self.pages} page" + ("" if self.pages == 1 else "s"))
@@ -114,7 +114,7 @@ def _format(self) -> str:
114114
rate = self.rate_remaining
115115
rate = f"{int(rate):,}" if rate.isdigit() else rate
116116
parts.append(f"{rate} requests left")
117-
return " · ".join(parts)
117+
return "Progress: " + " · ".join(parts)
118118

119119
def _render(self) -> None:
120120
if not self.enabled or self._closed:

tests/waterdata_progress_test.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ def test_renders_pages_rows_and_rate_limit():
4848
reporter.set_rate_remaining("4870")
4949
reporter.add_page(rows=1234)
5050
out = stream.getvalue()
51+
assert out.lstrip("\r").startswith("Progress: ")
5152
assert "1 page" in out
5253
assert "1,234 rows" in out
5354
assert "4,870 requests left" in out

0 commit comments

Comments
 (0)