diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 8d45122..54db536 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -30,3 +30,9 @@ repos: language: system types: [python] require_serial: true + - id: isort + name: isort + entry: poetry run isort + language: system + require_serial: true + types_or: [python, pyi] diff --git a/examples/test_client.py b/examples/test_client.py index 1101b6e..745cccc 100644 --- a/examples/test_client.py +++ b/examples/test_client.py @@ -1,11 +1,11 @@ """Example SHS client""" -import os from asyncio import get_event_loop from base64 import b64decode +import os -import yaml from nacl.signing import SigningKey +import yaml from secret_handshake import SHSClient diff --git a/examples/test_server.py b/examples/test_server.py index a331dbb..d9255ae 100644 --- a/examples/test_server.py +++ b/examples/test_server.py @@ -1,11 +1,11 @@ """Example SHS server""" -import os from asyncio import get_event_loop from base64 import b64decode +import os -import yaml from nacl.signing import SigningKey +import yaml from secret_handshake import SHSServer diff --git a/pyproject.toml b/pyproject.toml index c53392e..d5c80bd 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -51,6 +51,11 @@ skip_covered = true fail_under = 91 omit = ["examples/*"] +[tool.isort] +force_sort_within_sections = true +line_length = 100 +profile = "black" + [tool.pylint.format] max-line-length = 120 diff --git a/tests/helpers.py b/tests/helpers.py index 714d11f..f244a26 100644 --- a/tests/helpers.py +++ b/tests/helpers.py @@ -42,7 +42,10 @@ class AsyncBuffer(BytesIO): async def async_comprehend(generator): """Emulate ``[elem async for elem in generator]``.""" + results = [] + async for msg in generator: results.append(msg) + return results diff --git a/tests/test_crypto.py b/tests/test_crypto.py index 511e941..54d9cbf 100644 --- a/tests/test_crypto.py +++ b/tests/test_crypto.py @@ -22,9 +22,9 @@ import hashlib -import pytest from nacl.public import PrivateKey from nacl.signing import SigningKey +import pytest from secret_handshake.crypto import SHSClientCrypto, SHSServerCrypto diff --git a/tests/test_network.py b/tests/test_network.py index e6ba9a7..af209b9 100644 --- a/tests/test_network.py +++ b/tests/test_network.py @@ -20,11 +20,11 @@ """Tests for the networking components""" -import os from asyncio import Event, wait_for +import os -import pytest from nacl.signing import SigningKey +import pytest from secret_handshake import SHSClient, SHSServer