Bump ruff to 0.5.0 (#120749)
This commit is contained in:
parent
984bbf8851
commit
b56c4a757c
9 changed files with 12 additions and 13 deletions
|
@ -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.4.9
|
rev: v0.5.0
|
||||||
hooks:
|
hooks:
|
||||||
- id: ruff
|
- id: ruff
|
||||||
args:
|
args:
|
||||||
|
|
|
@ -42,12 +42,12 @@ class CommandLineNotificationService(BaseNotificationService):
|
||||||
|
|
||||||
def send_message(self, message: str = "", **kwargs: Any) -> None:
|
def send_message(self, message: str = "", **kwargs: Any) -> None:
|
||||||
"""Send a message to a command line."""
|
"""Send a message to a command line."""
|
||||||
with subprocess.Popen(
|
with subprocess.Popen( # noqa: S602 # shell by design
|
||||||
self.command,
|
self.command,
|
||||||
universal_newlines=True,
|
universal_newlines=True,
|
||||||
stdin=subprocess.PIPE,
|
stdin=subprocess.PIPE,
|
||||||
close_fds=False, # required for posix_spawn
|
close_fds=False, # required for posix_spawn
|
||||||
shell=True, # noqa: S602 # shell by design
|
shell=True,
|
||||||
) as proc:
|
) as proc:
|
||||||
try:
|
try:
|
||||||
proc.communicate(input=message, timeout=self._timeout)
|
proc.communicate(input=message, timeout=self._timeout)
|
||||||
|
|
|
@ -98,7 +98,6 @@ class WeatherFlowWeather(
|
||||||
"""Return the Air Pressure @ Station."""
|
"""Return the Air Pressure @ Station."""
|
||||||
return self.local_data.weather.current_conditions.station_pressure
|
return self.local_data.weather.current_conditions.station_pressure
|
||||||
|
|
||||||
#
|
|
||||||
@property
|
@property
|
||||||
def humidity(self) -> float | None:
|
def humidity(self) -> float | None:
|
||||||
"""Return the humidity."""
|
"""Return the humidity."""
|
||||||
|
|
|
@ -185,6 +185,7 @@ disable = [
|
||||||
"bidirectional-unicode", # PLE2502
|
"bidirectional-unicode", # PLE2502
|
||||||
"continue-in-finally", # PLE0116
|
"continue-in-finally", # PLE0116
|
||||||
"duplicate-bases", # PLE0241
|
"duplicate-bases", # PLE0241
|
||||||
|
"misplaced-bare-raise", # PLE0704
|
||||||
"format-needs-mapping", # F502
|
"format-needs-mapping", # F502
|
||||||
"function-redefined", # F811
|
"function-redefined", # F811
|
||||||
# Needed because ruff does not understand type of __all__ generated by a function
|
# Needed because ruff does not understand type of __all__ generated by a function
|
||||||
|
@ -675,7 +676,7 @@ filterwarnings = [
|
||||||
]
|
]
|
||||||
|
|
||||||
[tool.ruff]
|
[tool.ruff]
|
||||||
required-version = ">=0.4.8"
|
required-version = ">=0.5.0"
|
||||||
|
|
||||||
[tool.ruff.lint]
|
[tool.ruff.lint]
|
||||||
select = [
|
select = [
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
# Automatically generated from .pre-commit-config.yaml by gen_requirements_all.py, do not edit
|
# Automatically generated from .pre-commit-config.yaml by gen_requirements_all.py, do not edit
|
||||||
|
|
||||||
codespell==2.3.0
|
codespell==2.3.0
|
||||||
ruff==0.4.9
|
ruff==0.5.0
|
||||||
yamllint==1.35.1
|
yamllint==1.35.1
|
||||||
|
|
|
@ -28,7 +28,7 @@ async def test_sensor(
|
||||||
await init_integration(hass, mock_config_entry)
|
await init_integration(hass, mock_config_entry)
|
||||||
await snapshot_platform(hass, entity_registry, snapshot, mock_config_entry.entry_id)
|
await snapshot_platform(hass, entity_registry, snapshot, mock_config_entry.entry_id)
|
||||||
|
|
||||||
assert [
|
assert _METER_ERROR_OPTIONS == [
|
||||||
"no_error",
|
"no_error",
|
||||||
"communication",
|
"communication",
|
||||||
"reading",
|
"reading",
|
||||||
|
@ -64,4 +64,4 @@ async def test_sensor(
|
||||||
"tcp_head_mismatch",
|
"tcp_head_mismatch",
|
||||||
"empty_message",
|
"empty_message",
|
||||||
"undefined_error",
|
"undefined_error",
|
||||||
] == _METER_ERROR_OPTIONS
|
]
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
import logging
|
import logging
|
||||||
from typing import Any
|
from typing import Any
|
||||||
from unittest.mock import AsyncMock, Mock, patch
|
from unittest.mock import Mock, patch
|
||||||
|
|
||||||
from aiohttp.test_utils import make_mocked_request
|
from aiohttp.test_utils import make_mocked_request
|
||||||
import pytest
|
import pytest
|
||||||
|
@ -75,7 +75,6 @@ async def test_exception_handling(
|
||||||
send_messages = []
|
send_messages = []
|
||||||
user = MockUser()
|
user = MockUser()
|
||||||
refresh_token = Mock()
|
refresh_token = Mock()
|
||||||
current_request = AsyncMock()
|
|
||||||
hass.data[DOMAIN] = {}
|
hass.data[DOMAIN] = {}
|
||||||
|
|
||||||
def get_extra_info(key: str) -> Any:
|
def get_extra_info(key: str) -> Any:
|
||||||
|
|
|
@ -892,7 +892,7 @@ def fail_on_log_exception(
|
||||||
return
|
return
|
||||||
|
|
||||||
def log_exception(format_err, *args):
|
def log_exception(format_err, *args):
|
||||||
raise # pylint: disable=misplaced-bare-raise
|
raise # noqa: PLE0704
|
||||||
|
|
||||||
monkeypatch.setattr("homeassistant.util.logging.log_exception", log_exception)
|
monkeypatch.setattr("homeassistant.util.logging.log_exception", log_exception)
|
||||||
|
|
||||||
|
|
|
@ -10,9 +10,9 @@ from homeassistant.util import process
|
||||||
|
|
||||||
async def test_kill_process() -> None:
|
async def test_kill_process() -> None:
|
||||||
"""Test killing a process."""
|
"""Test killing a process."""
|
||||||
sleeper = subprocess.Popen(
|
sleeper = subprocess.Popen( # noqa: S602 # shell by design
|
||||||
"sleep 1000",
|
"sleep 1000",
|
||||||
shell=True, # noqa: S602 # shell by design
|
shell=True,
|
||||||
stdout=subprocess.DEVNULL,
|
stdout=subprocess.DEVNULL,
|
||||||
stderr=subprocess.DEVNULL,
|
stderr=subprocess.DEVNULL,
|
||||||
)
|
)
|
||||||
|
|
Loading…
Add table
Reference in a new issue