aboutsummaryrefslogtreecommitdiff
path: root/src/utils/__init__.py
diff options
context:
space:
mode:
authorGravatar jesopo2019-02-23 21:33:04 +0000
committerGravatar jesopo2019-02-23 21:33:04 +0000
commit8c94bcf6caf0ae88b3a67d0a73389a7e60810e1c (patch)
tree8d72b0760aef71da12403696e9acd387d288e4e0 /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__.py13
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