Commit c583fb6
committed
refactor: replace assert with natural type narrowing for null-id check
Restructure the null-id guard so that `id is None` is checked first,
allowing Pyright to naturally narrow the type to JSONRPCError (since
JSONRPCResponse.id is always RequestId). This eliminates the need for
the assert that was previously required to work around Pyright's
inability to narrow through negated compound conditions.1 parent bf35f27 commit c583fb6
File tree
1 file changed
+2
-9
lines changed1 file changed
+2
-9
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
458 | 458 | | |
459 | 459 | | |
460 | 460 | | |
461 | | - | |
462 | | - | |
463 | | - | |
464 | | - | |
| 461 | + | |
| 462 | + | |
465 | 463 | | |
466 | 464 | | |
467 | 465 | | |
468 | 466 | | |
469 | | - | |
470 | | - | |
471 | | - | |
472 | | - | |
473 | | - | |
474 | 467 | | |
475 | 468 | | |
476 | 469 | | |
| |||
0 commit comments