diff options
author | exprmntr <exprmntr@yandex-team.ru> | 2022-02-10 16:46:50 +0300 |
---|---|---|
committer | Daniil Cherednik <dcherednik@yandex-team.ru> | 2022-02-10 16:46:50 +0300 |
commit | a6396ea4e82c2605dcf9a11ebc4c289d0b1c734c (patch) | |
tree | 49e222ea1c5804306084bb3ae065bb702625360f /library/python/testing/yatest_lib/tools.py | |
parent | 078ddb2fb76387cae14e8c3ceb5a896009a5a539 (diff) | |
download | ydb-a6396ea4e82c2605dcf9a11ebc4c289d0b1c734c.tar.gz |
Restoring authorship annotation for exprmntr <exprmntr@yandex-team.ru>. Commit 2 of 2.
Diffstat (limited to 'library/python/testing/yatest_lib/tools.py')
-rw-r--r-- | library/python/testing/yatest_lib/tools.py | 32 |
1 files changed, 16 insertions, 16 deletions
diff --git a/library/python/testing/yatest_lib/tools.py b/library/python/testing/yatest_lib/tools.py index 985124fbba..b72d79c162 100644 --- a/library/python/testing/yatest_lib/tools.py +++ b/library/python/testing/yatest_lib/tools.py @@ -1,21 +1,21 @@ import six -import sys +import sys + - def to_utf8(value): """ Converts value to string encoded into utf-8 :param value: :return: """ - if sys.version_info[0] < 3: - if not isinstance(value, basestring): # noqa - value = unicode(value) # noqa - if type(value) == str: - value = value.decode("utf-8", errors="ignore") - return value.encode('utf-8', 'ignore') - else: - return str(value) + if sys.version_info[0] < 3: + if not isinstance(value, basestring): # noqa + value = unicode(value) # noqa + if type(value) == str: + value = value.decode("utf-8", errors="ignore") + return value.encode('utf-8', 'ignore') + else: + return str(value) def trim_string(s, max_bytes): @@ -56,9 +56,9 @@ def _trim_unicode_string(s, max_bytes): result.append(ch) return ''.join(result) - - -def to_str(s): - if six.PY2 and isinstance(s, six.text_type): - return s.encode('utf8') - return s + + +def to_str(s): + if six.PY2 and isinstance(s, six.text_type): + return s.encode('utf8') + return s |