Commit 1dffcc0
nldi: fix several user-visible bugs in get_features, get_flowlines, search
Bundles six discrete fixes to the NLDI module:
* `search(find='flowlines')` without `navigation_mode` crashed with
`AttributeError: 'NoneType' object has no attribute 'upper'` from inside
`_validate_navigation_mode`. `_validate_navigation_mode` now treats
`None` as a clean `ValueError`, returns the upper-cased value (callers
use the normalized form), and raises `ValueError` rather than
`TypeError` for invalid modes — these are bad values, not bad types.
`search` also surfaces a clear error before delegating to
`get_flowlines`.
* `get_flowlines(comid=...)` silently dropped the `trim_start` argument:
the `comid` branch built `query_params` without `trimStart`. Move the
shared params out of the branch.
* `get_features(lat=0.0, ...)` and `search(lat=0.0, ...)` treated the
equator/prime-meridian as missing because the code used `if lat:` /
`if comid:` truthiness checks. Switch to `is None` checks throughout
so coordinates of exactly zero are accepted and `comid=0` is no longer
conflated with "no comid".
* The error message produced by `get_features` for feature-source +
data-source paths had an unbalanced quote
(`"feature_id 'USGS-X, and data source ..."`). Closing quote restored
via a small `_features_err_msg` helper that the two branches share.
* The unconditional `_validate_data_source(feature_source)` in
`get_features` is now guarded by `if feature_source:` to avoid
validating `None` once the cache-bug fix (#246) lands.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>1 parent 51ac674 commit 1dffcc0
2 files changed
Lines changed: 135 additions & 56 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
79 | 79 | | |
80 | 80 | | |
81 | 81 | | |
82 | | - | |
83 | | - | |
84 | | - | |
| 82 | + | |
85 | 83 | | |
86 | 84 | | |
87 | | - | |
88 | 85 | | |
89 | | - | |
90 | 86 | | |
91 | | - | |
92 | 87 | | |
93 | 88 | | |
94 | | - | |
| 89 | + | |
95 | 90 | | |
96 | 91 | | |
97 | 92 | | |
| |||
232 | 227 | | |
233 | 228 | | |
234 | 229 | | |
235 | | - | |
236 | | - | |
| 230 | + | |
237 | 231 | | |
238 | 232 | | |
239 | | - | |
240 | | - | |
| 233 | + | |
| 234 | + | |
| 235 | + | |
241 | 236 | | |
242 | 237 | | |
243 | 238 | | |
244 | 239 | | |
245 | | - | |
| 240 | + | |
246 | 241 | | |
247 | 242 | | |
248 | 243 | | |
249 | 244 | | |
250 | | - | |
251 | | - | |
252 | | - | |
| 245 | + | |
| 246 | + | |
253 | 247 | | |
254 | 248 | | |
255 | 249 | | |
256 | | - | |
257 | 250 | | |
258 | | - | |
259 | 251 | | |
260 | 252 | | |
261 | | - | |
262 | | - | |
263 | | - | |
| 253 | + | |
| 254 | + | |
264 | 255 | | |
265 | | - | |
| 256 | + | |
266 | 257 | | |
267 | | - | |
| 258 | + | |
268 | 259 | | |
269 | 260 | | |
270 | | - | |
271 | | - | |
272 | | - | |
273 | | - | |
274 | | - | |
275 | | - | |
276 | | - | |
277 | | - | |
278 | | - | |
279 | | - | |
280 | | - | |
281 | | - | |
282 | | - | |
283 | | - | |
284 | | - | |
285 | 261 | | |
286 | | - | |
287 | | - | |
288 | | - | |
289 | | - | |
290 | | - | |
| 262 | + | |
| 263 | + | |
| 264 | + | |
| 265 | + | |
| 266 | + | |
| 267 | + | |
| 268 | + | |
| 269 | + | |
| 270 | + | |
| 271 | + | |
291 | 272 | | |
292 | | - | |
293 | | - | |
294 | | - | |
295 | | - | |
| 273 | + | |
| 274 | + | |
| 275 | + | |
296 | 276 | | |
297 | 277 | | |
298 | 278 | | |
| |||
413 | 393 | | |
414 | 394 | | |
415 | 395 | | |
416 | | - | |
| 396 | + | |
417 | 397 | | |
418 | 398 | | |
419 | | - | |
420 | 399 | | |
421 | 400 | | |
422 | 401 | | |
423 | 402 | | |
424 | 403 | | |
425 | 404 | | |
426 | | - | |
| 405 | + | |
427 | 406 | | |
428 | 407 | | |
429 | 408 | | |
430 | | - | |
| 409 | + | |
431 | 410 | | |
432 | 411 | | |
433 | 412 | | |
434 | 413 | | |
435 | 414 | | |
436 | | - | |
437 | | - | |
| 415 | + | |
438 | 416 | | |
439 | 417 | | |
440 | 418 | | |
| |||
443 | 421 | | |
444 | 422 | | |
445 | 423 | | |
| 424 | + | |
| 425 | + | |
| 426 | + | |
| 427 | + | |
| 428 | + | |
446 | 429 | | |
447 | 430 | | |
448 | 431 | | |
| |||
483 | 466 | | |
484 | 467 | | |
485 | 468 | | |
486 | | - | |
487 | | - | |
488 | | - | |
489 | | - | |
| 469 | + | |
| 470 | + | |
| 471 | + | |
| 472 | + | |
| 473 | + | |
| 474 | + | |
| 475 | + | |
| 476 | + | |
| 477 | + | |
| 478 | + | |
| 479 | + | |
| 480 | + | |
| 481 | + | |
| 482 | + | |
| 483 | + | |
| 484 | + | |
| 485 | + | |
| 486 | + | |
| 487 | + | |
| 488 | + | |
| 489 | + | |
| 490 | + | |
| 491 | + | |
| 492 | + | |
490 | 493 | | |
491 | 494 | | |
492 | 495 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
1 | 2 | | |
2 | 3 | | |
3 | 4 | | |
4 | 5 | | |
| 6 | + | |
5 | 7 | | |
6 | 8 | | |
7 | 9 | | |
| |||
280 | 282 | | |
281 | 283 | | |
282 | 284 | | |
| 285 | + | |
| 286 | + | |
| 287 | + | |
| 288 | + | |
| 289 | + | |
| 290 | + | |
| 291 | + | |
| 292 | + | |
| 293 | + | |
| 294 | + | |
| 295 | + | |
| 296 | + | |
| 297 | + | |
| 298 | + | |
| 299 | + | |
| 300 | + | |
| 301 | + | |
| 302 | + | |
| 303 | + | |
| 304 | + | |
| 305 | + | |
| 306 | + | |
| 307 | + | |
| 308 | + | |
| 309 | + | |
| 310 | + | |
| 311 | + | |
| 312 | + | |
| 313 | + | |
| 314 | + | |
| 315 | + | |
| 316 | + | |
| 317 | + | |
| 318 | + | |
| 319 | + | |
| 320 | + | |
| 321 | + | |
| 322 | + | |
| 323 | + | |
| 324 | + | |
| 325 | + | |
| 326 | + | |
| 327 | + | |
| 328 | + | |
| 329 | + | |
| 330 | + | |
| 331 | + | |
| 332 | + | |
| 333 | + | |
| 334 | + | |
| 335 | + | |
| 336 | + | |
| 337 | + | |
| 338 | + | |
| 339 | + | |
| 340 | + | |
| 341 | + | |
| 342 | + | |
| 343 | + | |
| 344 | + | |
| 345 | + | |
| 346 | + | |
| 347 | + | |
| 348 | + | |
| 349 | + | |
| 350 | + | |
| 351 | + | |
| 352 | + | |
| 353 | + | |
| 354 | + | |
| 355 | + | |
| 356 | + | |
| 357 | + | |
| 358 | + | |
0 commit comments