diff options
author | orlovgb <orlovgb@yandex-team.ru> | 2022-02-10 16:48:20 +0300 |
---|---|---|
committer | Daniil Cherednik <dcherednik@yandex-team.ru> | 2022-02-10 16:48:20 +0300 |
commit | 805923d9caf5cf5b7fd5f4aa268f783503260d62 (patch) | |
tree | 5d5cb817648f650d76cf1076100726fd9b8448e8 /contrib/tools/python3/src | |
parent | 0315e42217b6a79d49980d6139c0e487cab2426f (diff) | |
download | ydb-805923d9caf5cf5b7fd5f4aa268f783503260d62.tar.gz |
Restoring authorship annotation for <orlovgb@yandex-team.ru>. Commit 2 of 2.
Diffstat (limited to 'contrib/tools/python3/src')
-rw-r--r-- | contrib/tools/python3/src/Lib/gettext.py | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/contrib/tools/python3/src/Lib/gettext.py b/contrib/tools/python3/src/Lib/gettext.py index 41c86fbf11..9df74c91f0 100644 --- a/contrib/tools/python3/src/Lib/gettext.py +++ b/contrib/tools/python3/src/Lib/gettext.py @@ -49,12 +49,12 @@ internationalized, to the local language and cultural habits. import os import re import sys -import io +import io -try: - import __res -except ImportError: - __res = None +try: + import __res +except ImportError: + __res = None __all__ = ['NullTranslations', 'GNUTranslations', 'Catalog', 'find', 'translation', 'install', 'textdomain', 'bindtextdomain', @@ -572,7 +572,7 @@ def find(domain, localedir=None, languages=None, all=False): if lang == 'C': break mofile = os.path.join(localedir, lang, 'LC_MESSAGES', '%s.mo' % domain) - if __res and __res.resfs_src(mofile.encode('utf-8'), resfs_file=True) or os.path.exists(mofile): + if __res and __res.resfs_src(mofile.encode('utf-8'), resfs_file=True) or os.path.exists(mofile): if all: result.append(mofile) else: @@ -603,12 +603,12 @@ def translation(domain, localedir=None, languages=None, key = (class_, os.path.abspath(mofile)) t = _translations.get(key) if t is None: - mores = __res and __res.resfs_read(mofile.encode('utf-8')) - if mores: - t = _translations.setdefault(key, class_(io.BytesIO(mores))) - else: - with open(mofile, 'rb') as fp: - t = _translations.setdefault(key, class_(fp)) + mores = __res and __res.resfs_read(mofile.encode('utf-8')) + if mores: + t = _translations.setdefault(key, class_(io.BytesIO(mores))) + else: + with open(mofile, 'rb') as fp: + t = _translations.setdefault(key, class_(fp)) # Copy the translation object to allow setting fallbacks and # output charset. All other instance data is shared with the # cached object. |