From b7a67cd5220cd7c2156dfa945ddde69b39603a4d Mon Sep 17 00:00:00 2001 From: Suren Khorenyan Date: Sun, 10 Jun 2018 13:40:33 +0300 Subject: [PATCH 1/3] Babel is in requirements now --- aiogram/types/user.py | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/aiogram/types/user.py b/aiogram/types/user.py index d27f2f87..2143f06c 100644 --- a/aiogram/types/user.py +++ b/aiogram/types/user.py @@ -1,12 +1,9 @@ +import babel + from . import base from . import fields from ..utils import markdown -try: - import babel -except ImportError: - babel = None - class User(base.TelegramObject): """ @@ -51,10 +48,7 @@ class User(base.TelegramObject): This property requires `Babel `_ module :return: :class:`babel.core.Locale` - :raise: ImportError: when babel is not installed. """ - if not babel: - raise ImportError('Babel is not installed!') if not self.language_code: return None if not hasattr(self, '_locale'): From 7e601d1c8d018cbd3444e999a58ec928e888e63a Mon Sep 17 00:00:00 2001 From: Suren Khorenyan Date: Mon, 11 Jun 2018 00:28:14 +0300 Subject: [PATCH 2/3] Update docstring for the user class --- aiogram/types/user.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/aiogram/types/user.py b/aiogram/types/user.py index 2143f06c..42157039 100644 --- a/aiogram/types/user.py +++ b/aiogram/types/user.py @@ -45,7 +45,7 @@ class User(base.TelegramObject): @property def locale(self) -> 'babel.core.Locale' or None: """ - This property requires `Babel `_ module + Get user's locale :return: :class:`babel.core.Locale` """ From 3adba29c279aef3a98c2f43d236516e60d2b40cd Mon Sep 17 00:00:00 2001 From: Suren Khorenyan Date: Mon, 11 Jun 2018 00:31:26 +0300 Subject: [PATCH 3/3] Fix return typing --- aiogram/types/user.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/aiogram/types/user.py b/aiogram/types/user.py index 42157039..c4c64844 100644 --- a/aiogram/types/user.py +++ b/aiogram/types/user.py @@ -43,7 +43,7 @@ class User(base.TelegramObject): return self.full_name @property - def locale(self) -> 'babel.core.Locale' or None: + def locale(self) -> babel.core.Locale or None: """ Get user's locale