Commit 96d60a2
committed
fix(typecheck): make the model_name stash env-independent
The `# type: ignore[assignment]` was correct locally and WRONG in CI. torch's
Module.__setattr__ is typed Tensor|Module, so `model.model_name = <str>` only
needs silencing when sentence-transformers/torch is actually installed; without
it the name is untyped and the ignore becomes an unused-ignore error. The gate
therefore failed in whichever environment you did not develop in — exactly the
local-vs-CI drift TOOL-PINS exists to catch, arriving by a different door.
setattr() is not checked against __setattr__ overloads, so it is clean either
way, and it is the honest spelling: the attribute is dynamic, declared by
neither SentenceTransformer nor torch.
mypy clean over 365 files locally (torch present); no ignore left to go unused
where it is absent.1 parent 5b84398 commit 96d60a2
2 files changed
Lines changed: 9 additions & 8 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
291 | 291 | | |
292 | 292 | | |
293 | 293 | | |
294 | | - | |
295 | | - | |
296 | | - | |
297 | | - | |
| 294 | + | |
| 295 | + | |
| 296 | + | |
| 297 | + | |
| 298 | + | |
298 | 299 | | |
299 | 300 | | |
300 | 301 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
528 | 528 | | |
529 | 529 | | |
530 | 530 | | |
531 | | - | |
532 | | - | |
533 | | - | |
534 | | - | |
| 531 | + | |
| 532 | + | |
| 533 | + | |
| 534 | + | |
535 | 535 | | |
536 | 536 | | |
537 | 537 | | |
| |||
0 commit comments