tests: Moar mypy

This commit is contained in:
Alexandre Aubin 2021-09-19 00:34:57 +02:00
parent 6a2ae5630b
commit 69818bd850

View file

@ -246,7 +246,7 @@ class Moulinette18n(object):
for n in self._namespaces.values(): for n in self._namespaces.values():
n.set_locale(locale) n.set_locale(locale)
def g(self, key, *args, **kwargs): def g(self, key: str, *args, **kwargs) -> str:
"""Retrieve proper translation for a moulinette key """Retrieve proper translation for a moulinette key
Attempt to retrieve value for a key from moulinette translations Attempt to retrieve value for a key from moulinette translations
@ -258,7 +258,7 @@ class Moulinette18n(object):
""" """
return self._global.translate(key, *args, **kwargs) return self._global.translate(key, *args, **kwargs)
def n(self, key, *args, **kwargs): def n(self, key: str, *args, **kwargs) -> str:
"""Retrieve proper translation for a moulinette key """Retrieve proper translation for a moulinette key
Attempt to retrieve value for a key from current loaded namespace Attempt to retrieve value for a key from current loaded namespace
@ -271,7 +271,7 @@ class Moulinette18n(object):
""" """
return self._namespaces[self._current_namespace].translate(key, *args, **kwargs) return self._namespaces[self._current_namespace].translate(key, *args, **kwargs)
def key_exists(self, key): def key_exists(self, key: str) -> bool:
"""Check if a key exists in the translation files """Check if a key exists in the translation files
Keyword arguments: Keyword arguments:
@ -298,7 +298,7 @@ class MoulinetteError(Exception):
super(MoulinetteError, self).__init__(msg) super(MoulinetteError, self).__init__(msg)
self.strerror = msg self.strerror = msg
def content(self): def content(self) -> str:
return self.strerror return self.strerror