From 896b5db5336b0ff7dc623a047f1fe4deb1e604f3 Mon Sep 17 00:00:00 2001 From: Mark Liffiton Date: Fri, 26 Jul 2024 11:20:39 -0500 Subject: [PATCH] Use version check rather than try/except. --- src/gened/migrate.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/gened/migrate.py b/src/gened/migrate.py index 539f77f..f915937 100644 --- a/src/gened/migrate.py +++ b/src/gened/migrate.py @@ -3,15 +3,16 @@ # SPDX-License-Identifier: AGPL-3.0-only import itertools +import sys from collections.abc import Iterable from datetime import datetime from importlib import resources from pathlib import Path from typing import TypedDict -try: - from importlib.resources.abc import Traversable # 3.12+ -except ImportError: +if sys.version_info >= (3, 11): + from importlib.resources.abc import Traversable +else: from importlib.abc import Traversable # - Deprecated in 3.12, removed in 3.14 import click