Fixed mypy

This commit is contained in:
Alex Root Junior 2023-04-22 19:54:56 +03:00
parent c9a8dad5ee
commit dad3cdc409
No known key found for this signature in database
GPG key ID: 074C1D455EBEA4AC

View file

@ -4,7 +4,7 @@ from typing import Any, Awaitable, Callable, Dict, Optional, Set, cast
try: try:
from babel import Locale, UnknownLocaleError from babel import Locale, UnknownLocaleError
except ImportError: # pragma: no cover except ImportError: # pragma: no cover
Locale = None Locale = None # type: ignore
class UnknownLocaleError(Exception): # type: ignore class UnknownLocaleError(Exception): # type: ignore
pass pass
@ -127,7 +127,7 @@ class SimpleI18nMiddleware(I18nMiddleware):
if locale.language not in self.i18n.available_locales: if locale.language not in self.i18n.available_locales:
return self.i18n.default_locale return self.i18n.default_locale
return cast(str, locale.language) return locale.language
class ConstI18nMiddleware(I18nMiddleware): class ConstI18nMiddleware(I18nMiddleware):