Commit 58a7760
committed
fix(oauth): narrow exp_time before subtraction (mypy 1.14 + pyjwt 2.13)
Previous fix wrapped exp_time in bool() to satisfy mypy's [return-value]
rule. That didn't narrow the type, so mypy then flagged the
`(exp_time - buffer_time)` expression with `[operator]` "Unsupported
operand types for - ('None' and 'int')" — the short-circuit at runtime
is correct, but mypy can't track narrowing through a bool() call.
Replace with explicit `if exp_time is None: return False`. Same runtime
semantics (None and falsy exp_time both produce False), cleaner reading,
and mypy narrows the rest of the function to int after the guard.
Co-authored-by: Isaac
Signed-off-by: Vikrant Puppala <vikrant.puppala@databricks.com>1 parent ac3c86f commit 58a7760
1 file changed
Lines changed: 3 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
43 | 43 | | |
44 | 44 | | |
45 | 45 | | |
| 46 | + | |
| 47 | + | |
46 | 48 | | |
47 | 49 | | |
48 | | - | |
| 50 | + | |
49 | 51 | | |
50 | 52 | | |
51 | 53 | | |
| |||
0 commit comments