mirror of
https://git.anonymousland.org/anonymousland/synapse-product.git
synced 2025-08-03 18:54:13 -04:00
Replace all remaining six usage with native Python 3 equivalents (#7704)
This commit is contained in:
parent
98c4e35e3c
commit
a3f11567d9
73 changed files with 111 additions and 237 deletions
|
@ -19,9 +19,9 @@
|
|||
"""Tests REST events for /rooms paths."""
|
||||
|
||||
import json
|
||||
from urllib import parse as urlparse
|
||||
|
||||
from mock import Mock
|
||||
from six.moves.urllib import parse as urlparse
|
||||
|
||||
from twisted.internet import defer
|
||||
|
||||
|
|
|
@ -15,8 +15,7 @@
|
|||
|
||||
import itertools
|
||||
import json
|
||||
|
||||
import six
|
||||
import urllib
|
||||
|
||||
from synapse.api.constants import EventTypes, RelationTypes
|
||||
from synapse.rest import admin
|
||||
|
@ -134,7 +133,7 @@ class RelationsTestCase(unittest.HomeserverTestCase):
|
|||
# Make sure next_batch has something in it that looks like it could be a
|
||||
# valid token.
|
||||
self.assertIsInstance(
|
||||
channel.json_body.get("next_batch"), six.string_types, channel.json_body
|
||||
channel.json_body.get("next_batch"), str, channel.json_body
|
||||
)
|
||||
|
||||
def test_repeated_paginate_relations(self):
|
||||
|
@ -278,7 +277,7 @@ class RelationsTestCase(unittest.HomeserverTestCase):
|
|||
|
||||
prev_token = None
|
||||
found_event_ids = []
|
||||
encoded_key = six.moves.urllib.parse.quote_plus("👍".encode("utf-8"))
|
||||
encoded_key = urllib.parse.quote_plus("👍".encode("utf-8"))
|
||||
for _ in range(20):
|
||||
from_token = ""
|
||||
if prev_token:
|
||||
|
@ -670,7 +669,7 @@ class RelationsTestCase(unittest.HomeserverTestCase):
|
|||
|
||||
query = ""
|
||||
if key:
|
||||
query = "?key=" + six.moves.urllib.parse.quote_plus(key.encode("utf-8"))
|
||||
query = "?key=" + urllib.parse.quote_plus(key.encode("utf-8"))
|
||||
|
||||
original_id = parent_id if parent_id else self.parent_id
|
||||
|
||||
|
|
|
@ -20,9 +20,9 @@ import tempfile
|
|||
from binascii import unhexlify
|
||||
from io import BytesIO
|
||||
from typing import Optional
|
||||
from urllib import parse
|
||||
|
||||
from mock import Mock
|
||||
from six.moves.urllib import parse
|
||||
|
||||
import attr
|
||||
import PIL.Image as Image
|
||||
|
|
|
@ -2,8 +2,6 @@ import json
|
|||
import logging
|
||||
from io import BytesIO
|
||||
|
||||
from six import text_type
|
||||
|
||||
import attr
|
||||
from zope.interface import implementer
|
||||
|
||||
|
@ -174,7 +172,7 @@ def make_request(
|
|||
if not path.startswith(b"/"):
|
||||
path = b"/" + path
|
||||
|
||||
if isinstance(content, text_type):
|
||||
if isinstance(content, str):
|
||||
content = content.encode("utf8")
|
||||
|
||||
site = FakeSite()
|
||||
|
|
|
@ -15,8 +15,6 @@
|
|||
|
||||
import itertools
|
||||
|
||||
from six.moves import zip
|
||||
|
||||
import attr
|
||||
|
||||
from synapse.api.constants import EventTypes, JoinRules, Membership
|
||||
|
|
|
@ -14,8 +14,7 @@
|
|||
|
||||
import logging
|
||||
import re
|
||||
|
||||
from six import StringIO
|
||||
from io import StringIO
|
||||
|
||||
from twisted.internet.defer import Deferred
|
||||
from twisted.python.failure import Failure
|
||||
|
|
|
@ -14,7 +14,6 @@
|
|||
|
||||
import json
|
||||
|
||||
import six
|
||||
from mock import Mock
|
||||
|
||||
from twisted.test.proto_helpers import MemoryReactorClock
|
||||
|
@ -60,7 +59,7 @@ class TermsTestCase(unittest.HomeserverTestCase):
|
|||
self.assertEquals(channel.result["code"], b"401", channel.result)
|
||||
|
||||
self.assertTrue(channel.json_body is not None)
|
||||
self.assertIsInstance(channel.json_body["session"], six.text_type)
|
||||
self.assertIsInstance(channel.json_body["session"], str)
|
||||
|
||||
self.assertIsInstance(channel.json_body["flows"], list)
|
||||
for flow in channel.json_body["flows"]:
|
||||
|
@ -125,6 +124,6 @@ class TermsTestCase(unittest.HomeserverTestCase):
|
|||
self.assertEquals(channel.result["code"], b"200", channel.result)
|
||||
|
||||
self.assertTrue(channel.json_body is not None)
|
||||
self.assertIsInstance(channel.json_body["user_id"], six.text_type)
|
||||
self.assertIsInstance(channel.json_body["access_token"], six.text_type)
|
||||
self.assertIsInstance(channel.json_body["device_id"], six.text_type)
|
||||
self.assertIsInstance(channel.json_body["user_id"], str)
|
||||
self.assertIsInstance(channel.json_body["access_token"], str)
|
||||
self.assertIsInstance(channel.json_body["device_id"], str)
|
||||
|
|
|
@ -15,9 +15,9 @@
|
|||
|
||||
|
||||
import threading
|
||||
from io import StringIO
|
||||
|
||||
from mock import NonCallableMock
|
||||
from six import StringIO
|
||||
|
||||
from twisted.internet import defer, reactor
|
||||
|
||||
|
|
|
@ -14,8 +14,6 @@
|
|||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
from six.moves import range
|
||||
|
||||
from twisted.internet import defer, reactor
|
||||
from twisted.internet.defer import CancelledError
|
||||
|
||||
|
|
|
@ -21,9 +21,9 @@ import time
|
|||
import uuid
|
||||
import warnings
|
||||
from inspect import getcallargs
|
||||
from urllib import parse as urlparse
|
||||
|
||||
from mock import Mock, patch
|
||||
from six.moves.urllib import parse as urlparse
|
||||
|
||||
from twisted.internet import defer, reactor
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue