mirror of
https://github.com/esphome/esphome.git
synced 2025-01-03 11:21:43 +01:00
Bump tzlocal from 3.0 to 4.0.1 (#2553)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Oxan van Leeuwen <oxan@oxanvanleeuwen.nl>
This commit is contained in:
parent
b141aea4c0
commit
1468acfced
2 changed files with 3 additions and 7 deletions
|
@ -1,7 +1,6 @@
|
||||||
import logging
|
import logging
|
||||||
from importlib import resources
|
from importlib import resources
|
||||||
from typing import Optional
|
from typing import Optional
|
||||||
from datetime import timezone
|
|
||||||
|
|
||||||
import tzlocal
|
import tzlocal
|
||||||
|
|
||||||
|
@ -66,14 +65,11 @@ def _extract_tz_string(tzfile: bytes) -> str:
|
||||||
|
|
||||||
|
|
||||||
def detect_tz() -> str:
|
def detect_tz() -> str:
|
||||||
localzone = tzlocal.get_localzone()
|
iana_key = tzlocal.get_localzone_name()
|
||||||
if localzone is timezone.utc:
|
if iana_key is None:
|
||||||
return "UTC0"
|
|
||||||
if not hasattr(localzone, "key"):
|
|
||||||
raise cv.Invalid(
|
raise cv.Invalid(
|
||||||
"Could not automatically determine timezone, please set timezone manually."
|
"Could not automatically determine timezone, please set timezone manually."
|
||||||
)
|
)
|
||||||
iana_key = localzone.key
|
|
||||||
_LOGGER.info("Detected timezone '%s'", iana_key)
|
_LOGGER.info("Detected timezone '%s'", iana_key)
|
||||||
tzfile = _load_tzdata(iana_key)
|
tzfile = _load_tzdata(iana_key)
|
||||||
if tzfile is None:
|
if tzfile is None:
|
||||||
|
|
|
@ -3,7 +3,7 @@ PyYAML==6.0
|
||||||
paho-mqtt==1.6.1
|
paho-mqtt==1.6.1
|
||||||
colorama==0.4.4
|
colorama==0.4.4
|
||||||
tornado==6.1
|
tornado==6.1
|
||||||
tzlocal==3.0 # from time
|
tzlocal==4.0.1 # from time
|
||||||
tzdata>=2021.1 # from time
|
tzdata>=2021.1 # from time
|
||||||
pyserial==3.5
|
pyserial==3.5
|
||||||
platformio==5.2.2 # When updating platformio, also update Dockerfile
|
platformio==5.2.2 # When updating platformio, also update Dockerfile
|
||||||
|
|
Loading…
Reference in a new issue