From 09961b69c61f471ddd594e0fd877df62a8021562 Mon Sep 17 00:00:00 2001
From: sobols <sobols@yandex-team.ru>
Date: Thu, 10 Feb 2022 16:47:08 +0300
Subject: Restoring authorship annotation for <sobols@yandex-team.ru>. Commit 1
 of 2.

---
 library/python/testing/yatest_lib/tools.py | 82 +++++++++++++++---------------
 1 file changed, 41 insertions(+), 41 deletions(-)

(limited to 'library/python/testing/yatest_lib/tools.py')

diff --git a/library/python/testing/yatest_lib/tools.py b/library/python/testing/yatest_lib/tools.py
index b72d79c162..0cf2ce87c8 100644
--- a/library/python/testing/yatest_lib/tools.py
+++ b/library/python/testing/yatest_lib/tools.py
@@ -1,4 +1,4 @@
-import six
+import six 
 import sys
 
 
@@ -16,46 +16,46 @@ def to_utf8(value):
         return value.encode('utf-8', 'ignore')
     else:
         return str(value)
-
-
-def trim_string(s, max_bytes):
-    """
-    Adjusts the length of the string s in order to fit it
-    into max_bytes bytes of storage after encoding as UTF-8.
-    Useful when cutting filesystem paths.
-    :param s: unicode string
-    :param max_bytes: number of bytes
-    :return the prefix of s
-    """
-    if isinstance(s, six.text_type):
-        return _trim_unicode_string(s, max_bytes)
-
-    if isinstance(s, six.binary_type):
-        if len(s) <= max_bytes:
-            return s
-        s = s.decode('utf-8', errors='ignore')
-        s = _trim_unicode_string(s, max_bytes)
-        s = s.encode('utf-8', errors='ignore')
-        return s
-
-    raise TypeError('a string is expected')
-
-
-def _trim_unicode_string(s, max_bytes):
-    if len(s) * 4 <= max_bytes:
-        # UTF-8 uses at most 4 bytes per character
-        return s
-
-    result = []
-    cur_byte_length = 0
-
-    for ch in s:
-        cur_byte_length += len(ch.encode('utf-8'))
-        if cur_byte_length > max_bytes:
-            break
-        result.append(ch)
-
-    return ''.join(result)
+ 
+ 
+def trim_string(s, max_bytes): 
+    """ 
+    Adjusts the length of the string s in order to fit it 
+    into max_bytes bytes of storage after encoding as UTF-8. 
+    Useful when cutting filesystem paths. 
+    :param s: unicode string 
+    :param max_bytes: number of bytes 
+    :return the prefix of s 
+    """ 
+    if isinstance(s, six.text_type): 
+        return _trim_unicode_string(s, max_bytes) 
+ 
+    if isinstance(s, six.binary_type): 
+        if len(s) <= max_bytes: 
+            return s 
+        s = s.decode('utf-8', errors='ignore') 
+        s = _trim_unicode_string(s, max_bytes) 
+        s = s.encode('utf-8', errors='ignore') 
+        return s 
+ 
+    raise TypeError('a string is expected') 
+ 
+ 
+def _trim_unicode_string(s, max_bytes): 
+    if len(s) * 4 <= max_bytes: 
+        # UTF-8 uses at most 4 bytes per character 
+        return s 
+ 
+    result = [] 
+    cur_byte_length = 0 
+ 
+    for ch in s: 
+        cur_byte_length += len(ch.encode('utf-8')) 
+        if cur_byte_length > max_bytes: 
+            break 
+        result.append(ch) 
+ 
+    return ''.join(result) 
 
 
 def to_str(s):
-- 
cgit v1.2.3