mirror of
https://github.com/home-assistant/core.git
synced 2025-07-25 06:07:17 +00:00
Update Ruff to v0.0.277 (#96108)
This commit is contained in:
parent
479015244d
commit
18dddd6342
@ -1,6 +1,6 @@
|
|||||||
repos:
|
repos:
|
||||||
- repo: https://github.com/astral-sh/ruff-pre-commit
|
- repo: https://github.com/astral-sh/ruff-pre-commit
|
||||||
rev: v0.0.272
|
rev: v0.0.277
|
||||||
hooks:
|
hooks:
|
||||||
- id: ruff
|
- id: ruff
|
||||||
args:
|
args:
|
||||||
|
@ -210,8 +210,9 @@ class AmcrestChecker(ApiWrapper):
|
|||||||
self, *args: Any, **kwargs: Any
|
self, *args: Any, **kwargs: Any
|
||||||
) -> AsyncIterator[httpx.Response]:
|
) -> AsyncIterator[httpx.Response]:
|
||||||
"""amcrest.ApiWrapper.command wrapper to catch errors."""
|
"""amcrest.ApiWrapper.command wrapper to catch errors."""
|
||||||
async with self._async_command_wrapper():
|
async with self._async_command_wrapper(), super().async_stream_command(
|
||||||
async with super().async_stream_command(*args, **kwargs) as ret:
|
*args, **kwargs
|
||||||
|
) as ret:
|
||||||
yield ret
|
yield ret
|
||||||
|
|
||||||
@asynccontextmanager
|
@asynccontextmanager
|
||||||
|
@ -92,8 +92,9 @@ async def fetch_redirect_uris(hass: HomeAssistant, url: str) -> list[str]:
|
|||||||
parser = LinkTagParser("redirect_uri")
|
parser = LinkTagParser("redirect_uri")
|
||||||
chunks = 0
|
chunks = 0
|
||||||
try:
|
try:
|
||||||
async with aiohttp.ClientSession() as session:
|
async with aiohttp.ClientSession() as session, session.get(
|
||||||
async with session.get(url, timeout=5) as resp:
|
url, timeout=5
|
||||||
|
) as resp:
|
||||||
async for data in resp.content.iter_chunked(1024):
|
async for data in resp.content.iter_chunked(1024):
|
||||||
parser.feed(data.decode())
|
parser.feed(data.decode())
|
||||||
chunks += 1
|
chunks += 1
|
||||||
|
@ -2,5 +2,5 @@
|
|||||||
|
|
||||||
black==23.3.0
|
black==23.3.0
|
||||||
codespell==2.2.2
|
codespell==2.2.2
|
||||||
ruff==0.0.272
|
ruff==0.0.277
|
||||||
yamllint==1.28.0
|
yamllint==1.28.0
|
||||||
|
@ -31,8 +31,7 @@ async def test_simple_global_timeout_freeze() -> None:
|
|||||||
"""Test a simple global timeout freeze."""
|
"""Test a simple global timeout freeze."""
|
||||||
timeout = TimeoutManager()
|
timeout = TimeoutManager()
|
||||||
|
|
||||||
async with timeout.async_timeout(0.2):
|
async with timeout.async_timeout(0.2), timeout.async_freeze():
|
||||||
async with timeout.async_freeze():
|
|
||||||
await asyncio.sleep(0.3)
|
await asyncio.sleep(0.3)
|
||||||
|
|
||||||
|
|
||||||
@ -46,8 +45,9 @@ async def test_simple_zone_timeout_freeze_inside_executor_job(
|
|||||||
with timeout.freeze("recorder"):
|
with timeout.freeze("recorder"):
|
||||||
time.sleep(0.3)
|
time.sleep(0.3)
|
||||||
|
|
||||||
async with timeout.async_timeout(1.0):
|
async with timeout.async_timeout(1.0), timeout.async_timeout(
|
||||||
async with timeout.async_timeout(0.2, zone_name="recorder"):
|
0.2, zone_name="recorder"
|
||||||
|
):
|
||||||
await hass.async_add_executor_job(_some_sync_work)
|
await hass.async_add_executor_job(_some_sync_work)
|
||||||
|
|
||||||
|
|
||||||
@ -75,8 +75,9 @@ async def test_mix_global_timeout_freeze_and_zone_freeze_inside_executor_job(
|
|||||||
with timeout.freeze("recorder"):
|
with timeout.freeze("recorder"):
|
||||||
time.sleep(0.3)
|
time.sleep(0.3)
|
||||||
|
|
||||||
async with timeout.async_timeout(0.1):
|
async with timeout.async_timeout(0.1), timeout.async_timeout(
|
||||||
async with timeout.async_timeout(0.2, zone_name="recorder"):
|
0.2, zone_name="recorder"
|
||||||
|
):
|
||||||
await hass.async_add_executor_job(_some_sync_work)
|
await hass.async_add_executor_job(_some_sync_work)
|
||||||
|
|
||||||
|
|
||||||
@ -108,8 +109,9 @@ async def test_mix_global_timeout_freeze_and_zone_freeze_other_zone_inside_execu
|
|||||||
|
|
||||||
with pytest.raises(asyncio.TimeoutError):
|
with pytest.raises(asyncio.TimeoutError):
|
||||||
async with timeout.async_timeout(0.1):
|
async with timeout.async_timeout(0.1):
|
||||||
async with timeout.async_timeout(0.2, zone_name="recorder"):
|
async with timeout.async_timeout(
|
||||||
async with timeout.async_timeout(0.2, zone_name="not_recorder"):
|
0.2, zone_name="recorder"
|
||||||
|
), timeout.async_timeout(0.2, zone_name="not_recorder"):
|
||||||
await hass.async_add_executor_job(_some_sync_work)
|
await hass.async_add_executor_job(_some_sync_work)
|
||||||
|
|
||||||
|
|
||||||
@ -136,8 +138,7 @@ async def test_simple_global_timeout_freeze_with_executor_job(
|
|||||||
"""Test a simple global timeout freeze with executor job."""
|
"""Test a simple global timeout freeze with executor job."""
|
||||||
timeout = TimeoutManager()
|
timeout = TimeoutManager()
|
||||||
|
|
||||||
async with timeout.async_timeout(0.2):
|
async with timeout.async_timeout(0.2), timeout.async_freeze():
|
||||||
async with timeout.async_freeze():
|
|
||||||
await hass.async_add_executor_job(lambda: time.sleep(0.3))
|
await hass.async_add_executor_job(lambda: time.sleep(0.3))
|
||||||
|
|
||||||
|
|
||||||
@ -185,8 +186,7 @@ async def test_simple_zone_timeout_freeze() -> None:
|
|||||||
"""Test a simple zone timeout freeze."""
|
"""Test a simple zone timeout freeze."""
|
||||||
timeout = TimeoutManager()
|
timeout = TimeoutManager()
|
||||||
|
|
||||||
async with timeout.async_timeout(0.2, "test"):
|
async with timeout.async_timeout(0.2, "test"), timeout.async_freeze("test"):
|
||||||
async with timeout.async_freeze("test"):
|
|
||||||
await asyncio.sleep(0.3)
|
await asyncio.sleep(0.3)
|
||||||
|
|
||||||
|
|
||||||
@ -194,8 +194,7 @@ async def test_simple_zone_timeout_freeze_without_timeout() -> None:
|
|||||||
"""Test a simple zone timeout freeze on a zone that does not have a timeout set."""
|
"""Test a simple zone timeout freeze on a zone that does not have a timeout set."""
|
||||||
timeout = TimeoutManager()
|
timeout = TimeoutManager()
|
||||||
|
|
||||||
async with timeout.async_timeout(0.1, "test"):
|
async with timeout.async_timeout(0.1, "test"), timeout.async_freeze("test"):
|
||||||
async with timeout.async_freeze("test"):
|
|
||||||
await asyncio.sleep(0.3)
|
await asyncio.sleep(0.3)
|
||||||
|
|
||||||
|
|
||||||
@ -214,9 +213,9 @@ async def test_mix_zone_timeout_freeze_and_global_freeze() -> None:
|
|||||||
"""Test a mix zone timeout freeze and global freeze."""
|
"""Test a mix zone timeout freeze and global freeze."""
|
||||||
timeout = TimeoutManager()
|
timeout = TimeoutManager()
|
||||||
|
|
||||||
async with timeout.async_timeout(0.2, "test"):
|
async with timeout.async_timeout(0.2, "test"), timeout.async_freeze(
|
||||||
async with timeout.async_freeze("test"):
|
"test"
|
||||||
async with timeout.async_freeze():
|
), timeout.async_freeze():
|
||||||
await asyncio.sleep(0.3)
|
await asyncio.sleep(0.3)
|
||||||
|
|
||||||
|
|
||||||
@ -224,9 +223,9 @@ async def test_mix_global_and_zone_timeout_freeze_() -> None:
|
|||||||
"""Test a mix zone timeout freeze and global freeze."""
|
"""Test a mix zone timeout freeze and global freeze."""
|
||||||
timeout = TimeoutManager()
|
timeout = TimeoutManager()
|
||||||
|
|
||||||
async with timeout.async_timeout(0.2, "test"):
|
async with timeout.async_timeout(
|
||||||
async with timeout.async_freeze():
|
0.2, "test"
|
||||||
async with timeout.async_freeze("test"):
|
), timeout.async_freeze(), timeout.async_freeze("test"):
|
||||||
await asyncio.sleep(0.3)
|
await asyncio.sleep(0.3)
|
||||||
|
|
||||||
|
|
||||||
@ -234,8 +233,7 @@ async def test_mix_zone_timeout_freeze() -> None:
|
|||||||
"""Test a mix zone timeout global freeze."""
|
"""Test a mix zone timeout global freeze."""
|
||||||
timeout = TimeoutManager()
|
timeout = TimeoutManager()
|
||||||
|
|
||||||
async with timeout.async_timeout(0.2, "test"):
|
async with timeout.async_timeout(0.2, "test"), timeout.async_freeze():
|
||||||
async with timeout.async_freeze():
|
|
||||||
await asyncio.sleep(0.3)
|
await asyncio.sleep(0.3)
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user