Use projects' own type annotations, stubs no longer needed

This commit is contained in:
Oleh Prypin
2023-11-01 23:23:54 +01:00
parent 0bf4963090
commit 0a4f3240d1
2 changed files with 7 additions and 5 deletions

View File

@@ -49,9 +49,9 @@ def install_translations(
env.add_extension('jinja2.ext.i18n')
translations = _get_merged_translations(theme_dirs, 'locales', locale)
if translations is not None:
env.install_gettext_translations(translations)
env.install_gettext_translations(translations) # type: ignore[attr-defined]
else:
env.install_null_translations()
env.install_null_translations() # type: ignore[attr-defined]
if locale.language != 'en':
log.warning(
f"No translations could be found for the locale '{locale}'. "
@@ -60,7 +60,7 @@ def install_translations(
else: # pragma: no cover
# no babel installed, add dummy support for trans/endtrans blocks
env.add_extension(NoBabelExtension)
env.install_null_translations()
env.install_null_translations() # type: ignore[attr-defined]
def _get_merged_translations(
@@ -80,6 +80,8 @@ def _get_merged_translations(
if type(translations) is NullTranslations:
log.debug(f"No translations found here: '{dirname}'")
continue
if TYPE_CHECKING:
assert isinstance(translations, Translations)
log.debug(f"Translations found here: '{dirname}'")
if merged_translations is None:

View File

@@ -150,9 +150,9 @@ matrix.type.features = [
[tool.hatch.envs.types]
dependencies = [
"mypy",
"types-babel",
"types-Jinja2",
"babel",
"types-Markdown",
"types-pytz",
"types-PyYAML",
"types-setuptools",
"typing-extensions",