diff options
Diffstat (limited to 'src/utils/__init__.py')
| -rw-r--r-- | src/utils/__init__.py | 13 |
1 files changed, 0 insertions, 13 deletions
diff --git a/src/utils/__init__.py b/src/utils/__init__.py index 90f3e6ba..609b0eaa 100644 --- a/src/utils/__init__.py +++ b/src/utils/__init__.py @@ -199,16 +199,3 @@ def is_ip(s: str) -> bool: except ValueError: return False return True - -def encode_truncate(s: str, encoding: str, byte_max: int - ) -> typing.Tuple[bytes, str]: - encoded = b"" - truncated = "" - for i, character in enumerate(s): - encoded_character = character.encode(encoding) - if len(encoded + encoded_character) > byte_max: - truncated = s[i:] - break - else: - encoded += encoded_character - return encoded, truncated |
