Replace all remaining six usage with native Python 3 equivalents (#7704)

This commit is contained in:
Dagfinn Ilmari Mannsåker 2020-06-16 13:51:47 +01:00 committed by GitHub
parent 98c4e35e3c
commit a3f11567d9
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
73 changed files with 111 additions and 237 deletions

View file

@ -19,8 +19,6 @@ import logging
from contextlib import contextmanager
from typing import Dict, Sequence, Set, Union
from six.moves import range
import attr
from twisted.internet import defer

View file

@ -17,8 +17,6 @@ import logging
import math
from typing import Dict, FrozenSet, List, Mapping, Optional, Set, Union
from six import integer_types
from sortedcontainers import SortedDict
from synapse.types import Collection
@ -88,7 +86,7 @@ class StreamChangeCache:
def has_entity_changed(self, entity: EntityType, stream_pos: int) -> bool:
"""Returns True if the entity may have been updated since stream_pos
"""
assert type(stream_pos) in integer_types
assert isinstance(stream_pos, int)
if stream_pos < self._earliest_known_stream_pos:
self.metrics.inc_misses()

View file

@ -13,7 +13,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
from six.moves import queue
import queue
from twisted.internet import threads

View file

@ -13,8 +13,6 @@
# See the License for the specific language governing permissions and
# limitations under the License.
from six import binary_type, text_type
from canonicaljson import json
from frozendict import frozendict
@ -26,7 +24,7 @@ def freeze(o):
if isinstance(o, frozendict):
return o
if isinstance(o, (binary_type, text_type)):
if isinstance(o, (bytes, str)):
return o
try:
@ -41,7 +39,7 @@ def unfreeze(o):
if isinstance(o, (dict, frozendict)):
return dict({k: unfreeze(v) for k, v in o.items()})
if isinstance(o, (binary_type, text_type)):
if isinstance(o, (bytes, str)):
return o
try:

View file

@ -13,8 +13,6 @@
# See the License for the specific language governing permissions and
# limitations under the License.
from six.moves import range
class _Entry(object):
__slots__ = ["end_key", "queue"]