mirror of
https://git.anonymousland.org/anonymousland/synapse.git
synced 2025-05-02 20:14:53 -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
|
@ -14,10 +14,9 @@
|
|||
# limitations under the License.
|
||||
import itertools
|
||||
import logging
|
||||
from queue import Empty, PriorityQueue
|
||||
from typing import Dict, List, Optional, Set, Tuple
|
||||
|
||||
from six.moves.queue import Empty, PriorityQueue
|
||||
|
||||
from twisted.internet import defer
|
||||
|
||||
from synapse.api.errors import StoreError
|
||||
|
|
|
@ -21,9 +21,6 @@ from collections import OrderedDict, namedtuple
|
|||
from functools import wraps
|
||||
from typing import TYPE_CHECKING, Dict, Iterable, List, Tuple
|
||||
|
||||
from six import integer_types, text_type
|
||||
from six.moves import range
|
||||
|
||||
import attr
|
||||
from canonicaljson import json
|
||||
from prometheus_client import Counter
|
||||
|
@ -893,8 +890,7 @@ class PersistEventsStore:
|
|||
"received_ts": self._clock.time_msec(),
|
||||
"sender": event.sender,
|
||||
"contains_url": (
|
||||
"url" in event.content
|
||||
and isinstance(event.content["url"], text_type)
|
||||
"url" in event.content and isinstance(event.content["url"], str)
|
||||
),
|
||||
}
|
||||
for event, _ in events_and_contexts
|
||||
|
@ -1345,10 +1341,10 @@ class PersistEventsStore:
|
|||
):
|
||||
if (
|
||||
"min_lifetime" in event.content
|
||||
and not isinstance(event.content.get("min_lifetime"), integer_types)
|
||||
and not isinstance(event.content.get("min_lifetime"), int)
|
||||
) or (
|
||||
"max_lifetime" in event.content
|
||||
and not isinstance(event.content.get("max_lifetime"), integer_types)
|
||||
and not isinstance(event.content.get("max_lifetime"), int)
|
||||
):
|
||||
# Ignore the event if one of the value isn't an integer.
|
||||
return
|
||||
|
|
|
@ -15,8 +15,6 @@
|
|||
|
||||
import logging
|
||||
|
||||
from six import text_type
|
||||
|
||||
from canonicaljson import json
|
||||
|
||||
from twisted.internet import defer
|
||||
|
@ -133,7 +131,7 @@ class EventsBackgroundUpdatesStore(SQLBaseStore):
|
|||
|
||||
contains_url = "url" in content
|
||||
if contains_url:
|
||||
contains_url &= isinstance(content["url"], text_type)
|
||||
contains_url &= isinstance(content["url"], str)
|
||||
except (KeyError, AttributeError):
|
||||
# If the event is missing a necessary field then
|
||||
# skip over it.
|
||||
|
|
|
@ -13,8 +13,6 @@
|
|||
# limitations under the License.
|
||||
import logging
|
||||
|
||||
from six.moves import range
|
||||
|
||||
from synapse.config.appservice import load_appservices
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
|
|
@ -17,8 +17,6 @@ import logging
|
|||
import re
|
||||
from collections import namedtuple
|
||||
|
||||
from six import string_types
|
||||
|
||||
from canonicaljson import json
|
||||
|
||||
from twisted.internet import defer
|
||||
|
@ -180,7 +178,7 @@ class SearchBackgroundUpdateStore(SearchWorkerStore):
|
|||
# skip over it.
|
||||
continue
|
||||
|
||||
if not isinstance(value, string_types):
|
||||
if not isinstance(value, str):
|
||||
# If the event body, name or topic isn't a string
|
||||
# then skip over it
|
||||
continue
|
||||
|
|
|
@ -40,8 +40,6 @@ import abc
|
|||
import logging
|
||||
from collections import namedtuple
|
||||
|
||||
from six.moves import range
|
||||
|
||||
from twisted.internet import defer
|
||||
|
||||
from synapse.logging.context import make_deferred_yieldable, run_in_background
|
||||
|
|
|
@ -16,8 +16,6 @@
|
|||
|
||||
import logging
|
||||
|
||||
from six.moves import range
|
||||
|
||||
from canonicaljson import json
|
||||
|
||||
from twisted.internet import defer
|
||||
|
|
|
@ -17,8 +17,6 @@ import logging
|
|||
from collections import namedtuple
|
||||
from typing import Dict, Iterable, List, Set, Tuple
|
||||
|
||||
from six.moves import range
|
||||
|
||||
from twisted.internet import defer
|
||||
|
||||
from synapse.api.constants import EventTypes
|
||||
|
|
|
@ -16,6 +16,7 @@
|
|||
# limitations under the License.
|
||||
import logging
|
||||
import time
|
||||
from sys import intern
|
||||
from time import monotonic as monotonic_time
|
||||
from typing import (
|
||||
Any,
|
||||
|
@ -29,8 +30,6 @@ from typing import (
|
|||
TypeVar,
|
||||
)
|
||||
|
||||
from six.moves import intern, range
|
||||
|
||||
from prometheus_client import Histogram
|
||||
|
||||
from twisted.enterprise import adbapi
|
||||
|
|
|
@ -20,8 +20,6 @@ import logging
|
|||
from collections import deque, namedtuple
|
||||
from typing import Iterable, List, Optional, Set, Tuple
|
||||
|
||||
from six.moves import range
|
||||
|
||||
from prometheus_client import Counter, Histogram
|
||||
|
||||
from twisted.internet import defer
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue