summary refs log tree commit diff
path: root/synapse/util
diff options
context:
space:
mode:
authorRichard van der Hoff <richard@matrix.org>2020-05-15 19:12:03 +0100
committerRichard van der Hoff <richard@matrix.org>2020-05-15 19:12:03 +0100
commit65902e08c3f4449de9baa4e6466f126585f688b3 (patch)
tree95688597fe43e44cd603e1ffe955bf97a80b801d /synapse/util
parentRemove `exception_to_unicode` (diff)
downloadsynapse-65902e08c3f4449de9baa4e6466f126585f688b3.tar.xz
remove to_ascii
this is a no-op on python 3.
Diffstat (limited to 'synapse/util')
-rw-r--r--synapse/util/stringutils.py20
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: