mirror of
https://github.com/mkdocs/mkdocs.git
synced 2026-03-27 09:58:31 +07:00
Use projects' own type annotations, stubs no longer needed
This commit is contained in:
@@ -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:
|
||||
|
||||
@@ -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",
|
||||
|
||||
Reference in New Issue
Block a user