|
101 | 101 | _retry, |
102 | 102 | ) |
103 | 103 |
|
104 | | -# --------------------------------------------------------------------------- |
105 | | -# Type aliases for the ChunkedCall contract. |
106 | | -# --------------------------------------------------------------------------- |
107 | | - |
108 | | -# The per-sub-request fetcher the decorator wraps and ``ChunkedCall`` drives: |
109 | | -# an ``async def fetch(args) -> (df, response)``. |
110 | | -_Fetch = Callable[[dict[str, Any]], Awaitable[tuple[pd.DataFrame, httpx.Response]]] |
111 | | - |
112 | | -# Caller-supplied transform applied to the combined chunk result, so a |
113 | | -# resumed call returns the same shape as an un-interrupted one rather than |
114 | | -# the chunker's raw ``(frame, httpx.Response)``. This keeps the chunker |
115 | | -# generic: the OGC getters inject their post-processing (type coercion, |
116 | | -# column arrangement, ``BaseMetadata``) through ``_finalize_ogc``. |
117 | | -# The default is identity, so direct ``ChunkedCall`` use is unaffected. |
118 | | -_Finalize = Callable[[pd.DataFrame, httpx.Response], tuple[pd.DataFrame, Any]] |
119 | | - |
120 | | - |
121 | | -def _passthrough_result( |
122 | | - frame: pd.DataFrame, response: httpx.Response |
123 | | -) -> tuple[pd.DataFrame, Any]: |
124 | | - """Default :data:`_Finalize`: return the raw combined pair unchanged.""" |
125 | | - return frame, response |
126 | | - |
127 | | - |
128 | 104 | # Empirically the API replies HTTP 414 above ~8200 bytes of full URL — |
129 | 105 | # matches nginx's default ``large_client_header_buffers`` of 8 KB. 8000 |
130 | 106 | # leaves ~200 bytes for request-line framing and proxy variance. The decorator |
@@ -312,6 +288,30 @@ def parallel_chunks(n: int) -> Iterator[None]: |
312 | 288 | yield |
313 | 289 |
|
314 | 290 |
|
| 291 | +# --------------------------------------------------------------------------- |
| 292 | +# Type aliases for the ChunkedCall contract. |
| 293 | +# --------------------------------------------------------------------------- |
| 294 | + |
| 295 | +# The per-sub-request fetcher the decorator wraps and ``ChunkedCall`` drives: |
| 296 | +# an ``async def fetch(args) -> (df, response)``. |
| 297 | +_Fetch = Callable[[dict[str, Any]], Awaitable[tuple[pd.DataFrame, httpx.Response]]] |
| 298 | + |
| 299 | +# Caller-supplied transform applied to the combined chunk result, so a |
| 300 | +# resumed call returns the same shape as an un-interrupted one rather than |
| 301 | +# the chunker's raw ``(frame, httpx.Response)``. This keeps the chunker |
| 302 | +# generic: the OGC getters inject their post-processing (type coercion, |
| 303 | +# column arrangement, ``BaseMetadata``) through ``_finalize_ogc``. |
| 304 | +# The default is identity, so direct ``ChunkedCall`` use is unaffected. |
| 305 | +_Finalize = Callable[[pd.DataFrame, httpx.Response], tuple[pd.DataFrame, Any]] |
| 306 | + |
| 307 | + |
| 308 | +def _passthrough_result( |
| 309 | + frame: pd.DataFrame, response: httpx.Response |
| 310 | +) -> tuple[pd.DataFrame, Any]: |
| 311 | + """Default :data:`_Finalize`: return the raw combined pair unchanged.""" |
| 312 | + return frame, response |
| 313 | + |
| 314 | + |
315 | 315 | class ChunkedCall: |
316 | 316 | """ |
317 | 317 | Stateful handle for a chunked call. |
|
0 commit comments