1 files changed, 1 insertions, 19 deletions
diff --git a/synapse/util/stringutils.py b/synapse/util/stringutils.py
index 2cfa5cf721..81a44184ca 100644
--- a/synapse/util/stringutils.py
+++ b/synapse/util/stringutils.py
@@ -19,8 +19,7 @@ import re
import string
from collections import Iterable
-import six
-from six import PY2, PY3
+from six import PY3
from six.moves import range
from synapse.api.errors import Codes, SynapseError
@@ -68,23 +67,6 @@ def is_ascii(s):
return True
-def to_ascii(s):
- """Converts a string to ascii if it is ascii, otherwise leave it alone.
-
- If given None then will return None.
- """
- if PY3:
- return s
-
- if s is None:
- return None
-
- try:
- return s.encode("ascii")
- except UnicodeEncodeError:
- return s
-
-
def assert_valid_client_secret(client_secret):
"""Validate that a given string matches the client_secret regex defined by the spec"""
if client_secret_regex.match(client_secret) is None:
|