From 17d1c5de7a37d6f79bd1776b4375ca7dbab0cb1f Mon Sep 17 00:00:00 2001 From: hauntsaninja Date: Fri, 12 Aug 2022 18:32:18 -0700 Subject: [PATCH 1/2] Use --no-implicit-optional for type checking This is needed for PEP 484 compliant type checking (as of 2018). mypy will change its defaults soon. See https://github.com/python/mypy/issues/9091 --- mypy.ini | 1 + torchvision/datasets/utils.py | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/mypy.ini b/mypy.ini index 6d7863b627e..d61eb402a21 100644 --- a/mypy.ini +++ b/mypy.ini @@ -5,6 +5,7 @@ show_error_codes = True pretty = True allow_redefinition = True warn_redundant_casts = True +no_implicit_optional = True [mypy-torchvision.prototype.features.*] diff --git a/torchvision/datasets/utils.py b/torchvision/datasets/utils.py index 30506b3fc79..32839163b7b 100644 --- a/torchvision/datasets/utils.py +++ b/torchvision/datasets/utils.py @@ -458,7 +458,7 @@ def iterable_to_str(iterable: Iterable) -> str: def verify_str_arg( value: T, arg: Optional[str] = None, - valid_values: Iterable[T] = None, + valid_values: Optional[Iterable[T]] = None, custom_msg: Optional[str] = None, ) -> T: if not isinstance(value, torch._six.string_classes): From a4519d74ed194b5bd3c7c1bc16d1d045962a4cea Mon Sep 17 00:00:00 2001 From: Vasilis Vryniotis Date: Mon, 15 Aug 2022 08:58:16 +0100 Subject: [PATCH 2/2] forcing CI rerun --- mypy.ini | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mypy.ini b/mypy.ini index d61eb402a21..c1d174f4595 100644 --- a/mypy.ini +++ b/mypy.ini @@ -4,8 +4,8 @@ files = torchvision show_error_codes = True pretty = True allow_redefinition = True -warn_redundant_casts = True no_implicit_optional = True +warn_redundant_casts = True [mypy-torchvision.prototype.features.*]