Commit 2fc25c2
committed
fix: restclient _get_resource_uri typing — None-safe urljoin (CI Lint & Type Check)
The RestClientDefaults mixin extraction (commit 8db7c54) removed the
only `# type: ignore[union-attr]` in restclient.py. That ignore was
on `self.params.get('timeout', 60)` — but its presence happened to
shape mypy's whole-file inference such that the OTHER `self.params.get('url')`
call at line 139 was not flagged. With the per-line ignore gone, mypy
finally sees the latent issue:
- `Value of type variable "AnyStr" of "urljoin" cannot be "str | Any | None"`
- `Incompatible return value type (got "str | Any | None", expected "str")`
Both originate from `dict.get('url')` returning `str | None` and
urljoin requiring `str`. Replace the bare get + the misplaced
union-attr ignore with a None-safe pattern:
base = self.params.get('url') or ''
return urljoin(str(base), resource)
mypy clean (155 files), flake8 clean (0), 288/288 unit pass.1 parent 8db7c54 commit 2fc25c2
1 file changed
Lines changed: 2 additions & 4 deletions
Lines changed: 2 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
136 | 136 | | |
137 | 137 | | |
138 | 138 | | |
139 | | - | |
140 | | - | |
141 | | - | |
142 | | - | |
| 139 | + | |
| 140 | + | |
143 | 141 | | |
144 | 142 | | |
0 commit comments