Skip to content

Commit

Permalink
Remove backports.zoneinfo dependency (home-assistant#65069)
Browse files Browse the repository at this point in the history
  • Loading branch information
cdce8p authored Jan 27, 2022
1 parent a656944 commit d8f167b
Show file tree
Hide file tree
Showing 4 changed files with 3 additions and 12 deletions.
1 change: 0 additions & 1 deletion homeassistant/package_constraints.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ async_timeout==4.0.2
atomicwrites==1.4.0
attrs==21.2.0
awesomeversion==22.1.0
backports.zoneinfo;python_version<"3.9"
bcrypt==3.1.7
certifi>=2021.5.30
ciso8601==2.2.0
Expand Down
12 changes: 3 additions & 9 deletions homeassistant/util/dt.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,11 @@
from contextlib import suppress
import datetime as dt
import re
import sys
from typing import Any, cast
from typing import Any
import zoneinfo

import ciso8601

if sys.version_info[:2] >= (3, 9):
import zoneinfo
else:
from backports import zoneinfo

DATE_STR_FORMAT = "%Y-%m-%d"
UTC = dt.timezone.utc
DEFAULT_TIME_ZONE: dt.tzinfo = dt.timezone.utc
Expand Down Expand Up @@ -48,8 +43,7 @@ def get_time_zone(time_zone_str: str) -> dt.tzinfo | None:
Async friendly.
"""
try:
# Cast can be removed when mypy is switched to Python 3.9.
return cast(dt.tzinfo, zoneinfo.ZoneInfo(time_zone_str))
return zoneinfo.ZoneInfo(time_zone_str)
except zoneinfo.ZoneInfoNotFoundError:
return None

Expand Down
1 change: 0 additions & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ async_timeout==4.0.2
attrs==21.2.0
atomicwrites==1.4.0
awesomeversion==22.1.0
backports.zoneinfo;python_version<"3.9"
bcrypt==3.1.7
certifi>=2021.5.30
ciso8601==2.2.0
Expand Down
1 change: 0 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@
"attrs==21.2.0",
"atomicwrites==1.4.0",
"awesomeversion==22.1.0",
'backports.zoneinfo;python_version<"3.9"',
"bcrypt==3.1.7",
"certifi>=2021.5.30",
"ciso8601==2.2.0",
Expand Down

0 comments on commit d8f167b

Please sign in to comment.