Skip to content

Commit e0068d8

Browse files
frgfmpmeier
andauthored
Added missing typing annotations in dataset __getitem__ (#6843)
* style: Fixed typing of dataset __getitem__ * style: Fixed last missing typing Co-authored-by: Philip Meier <[email protected]>
1 parent e1f464b commit e0068d8

File tree

6 files changed

+7
-7
lines changed

6 files changed

+7
-7
lines changed

torchvision/datasets/dtd.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import os
22
import pathlib
3-
from typing import Callable, Optional
3+
from typing import Any, Callable, Optional, Tuple
44

55
import PIL.Image
66

@@ -76,7 +76,7 @@ def __init__(
7676
def __len__(self) -> int:
7777
return len(self._image_files)
7878

79-
def __getitem__(self, idx):
79+
def __getitem__(self, idx: int) -> Tuple[Any, Any]:
8080
image_file, label = self._image_files[idx], self._labels[idx]
8181
image = PIL.Image.open(image_file).convert("RGB")
8282

torchvision/datasets/fgvc_aircraft.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ def __init__(
9090
def __len__(self) -> int:
9191
return len(self._image_files)
9292

93-
def __getitem__(self, idx) -> Tuple[Any, Any]:
93+
def __getitem__(self, idx: int) -> Tuple[Any, Any]:
9494
image_file, label = self._image_files[idx], self._labels[idx]
9595
image = PIL.Image.open(image_file).convert("RGB")
9696

torchvision/datasets/flowers102.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ def __init__(
7676
def __len__(self) -> int:
7777
return len(self._image_files)
7878

79-
def __getitem__(self, idx) -> Tuple[Any, Any]:
79+
def __getitem__(self, idx: int) -> Tuple[Any, Any]:
8080
image_file, label = self._image_files[idx], self._labels[idx]
8181
image = PIL.Image.open(image_file).convert("RGB")
8282

torchvision/datasets/food101.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ def __init__(
6969
def __len__(self) -> int:
7070
return len(self._image_files)
7171

72-
def __getitem__(self, idx) -> Tuple[Any, Any]:
72+
def __getitem__(self, idx: int) -> Tuple[Any, Any]:
7373
image_file, label = self._image_files[idx], self._labels[idx]
7474
image = PIL.Image.open(image_file).convert("RGB")
7575

torchvision/datasets/rendered_sst2.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ def __init__(
5959
def __len__(self) -> int:
6060
return len(self._samples)
6161

62-
def __getitem__(self, idx) -> Tuple[Any, Any]:
62+
def __getitem__(self, idx: int) -> Tuple[Any, Any]:
6363
image_file, label = self._samples[idx]
6464
image = PIL.Image.open(image_file).convert("RGB")
6565

torchvision/datasets/sun397.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ def __init__(
5555
def __len__(self) -> int:
5656
return len(self._image_files)
5757

58-
def __getitem__(self, idx) -> Tuple[Any, Any]:
58+
def __getitem__(self, idx: int) -> Tuple[Any, Any]:
5959
image_file, label = self._image_files[idx], self._labels[idx]
6060
image = PIL.Image.open(image_file).convert("RGB")
6161

0 commit comments

Comments
 (0)