Import Iterable and Iterator depending on Python version

libkeyringctl/{keyring,sequoia,util}.py:
As Iterable and Iterator are only used for type hints, switch to using
typing.{Iterable,Iterator} instead of
collections.abc.{Iterable,Iterator} for Python < 3.9.0, as older Python
interpreters will otherwise raise TypeError.
This commit is contained in:
David Runge
2022-04-14 15:41:08 +02:00
parent 67d898d12f
commit 29dc5d228d
3 changed files with 23 additions and 4 deletions

View File

@ -1,12 +1,18 @@
# SPDX-License-Identifier: GPL-3.0-or-later
from collections.abc import Iterable
from datetime import datetime
from functools import reduce
from pathlib import Path
from platform import python_version_tuple
from re import sub
from tempfile import mkdtemp
from typing import Dict
# NOTE: remove after python 3.8.x is no longer supported upstream
if int(python_version_tuple()[1]) < 9: # pragma: no cover
from typing import Iterable
else:
from collections.abc import Iterable
from typing import List
from typing import Optional