Bump ruff to 0.0.253 (#89211)

Co-authored-by: Paulus Schoutsen <balloob@gmail.com>
This commit is contained in:
epenet 2023-03-06 16:16:31 +01:00 committed by GitHub
parent e8bdaaacd9
commit 91e389c58d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 15 additions and 12 deletions

View File

@ -1,6 +1,6 @@
repos: repos:
- repo: https://github.com/charliermarsh/ruff-pre-commit - repo: https://github.com/charliermarsh/ruff-pre-commit
rev: v0.0.247 rev: v0.0.253
hooks: hooks:
- id: ruff - id: ruff
args: args:

View File

@ -188,7 +188,10 @@ class PS4Device(MediaPlayerEntity):
self._attr_source = self._attr_media_title self._attr_source = self._attr_media_title
self._attr_media_content_type = None self._attr_media_content_type = None
# Get data from PS Store. # Get data from PS Store.
asyncio.ensure_future(self.async_get_title_data(title_id, name)) self.hass.async_create_background_task(
self.async_get_title_data(title_id, name),
"ps4.media_player-get_title_data",
)
else: else:
if self.state != MediaPlayerState.IDLE: if self.state != MediaPlayerState.IDLE:
self.idle() self.idle()

View File

@ -393,7 +393,10 @@ class ZHAGateway:
device_info = zha_device.zha_device_info device_info = zha_device.zha_device_info
zha_device.async_cleanup_handles() zha_device.async_cleanup_handles()
async_dispatcher_send(self._hass, f"{SIGNAL_REMOVE}_{str(zha_device.ieee)}") async_dispatcher_send(self._hass, f"{SIGNAL_REMOVE}_{str(zha_device.ieee)}")
asyncio.ensure_future(self._async_remove_device(zha_device, entity_refs)) self._hass.async_create_task(
self._async_remove_device(zha_device, entity_refs),
"ZHAGateway._async_remove_device",
)
if device_info is not None: if device_info is not None:
async_dispatcher_send( async_dispatcher_send(
self._hass, self._hass,

View File

@ -14,5 +14,5 @@ pycodestyle==2.10.0
pydocstyle==6.2.3 pydocstyle==6.2.3
pyflakes==3.0.1 pyflakes==3.0.1
pyupgrade==3.3.1 pyupgrade==3.3.1
ruff==0.0.247 ruff==0.0.253
yamllint==1.28.0 yamllint==1.28.0

View File

@ -84,11 +84,9 @@ def test_run_does_not_block_forever_with_shielded_task(
"""Test we can shutdown and not block forever.""" """Test we can shutdown and not block forever."""
test_dir = tmpdir.mkdir("config") test_dir = tmpdir.mkdir("config")
default_config = runner.RuntimeConfig(test_dir) default_config = runner.RuntimeConfig(test_dir)
created_tasks = False tasks = []
async def _async_create_tasks(*_): async def _async_create_tasks(*_):
nonlocal created_tasks
async def async_raise(*_): async def async_raise(*_):
try: try:
await asyncio.sleep(2) await asyncio.sleep(2)
@ -101,11 +99,10 @@ def test_run_does_not_block_forever_with_shielded_task(
except asyncio.CancelledError: except asyncio.CancelledError:
await asyncio.sleep(2) await asyncio.sleep(2)
asyncio.ensure_future(asyncio.shield(async_shielded())) tasks.append(asyncio.ensure_future(asyncio.shield(async_shielded())))
asyncio.ensure_future(asyncio.sleep(2)) tasks.append(asyncio.ensure_future(asyncio.sleep(2)))
asyncio.ensure_future(async_raise()) tasks.append(asyncio.ensure_future(async_raise()))
await asyncio.sleep(0.1) await asyncio.sleep(0.1)
created_tasks = True
return 0 return 0
with patch.object(runner, "TASK_CANCELATION_TIMEOUT", 1), patch( with patch.object(runner, "TASK_CANCELATION_TIMEOUT", 1), patch(
@ -115,7 +112,7 @@ def test_run_does_not_block_forever_with_shielded_task(
): ):
runner.run(default_config) runner.run(default_config)
assert created_tasks is True assert len(tasks) == 3
assert ( assert (
"Task could not be canceled and was still running after shutdown" in caplog.text "Task could not be canceled and was still running after shutdown" in caplog.text
) )