jenkins-bot submitted this change.

View Change

Approvals: Xqt: Looks good to me, approved jenkins-bot: Verified
[bugfix] Require 3.9.2 for collections.abc.Callable

Good catch by Xqt. Python 3.9.2 is required to use Callable from the
collections.abc module...

https://stackoverflow.com/a/65858574

Change-Id: I66a1d20767739df0b5032eec7f4bea906e02dcfc
---
M pywikibot/backports.py
1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/pywikibot/backports.py b/pywikibot/backports.py
index 9569b2a..43abbd4 100644
--- a/pywikibot/backports.py
+++ b/pywikibot/backports.py
@@ -63,7 +63,6 @@

if PYTHON_VERSION < (3, 9):
from typing import (
- Callable,
Dict,
FrozenSet,
Iterable,
@@ -77,7 +76,7 @@
Tuple,
)
else:
- from collections.abc import Callable, Iterable, Iterator, Mapping, Sequence
+ from collections.abc import Iterable, Iterator, Mapping, Sequence
from re import Match, Pattern
Dict = dict # type: ignore[misc]
FrozenSet = frozenset # type: ignore[misc]
@@ -86,6 +85,12 @@
Tuple = tuple # type: ignore[assignment]


+if PYTHON_VERSION < (3, 9, 2):
+ from typing import Callable
+else:
+ from collections.abc import Callable
+
+
# PEP 616 string methods
if PYTHON_VERSION >= (3, 9):
removeprefix = str.removeprefix # type: ignore[attr-defined]

To view, visit change 709124. To unsubscribe, or for help writing mail filters, visit settings.

Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Change-Id: I66a1d20767739df0b5032eec7f4bea906e02dcfc
Gerrit-Change-Number: 709124
Gerrit-PatchSet: 1
Gerrit-Owner: Damian <atagar1@gmail.com>
Gerrit-Reviewer: Xqt <info@gno.de>
Gerrit-Reviewer: jenkins-bot
Gerrit-MessageType: merged