Skip to content
This repository has been archived by the owner on Apr 26, 2024. It is now read-only.

Importing ABC directly from collections will be removed in Python 3.10 #7891

Closed
tirkarthi opened this issue Jul 18, 2020 · 3 comments · Fixed by #7892
Closed

Importing ABC directly from collections will be removed in Python 3.10 #7891

tirkarthi opened this issue Jul 18, 2020 · 3 comments · Fixed by #7892

Comments

@tirkarthi
Copy link
Contributor

Description

Importing ABC directly from collections will be removed in Python 3.10. Use collections.abc instead.

synapse/replication/tcp/streams/events.py
17:from collections import Iterable

synapse/events/utils.py
427:    if not isinstance(old_power_levels, collections.Mapping):
437:        if isinstance(v, collections.Mapping):

synapse/util/stringutils.py
20:from collections import Iterable

synapse/handlers/federation.py
22:from collections import Container
@anoadragon453
Copy link
Member

Good spot, thanks. Curious if you're using pyupgrade, as you mentioned in another issue, to spot these?

@tirkarthi
Copy link
Contributor Author

No, I am using a custom regex here to find all instances and fix them manually. Pyupgrade doesn't support fixing these.

@tirkarthi
Copy link
Contributor Author

The command is as below with rg being ripgrep :

rg  -t py -i 'time.clock|encodestring|decodestring|celementtree|collections.*(Awaitable|Coroutine|AsyncIterable|AsyncIterator|AsyncGenerator|Hashable|Iterable|Iterator|Generator|Reversible|Sized|Container|Callable|Collection|Set|MutableSet|Mapping|MutableMapping|MappingView|KeysView|ItemsView|ValuesView|Sequence|MutableSequence|ByteString)|asyncio.?coroutine|isAlive|readfp'

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants