From 1911b6822880e4624c707d3c5cd094b13b66138c Mon Sep 17 00:00:00 2001 From: epenet <6771947+epenet@users.noreply.github.com> Date: Mon, 25 Nov 2024 08:53:06 +0100 Subject: [PATCH] Replace isort with ruff --- .flake8 | 5 ----- .pre-commit-config.yaml | 4 ---- example/encrypted_authenticator.py | 4 +++- example/encrypted_remote.py | 5 ++++- pyproject.toml | 25 ++++++++++++------------- samsungtvws/async_connection.py | 11 ++++++++++- tests/test_encrypted_authenticator.py | 4 +++- 7 files changed, 32 insertions(+), 26 deletions(-) delete mode 100644 .flake8 diff --git a/.flake8 b/.flake8 deleted file mode 100644 index d9ad0b4..0000000 --- a/.flake8 +++ /dev/null @@ -1,5 +0,0 @@ -[flake8] -ignore = E203, E266, E501, W503, F403, F401 -max-line-length = 79 -max-complexity = 18 -select = B,C,E,F,W,T4,B9 diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index f9f8349..eca8034 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -16,10 +16,6 @@ repos: rev: v3.1.0 hooks: - id: prettier - - repo: https://github.com/PyCQA/isort - rev: 5.13.2 - hooks: - - id: isort - repo: https://github.com/adrienverge/yamllint.git rev: v1.35.1 hooks: diff --git a/example/encrypted_authenticator.py b/example/encrypted_authenticator.py index e31a455..ef50f39 100644 --- a/example/encrypted_authenticator.py +++ b/example/encrypted_authenticator.py @@ -4,7 +4,9 @@ import aiohttp -from samsungtvws.encrypted.authenticator import SamsungTVEncryptedWSAsyncAuthenticator +from samsungtvws.encrypted.authenticator import ( + SamsungTVEncryptedWSAsyncAuthenticator, +) logging.basicConfig(level=logging.DEBUG) diff --git a/example/encrypted_remote.py b/example/encrypted_remote.py index 9c6e7c6..ba5bb57 100644 --- a/example/encrypted_remote.py +++ b/example/encrypted_remote.py @@ -3,7 +3,10 @@ import aiohttp -from samsungtvws.encrypted.remote import SamsungTVEncryptedWSAsyncRemote, SendRemoteKey +from samsungtvws.encrypted.remote import ( + SamsungTVEncryptedWSAsyncRemote, + SendRemoteKey, +) logging.basicConfig(level=logging.DEBUG) diff --git a/pyproject.toml b/pyproject.toml index 91e2df4..f9e9cd5 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,16 +1,3 @@ -[tool.isort] -# https://github.com/PyCQA/isort/wiki/isort-Settings -profile = "black" -force_sort_within_sections = true -known_first_party = [ - "samsungtvws", - "tests", -] -forced_separate = [ - "tests", -] -combine_as_imports = true - [tool.ruff] line-length = 79 target-version = "py38" @@ -27,10 +14,22 @@ select = [ "C", "E", "F", + "I", # isort "UP", # pyupgrade "W", ] +[tool.ruff.lint.isort] +force-sort-within-sections = true +known-first-party = [ + "samsungtvws", + "tests", +] +forced-separate = [ + "tests", +] +combine-as-imports = true + [tool.ruff.lint.mccabe] max-complexity = 18 diff --git a/samsungtvws/async_connection.py b/samsungtvws/async_connection.py index 204f2f8..4062e10 100644 --- a/samsungtvws/async_connection.py +++ b/samsungtvws/async_connection.py @@ -12,7 +12,16 @@ import logging import ssl from types import TracebackType -from typing import Any, Awaitable, Callable, Dict, List, Optional, Sequence, Union +from typing import ( + Any, + Awaitable, + Callable, + Dict, + List, + Optional, + Sequence, + Union, +) from websockets.client import WebSocketClientProtocol, connect from websockets.exceptions import ConnectionClosed diff --git a/tests/test_encrypted_authenticator.py b/tests/test_encrypted_authenticator.py index e7399bb..f949685 100644 --- a/tests/test_encrypted_authenticator.py +++ b/tests/test_encrypted_authenticator.py @@ -5,7 +5,9 @@ import pytest from yarl import URL -from samsungtvws.encrypted.authenticator import SamsungTVEncryptedWSAsyncAuthenticator +from samsungtvws.encrypted.authenticator import ( + SamsungTVEncryptedWSAsyncAuthenticator, +) @pytest.mark.asyncio