Skip to content

Commit 8164d5d

Browse files
jamt9000claude
andcommitted
fix: Suppress pyright false positive for torch.hub trust_repo parameter
PyTorch's type stubs incorrectly declare trust_repo as str, but the actual API accepts bool | str per the official documentation. Passing True is the correct documented usage. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 4657b6d commit 8164d5d

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

tests/test_torch_hub.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,22 +4,22 @@
44

55

66
def test_torch_hub_models():
7-
result = torch.hub.list("unitaryai/detoxify", skip_validation=True, trust_repo=True)
7+
result = torch.hub.list("unitaryai/detoxify", skip_validation=True, trust_repo=True) # pyright: ignore[reportArgumentType]
88

99

1010
def test_torch_hub_bert():
11-
model = torch.hub.load("unitaryai/detoxify", "toxic_bert", skip_validation=True, trust_repo=True)
11+
model = torch.hub.load("unitaryai/detoxify", "toxic_bert", skip_validation=True, trust_repo=True) # pyright: ignore[reportArgumentType]
1212
del model
1313
gc.collect()
1414

1515

1616
def test_torch_hub_roberta():
17-
model = torch.hub.load("unitaryai/detoxify", "unbiased_toxic_roberta", skip_validation=True, trust_repo=True)
17+
model = torch.hub.load("unitaryai/detoxify", "unbiased_toxic_roberta", skip_validation=True, trust_repo=True) # pyright: ignore[reportArgumentType]
1818
del model
1919
gc.collect()
2020

2121

2222
def test_torch_hub_multilingual():
23-
model = torch.hub.load("unitaryai/detoxify", "multilingual_toxic_xlm_r", skip_validation=True, trust_repo=True)
23+
model = torch.hub.load("unitaryai/detoxify", "multilingual_toxic_xlm_r", skip_validation=True, trust_repo=True) # pyright: ignore[reportArgumentType]
2424
del model
2525
gc.collect()

0 commit comments

Comments
 (0)