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 | 078ddb2fb76387cae14e8c3ceb5a896009a5a539 (patch) | |
tree | dda2d61bf8f818c76b5602b79366b5fcbcf2e479 /library/python/testing/yatest_lib/tools.py | |
parent | 5085152b94bf621933243a498def7f37d2e76b58 (diff) | |
download | ydb-078ddb2fb76387cae14e8c3ceb5a896009a5a539.tar.gz |
Restoring authorship annotation for exprmntr <exprmntr@yandex-team.ru>. Commit 1 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 b72d79c162..985124fbba 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 |