mirror of
https://git.anonymousland.org/anonymousland/synapse.git
synced 2024-10-01 11:49:51 -04:00
Fix deprecation warning: import ABC from collections.abc (#7892)
This commit is contained in:
parent
5ecf98f59e
commit
a7b06a81f0
1
changelog.d/7892.misc
Normal file
1
changelog.d/7892.misc
Normal file
@ -0,0 +1 @@
|
|||||||
|
Import ABC from `collections.abc` for Python 3.10 compatibility.
|
@ -12,7 +12,7 @@
|
|||||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
# See the License for the specific language governing permissions and
|
# See the License for the specific language governing permissions and
|
||||||
# limitations under the License.
|
# limitations under the License.
|
||||||
import collections
|
import collections.abc
|
||||||
import re
|
import re
|
||||||
from typing import Any, Mapping, Union
|
from typing import Any, Mapping, Union
|
||||||
|
|
||||||
@ -424,7 +424,7 @@ def copy_power_levels_contents(
|
|||||||
Raises:
|
Raises:
|
||||||
TypeError if the input does not look like a valid power levels event content
|
TypeError if the input does not look like a valid power levels event content
|
||||||
"""
|
"""
|
||||||
if not isinstance(old_power_levels, collections.Mapping):
|
if not isinstance(old_power_levels, collections.abc.Mapping):
|
||||||
raise TypeError("Not a valid power-levels content: %r" % (old_power_levels,))
|
raise TypeError("Not a valid power-levels content: %r" % (old_power_levels,))
|
||||||
|
|
||||||
power_levels = {}
|
power_levels = {}
|
||||||
@ -434,7 +434,7 @@ def copy_power_levels_contents(
|
|||||||
power_levels[k] = v
|
power_levels[k] = v
|
||||||
continue
|
continue
|
||||||
|
|
||||||
if isinstance(v, collections.Mapping):
|
if isinstance(v, collections.abc.Mapping):
|
||||||
power_levels[k] = h = {}
|
power_levels[k] = h = {}
|
||||||
for k1, v1 in v.items():
|
for k1, v1 in v.items():
|
||||||
# we should only have one level of nesting
|
# we should only have one level of nesting
|
||||||
|
@ -19,7 +19,7 @@
|
|||||||
|
|
||||||
import itertools
|
import itertools
|
||||||
import logging
|
import logging
|
||||||
from collections import Container
|
from collections.abc import Container
|
||||||
from http import HTTPStatus
|
from http import HTTPStatus
|
||||||
from typing import Dict, Iterable, List, Optional, Sequence, Tuple, Union
|
from typing import Dict, Iterable, List, Optional, Sequence, Tuple, Union
|
||||||
|
|
||||||
|
@ -14,7 +14,7 @@
|
|||||||
# See the License for the specific language governing permissions and
|
# See the License for the specific language governing permissions and
|
||||||
# limitations under the License.
|
# limitations under the License.
|
||||||
import heapq
|
import heapq
|
||||||
from collections import Iterable
|
from collections.abc import Iterable
|
||||||
from typing import List, Tuple, Type
|
from typing import List, Tuple, Type
|
||||||
|
|
||||||
import attr
|
import attr
|
||||||
|
@ -17,7 +17,7 @@ import itertools
|
|||||||
import random
|
import random
|
||||||
import re
|
import re
|
||||||
import string
|
import string
|
||||||
from collections import Iterable
|
from collections.abc import Iterable
|
||||||
|
|
||||||
from synapse.api.errors import Codes, SynapseError
|
from synapse.api.errors import Codes, SynapseError
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user