Skip to content

Commit 047e12a

Browse files
authored
Activate all ruff rules (#1)
1 parent bc4e5cb commit 047e12a

4 files changed

Lines changed: 18 additions & 12 deletions

File tree

go2rtc_client/client.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,8 @@
22

33
from __future__ import annotations
44

5-
from collections.abc import Mapping
65
import logging
7-
from typing import Any, Final, Literal
6+
from typing import TYPE_CHECKING, Any, Final, Literal
87
from urllib.parse import urljoin
98

109
from aiohttp import ClientError, ClientResponse, ClientSession
@@ -14,6 +13,9 @@
1413

1514
from .models import Stream, WebRTCSdpAnswer, WebRTCSdpOffer
1615

16+
if TYPE_CHECKING:
17+
from collections.abc import Mapping
18+
1719
_LOGGER = logging.getLogger(__name__)
1820

1921
_API_PREFIX = "/api"
@@ -48,7 +50,8 @@ async def request(
4850
try:
4951
resp = await self._session.request(method, url, **kwargs)
5052
except ClientError as err:
51-
raise ClientError(f"Server communication failure: {err}") from err
53+
msg = f"Server communication failure: {err}"
54+
raise ClientError(msg) from err
5255

5356
resp.raise_for_status()
5457
return resp

pyproject.toml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -140,14 +140,16 @@ max-line-length = 88
140140
addopts = "--cov"
141141
asyncio_mode = "auto"
142142

143-
[tool.lint.ruff]
143+
[tool.ruff.lint]
144144
ignore = [
145145
"ANN101", # Self... explanatory
146146
"ANN102", # cls... just as useless
147147
"ANN401", # Opinioated warning on disallowing dynamically typed expressions
148+
"COM812", # Recommended to disable due conflicts with ruff format
148149
"D203", # Conflicts with other rules
149150
"D213", # Conflicts with other rules
150151
"D417", # False positives in some occasions
152+
"ISC001", # Recommended to disable due conflicts with ruff format
151153
"PLR2004", # Just annoying, not really useful
152154
"PLR0913", # Too many arguments
153155
]

tests/conftest.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,12 @@
55
import aiohttp
66
from aioresponses import aioresponses
77
import pytest
8+
from syrupy import SnapshotAssertion
89

910
from go2rtc_client import Go2RtcClient
10-
from syrupy import SnapshotAssertion
1111

12-
from .syrupy import Go2RtcSnapshotExtension
1312
from . import URL
13+
from .syrupy import Go2RtcSnapshotExtension
1414

1515

1616
@pytest.fixture(name="snapshot")

tests/test_client.py

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,20 +4,21 @@
44

55
from typing import TYPE_CHECKING
66

7-
from aioresponses import aioresponses
7+
from aiohttp.hdrs import METH_PUT
88
import pytest
99

10-
from go2rtc_client.models import WebRTCSdpOffer
11-
from . import URL
12-
13-
from go2rtc_client import Go2RtcClient
1410
from go2rtc_client.client import _StreamClient, _WebRTCClient
11+
from go2rtc_client.models import WebRTCSdpOffer
1512
from tests import load_fixture
16-
from aiohttp.hdrs import METH_PUT
13+
14+
from . import URL
1715

1816
if TYPE_CHECKING:
17+
from aioresponses import aioresponses
1918
from syrupy import SnapshotAssertion
2019

20+
from go2rtc_client import Go2RtcClient
21+
2122

2223
@pytest.mark.parametrize(
2324
"filename",

0 commit comments

Comments
 (0)