mirror of
https://github.com/home-assistant/core.git
synced 2025-07-23 13:17:32 +00:00
Use zoneinfo instead of pytz, mark pytz as banned in ruff (#98613)
Refs #43439, #49643.
This commit is contained in:
parent
4073f56c5e
commit
93683cef27
@ -488,6 +488,7 @@ select = [
|
|||||||
"SIM401", # Use get from dict with default instead of an if block
|
"SIM401", # Use get from dict with default instead of an if block
|
||||||
"T100", # Trace found: {name} used
|
"T100", # Trace found: {name} used
|
||||||
"T20", # flake8-print
|
"T20", # flake8-print
|
||||||
|
"TID251", # Banned imports
|
||||||
"TRY004", # Prefer TypeError exception for invalid type
|
"TRY004", # Prefer TypeError exception for invalid type
|
||||||
"TRY200", # Use raise from to specify exception cause
|
"TRY200", # Use raise from to specify exception cause
|
||||||
"TRY302", # Remove exception handler; error is immediately re-raised
|
"TRY302", # Remove exception handler; error is immediately re-raised
|
||||||
@ -531,6 +532,9 @@ voluptuous = "vol"
|
|||||||
[tool.ruff.flake8-pytest-style]
|
[tool.ruff.flake8-pytest-style]
|
||||||
fixture-parentheses = false
|
fixture-parentheses = false
|
||||||
|
|
||||||
|
[tool.ruff.flake8-tidy-imports.banned-api]
|
||||||
|
"pytz".msg = "use zoneinfo instead"
|
||||||
|
|
||||||
[tool.ruff.isort]
|
[tool.ruff.isort]
|
||||||
force-sort-within-sections = true
|
force-sort-within-sections = true
|
||||||
known-first-party = [
|
known-first-party = [
|
||||||
|
@ -5,7 +5,6 @@ from ipaddress import IPv4Address
|
|||||||
from unittest.mock import AsyncMock, Mock, patch
|
from unittest.mock import AsyncMock, Mock, patch
|
||||||
|
|
||||||
import pytest
|
import pytest
|
||||||
import pytz
|
|
||||||
from pyunifiprotect.data import (
|
from pyunifiprotect.data import (
|
||||||
Bootstrap,
|
Bootstrap,
|
||||||
Camera,
|
Camera,
|
||||||
@ -441,7 +440,7 @@ ONE_MONTH_SIMPLE = (
|
|||||||
minute=0,
|
minute=0,
|
||||||
second=0,
|
second=0,
|
||||||
microsecond=0,
|
microsecond=0,
|
||||||
tzinfo=pytz.timezone("US/Pacific"),
|
tzinfo=dt_util.get_time_zone("US/Pacific"),
|
||||||
),
|
),
|
||||||
1,
|
1,
|
||||||
)
|
)
|
||||||
@ -454,7 +453,7 @@ TWO_MONTH_SIMPLE = (
|
|||||||
minute=0,
|
minute=0,
|
||||||
second=0,
|
second=0,
|
||||||
microsecond=0,
|
microsecond=0,
|
||||||
tzinfo=pytz.timezone("US/Pacific"),
|
tzinfo=dt_util.get_time_zone("US/Pacific"),
|
||||||
),
|
),
|
||||||
2,
|
2,
|
||||||
)
|
)
|
||||||
@ -513,7 +512,7 @@ ONE_MONTH_TIMEZONE = (
|
|||||||
minute=0,
|
minute=0,
|
||||||
second=0,
|
second=0,
|
||||||
microsecond=0,
|
microsecond=0,
|
||||||
tzinfo=pytz.timezone("US/Pacific"),
|
tzinfo=dt_util.get_time_zone("US/Pacific"),
|
||||||
),
|
),
|
||||||
1,
|
1,
|
||||||
)
|
)
|
||||||
@ -526,7 +525,7 @@ TWO_MONTH_TIMEZONE = (
|
|||||||
minute=0,
|
minute=0,
|
||||||
second=0,
|
second=0,
|
||||||
microsecond=0,
|
microsecond=0,
|
||||||
tzinfo=pytz.timezone("US/Pacific"),
|
tzinfo=dt_util.get_time_zone("US/Pacific"),
|
||||||
),
|
),
|
||||||
2,
|
2,
|
||||||
)
|
)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user