From d7745674dca97c674758d64559751636cf43c3de Mon Sep 17 00:00:00 2001 From: Anders Kaseorg Date: Sat, 4 Jul 2020 18:00:50 -0700 Subject: [PATCH] zthumbor: Fix strict_optional errors. Signed-off-by: Anders Kaseorg --- mypy.ini | 14 +------------- zthumbor/loaders/helpers.py | 1 + 2 files changed, 2 insertions(+), 13 deletions(-) diff --git a/mypy.ini b/mypy.ini index eb93645605..b6ebfb5cd6 100644 --- a/mypy.ini +++ b/mypy.ini @@ -12,6 +12,7 @@ check_untyped_defs = True disallow_untyped_defs = True disallow_any_generics = True warn_no_return = True +strict_optional = True no_implicit_optional = True warn_redundant_casts = True warn_unused_ignores = True @@ -29,16 +30,3 @@ ignore_missing_imports = True # Warn of unreachable or redundant code. warn_unreachable = True - -# -# -# STRICT OPTIONAL -# -# - -strict_optional = True - -# General exclusions to work on - -[mypy-zthumbor.loaders.helpers] -strict_optional = False diff --git a/zthumbor/loaders/helpers.py b/zthumbor/loaders/helpers.py index b595256dec..d85bb802e5 100644 --- a/zthumbor/loaders/helpers.py +++ b/zthumbor/loaders/helpers.py @@ -44,4 +44,5 @@ def separate_url_and_source_type(url): # type: (Text) -> Tuple[Text, Text] THUMBNAIL_URL_PATT = re.compile('^(?P.+)/source_type/(?P.+)') matches = THUMBNAIL_URL_PATT.match(url) + assert matches is not None return (matches.group('source_type'), matches.group('actual_url'))