diff options
| author | 2019-02-23 21:33:04 +0000 | |
|---|---|---|
| committer | 2019-02-23 21:33:04 +0000 | |
| commit | 8c94bcf6caf0ae88b3a67d0a73389a7e60810e1c (patch) | |
| tree | 8d72b0760aef71da12403696e9acd387d288e4e0 /src/utils/__init__.py | |
| parent | !raw needs to parse the line it's given in to an IRCParsedLine now (diff) | |
| signature | ||
Move utils.irc.IRCParsedLine to IRCLine.ParsedLine, improve truncation
mechanism, don't convert sent line from ParsedLine to text to ParsedLine for
line_handler handling
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 |
