From 01f15c01e2ef3be7ac74300e9957508d6acfd5a1 Mon Sep 17 00:00:00 2001 From: Ashhar Hasan Date: Tue, 23 Jan 2024 01:17:02 +0530 Subject: [PATCH] Do not use exceptions for conditional imports This additionally helps make mypy happy. --- trino/mapper.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/trino/mapper.py b/trino/mapper.py index f29dd666..087bbfa9 100644 --- a/trino/mapper.py +++ b/trino/mapper.py @@ -2,14 +2,15 @@ import abc import base64 +import sys import uuid from datetime import date, datetime, time, timedelta, timezone, tzinfo from decimal import Decimal from typing import Any, Dict, Generic, List, Optional, Tuple, TypeVar -try: +if sys.version_info >= (3, 9): from zoneinfo import ZoneInfo -except ModuleNotFoundError: +else: from backports.zoneinfo import ZoneInfo import trino.exceptions