mirror of
https://git.anonymousland.org/anonymousland/synapse.git
synced 2025-05-04 09:14:55 -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
|
@ -24,10 +24,7 @@ import shutil
|
|||
import sys
|
||||
import traceback
|
||||
from typing import Dict, Optional
|
||||
|
||||
import six
|
||||
from six import string_types
|
||||
from six.moves import urllib_parse as urlparse
|
||||
from urllib import parse as urlparse
|
||||
|
||||
from canonicaljson import json
|
||||
|
||||
|
@ -188,7 +185,7 @@ class PreviewUrlResource(DirectServeResource):
|
|||
# It may be stored as text in the database, not as bytes (such as
|
||||
# PostgreSQL). If so, encode it back before handing it on.
|
||||
og = cache_result["og"]
|
||||
if isinstance(og, six.text_type):
|
||||
if isinstance(og, str):
|
||||
og = og.encode("utf8")
|
||||
return og
|
||||
|
||||
|
@ -631,7 +628,7 @@ def _iterate_over_text(tree, *tags_to_ignore):
|
|||
if el is None:
|
||||
return
|
||||
|
||||
if isinstance(el, string_types):
|
||||
if isinstance(el, str):
|
||||
yield el
|
||||
elif el.tag not in tags_to_ignore:
|
||||
# el.text is the text before the first child, so we can immediately
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue