Skip to content
Snippets Groups Projects
Verified Commit 29dc5d22 authored by David Runge's avatar David Runge :chipmunk:
Browse files

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.
parent 67d898d1
No related branches found
No related tags found
No related merge requests found
# SPDX-License-Identifier: GPL-3.0-or-later
from collections import defaultdict
from collections.abc import Iterable
from itertools import chain
from logging import debug
from logging import error
from pathlib import Path
from platform import python_version_tuple
from re import match
from shutil import copytree
from tempfile import NamedTemporaryFile
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
from typing import Set
......
# 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
......
# SPDX-License-Identifier: GPL-3.0-or-later
from collections.abc import Iterable
from collections.abc import Iterator
from contextlib import contextmanager
from hashlib import sha256
from os import chdir
from os import environ
from os import getcwd
from pathlib import Path
from platform import python_version_tuple
from re import escape
from re import split
from re import sub
......@@ -22,6 +21,14 @@ from traceback import print_stack
from typing import IO
from typing import AnyStr
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
from typing import Iterator
else:
from collections.abc import Iterable
from collections.abc import Iterator
from typing import List
from typing import Optional
from typing import Set
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment