зеркало из https://github.com/microsoft/torchgeo.git
mypy v0.920 update (#299)
This commit is contained in:
Родитель
29dc789828
Коммит
9040e72f8e
|
@ -24,7 +24,7 @@ repos:
|
|||
additional_dependencies: ["toml"]
|
||||
|
||||
- repo: https://github.com/pre-commit/mirrors-mypy
|
||||
rev: v0.910
|
||||
rev: v0.920
|
||||
hooks:
|
||||
- id: mypy
|
||||
args: [--strict, --ignore-missing-imports, --show-error-codes]
|
||||
|
|
|
@ -167,7 +167,7 @@ def main(args: argparse.Namespace) -> None:
|
|||
dataloader = DataLoader(
|
||||
dataset,
|
||||
batch_size=args.batch_size,
|
||||
sampler=sampler, # type: ignore[arg-type]
|
||||
sampler=sampler,
|
||||
num_workers=args.num_workers,
|
||||
collate_fn=stack_samples,
|
||||
)
|
||||
|
|
|
@ -102,9 +102,8 @@ style =
|
|||
# pydocstyle 6.1+ required for pyproject.toml support
|
||||
pydocstyle[toml]>=6.1
|
||||
tests =
|
||||
# mypy 0.900+ required for pyproject.toml support, 0.920 has a decorator bug:
|
||||
# https://github.com/python/mypy/issues/11763
|
||||
mypy>=0.900,!=0.920
|
||||
# mypy 0.900+ required for pyproject.toml support
|
||||
mypy>=0.900
|
||||
# nbmake 0.1+ required to fix path_source bug
|
||||
nbmake>=0.1
|
||||
# pytest 6+ required for pyproject.toml support
|
||||
|
|
|
@ -334,7 +334,7 @@ class IDTReeS(VisionDataset):
|
|||
else:
|
||||
directory = os.path.join(root, self.task)
|
||||
if self.task == "task1":
|
||||
geoms = None # type: ignore[assignment]
|
||||
geoms = None
|
||||
labels = None
|
||||
else:
|
||||
geoms = self._load_geometries(directory)
|
||||
|
@ -342,7 +342,7 @@ class IDTReeS(VisionDataset):
|
|||
|
||||
images = glob.glob(os.path.join(directory, "RemoteSensing", "RGB", "*.tif"))
|
||||
|
||||
return images, geoms, labels
|
||||
return images, geoms, labels # type: ignore[return-value]
|
||||
|
||||
def _load_labels(self, directory: str) -> Any:
|
||||
"""Load the csv files containing the labels.
|
||||
|
|
|
@ -196,7 +196,9 @@ class OSCD(VisionDataset):
|
|||
for path in paths:
|
||||
with Image.open(path) as img:
|
||||
images.append(np.array(img))
|
||||
array = np.stack(images, axis=0).astype(np.int_)
|
||||
array: Array = np.stack(images, axis=0).astype( # type: ignore[type-arg]
|
||||
np.int_
|
||||
)
|
||||
tensor: Tensor = torch.from_numpy(array) # type: ignore[attr-defined]
|
||||
return tensor
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче