Tribler/py-ipv8

Replace deprecated typing versions of standard collections

qstokkink opened this issue · 1 comments

The typing versions of standard collections are deprecated since Python 3.9 (see https://docs.python.org/3/library/typing.html#deprecation-timeline-of-major-features) and these should be replaced with their actual class type:

  • tuple instead of typing.Tuple
  • list instead of typing.List
  • dict instead of typing.Dict
  • set instead of typing.Set
  • frozenset instead of typing.FrozenSet
  • type instead of typing.Type
  • contextlib.AbstractContextManager instead of typing.ContextManager
  • contextlib.AbstractAsyncContextManager instead of typing.AsyncContextManager
  • re.Pattern instead of typing.Pattern and typing.re.Pattern
  • re.Match instead of typing.Match and typing.re.Match

This substitution will require from __future__ import annotations for older versions of Python.

I'll give this low priority, since no removal of these deprecated types is planned in any Python version yet.

set instead of typing.Set

This does not work with from __future__ import annotations.