Remove fallback to pytz
The zoneinfo module is available in Python >= 3.9 . Now the minimum supported version is 3.9 and we can assume it's always available. Change-Id: Ibfa416da3edb45403e10e2060131717d36cffc46
This commit is contained in:
parent
b68411b42e
commit
85188770df
@ -14,13 +14,7 @@
|
||||
import croniter
|
||||
import eventlet
|
||||
import netaddr
|
||||
|
||||
try:
|
||||
import zoneinfo
|
||||
except ImportError:
|
||||
# zoneinfo is available in Python >= 3.9
|
||||
import pytz
|
||||
zoneinfo = None
|
||||
import zoneinfo
|
||||
|
||||
from neutron_lib.api import validators
|
||||
from oslo_utils import timeutils
|
||||
@ -173,10 +167,7 @@ class TimezoneConstraint(constraints.BaseCustomConstraint):
|
||||
if not value:
|
||||
return True
|
||||
try:
|
||||
if zoneinfo:
|
||||
zoneinfo.ZoneInfo(value)
|
||||
else:
|
||||
pytz.timezone(value)
|
||||
zoneinfo.ZoneInfo(value)
|
||||
return True
|
||||
except Exception as ex:
|
||||
self._error_message = _(
|
||||
|
@ -13,13 +13,7 @@
|
||||
|
||||
import datetime
|
||||
from unittest import mock
|
||||
|
||||
try:
|
||||
import zoneinfo
|
||||
except ImportError:
|
||||
# zoneinfo is available in Python >= 3.9
|
||||
import pytz
|
||||
zoneinfo = None
|
||||
import zoneinfo
|
||||
|
||||
from testtools import matchers
|
||||
|
||||
@ -132,10 +126,7 @@ class SwiftUtilsTest(SwiftClientPluginTestCase):
|
||||
|
||||
def test_parse_last_modified(self):
|
||||
self.assertIsNone(self.swift_plugin.parse_last_modified(None))
|
||||
if zoneinfo:
|
||||
tz = zoneinfo.ZoneInfo('GMT')
|
||||
else:
|
||||
tz = pytz.timezone('GMT')
|
||||
tz = zoneinfo.ZoneInfo('GMT')
|
||||
now = datetime.datetime(
|
||||
2015, 2, 5, 1, 4, 40, 0, tz)
|
||||
now_naive = datetime.datetime(
|
||||
|
@ -50,11 +50,10 @@ python-troveclient>=2.2.0 # Apache-2.0
|
||||
python-vitrageclient>=2.7.0 # Apache-2.0
|
||||
python-zaqarclient>=1.3.0 # Apache-2.0
|
||||
python-zunclient>=3.4.0 # Apache-2.0
|
||||
pytz>=2013.6;python_version<"3.9" # MIT
|
||||
PyYAML>=5.1 # MIT
|
||||
requests>=2.23.0 # Apache-2.0
|
||||
tenacity>=6.1.0 # Apache-2.0
|
||||
tzdata>=2022.4;python_version>="3.9" # MIT
|
||||
tzdata>=2022.4 # MIT
|
||||
Routes>=2.3.1 # MIT
|
||||
SQLAlchemy>=1.4.0 # MIT
|
||||
stevedore>=3.1.0 # Apache-2.0
|
||||
|
Loading…
Reference in New Issue
Block a user