@@ -72,11 +72,11 @@ def _set_response_url(response: httpx.Response, url: str | httpx.URL) -> None:
7272def _lowest_remaining (responses : list [httpx .Response ]) -> httpx .Response :
7373 """The response reporting the lowest ``x-ratelimit-remaining``.
7474
75- The rate-limit counter decreases monotonically within a window , so the
76- smallest value any sub-request saw is the most-current "quota left after
77- this call" — the right thing to surface. Under concurrent fan-out the
78- last response *by index* need not be the one the server processed last, so
79- pick the minimum (falling back to the last response if none report it) .
75+ Within a rate-limit window, the counter decreases monotonically, so the
76+ smallest value observed is the most conservative value to surface. Under
77+ concurrent fan-out, the last response *by index* need not be the one the
78+ server processed last. Fall back to the last response when none reports
79+ the header .
8080 """
8181 best : httpx .Response | None = None
8282 best_remaining : int | None = None
@@ -115,18 +115,19 @@ def _merge_response(
115115
116116
117117def _combine_chunk_frames (frames : list [pd .DataFrame ]) -> pd .DataFrame :
118- """Concatenate per-chunk frames and deduplicate non-null feature IDs .
118+ """Concatenate per-chunk frames and deduplicate IDs across chunks .
119119
120120 Empty frames are ignored before concatenation so an empty plain
121121 :class:`pandas.DataFrame` cannot downgrade a real ``GeoDataFrame`` and
122122 strip its geometry or CRS. When every frame is empty, the first frame is
123123 returned to preserve its concrete type.
124124
125- Deduplication is unconditional because overlap is possible on every plan
126- axis. Filter clauses can match the same feature, and list inputs can contain
127- repeated values or otherwise select overlapping records. Rows without an
128- ``id`` are preserved verbatim: pandas treats null values as duplicates, so
129- applying ``drop_duplicates`` to those rows would silently lose data.
125+ When multiple non-empty frames are combined, non-null feature IDs are
126+ deduplicated regardless of the plan axis. Filter clauses can match the same
127+ feature, and list inputs can contain repeated values or otherwise select
128+ overlapping records. Rows without an ``id`` are preserved verbatim: pandas
129+ treats null values as duplicates, so deduplicating them would silently lose
130+ data.
130131 """
131132 non_empty = [frame for frame in frames if not frame .empty ]
132133 if not non_empty :
@@ -155,10 +156,10 @@ def _combine_chunk_responses(
155156 Fold per-sub-request responses into a single aggregated response.
156157
157158 For a multi-response input, returns a shallow copy of
158- ``responses[0]`` with ``.headers`` set to those of the most-depleted
159- response ( lowest ``x-ratelimit-remaining`` — the quota actually left
160- after the fan-out ; see :func:`_lowest_remaining`), ``.elapsed`` set
161- to total wall-clock across every response , and ``.url`` set to the
159+ ``responses[0]`` with ``.headers`` set to those of the response reporting
160+ the lowest ``x-ratelimit-remaining`` value ( the most conservative quota
161+ observation ; see :func:`_lowest_remaining`), ``.elapsed`` set to the sum of
162+ the per-response elapsed durations , and ``.url`` set to the
162163 canonical original-query URL (when supplied) so ``BaseMetadata``
163164 reflects the user's full request rather than the first chunk.
164165
@@ -169,7 +170,7 @@ def _combine_chunk_responses(
169170 Parameters
170171 ----------
171172 responses : list[httpx.Response]
172- One response per completed sub-request, in execution order.
173+ One response per completed sub-request, in caller-provided order.
173174 canonical_url : str or None
174175 URL of the unchunked original request. ``None`` skips the URL
175176 override — used by the passthrough path (the fetcher's
@@ -191,8 +192,8 @@ def _combine_chunk_responses(
191192 if len (responses ) == 1 and canonical_url is None :
192193 return responses [0 ]
193194
194- # Headers come from the most-depleted response (lowest quota left after a
195- # concurrent fan-out; ``_lowest_remaining`` returns the lone response as-is
195+ # Headers come from the response with the lowest reported remaining quota;
196+ # ``_lowest_remaining`` returns the lone response as-is
196197 # for a single-element list). ``_merge_response`` re-sums elapsed onto a
197198 # fresh copy, so repeated calls (e.g. via ``ChunkedCall.partial_response``
198199 # during resume) stay idempotent.
0 commit comments