ci: Update and configure isort, and make it happy

This commit is contained in:
Gergely Polonkai 2023-11-14 05:00:03 +01:00
parent d1a0510734
commit 8f5d355ea0
No known key found for this signature in database
GPG Key ID: 2D2885533B869ED4
12 changed files with 44 additions and 39 deletions

View File

@ -24,6 +24,13 @@ repos:
language: system language: system
require_serial: true require_serial: true
types_or: [python, pyi] types_or: [python, pyi]
- id: isort
name: isort
args: ["--check", "--diff"]
entry: poetry run isort
language: system
require_serial: true
types_or: [python, pyi]
- id: reuse - id: reuse
name: reuse name: reuse
entry: poetry run reuse entry: poetry run reuse

View File

@ -20,22 +20,20 @@
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE. # SOFTWARE.
from asyncio import ensure_future, gather, get_event_loop
import base64
import hashlib
import logging import logging
import struct import struct
import time import time
from asyncio import get_event_loop, gather, ensure_future
from colorlog import ColoredFormatter from colorlog import ColoredFormatter
from secret_handshake.network import SHSClient from secret_handshake.network import SHSClient
from ssb.muxrpc import MuxRPCAPI, MuxRPCAPIException from ssb.muxrpc import MuxRPCAPI, MuxRPCAPIException
from ssb.packet_stream import PacketStream, PSMessageType from ssb.packet_stream import PacketStream, PSMessageType
from ssb.util import load_ssb_secret from ssb.util import load_ssb_secret
import hashlib
import base64
api = MuxRPCAPI() api = MuxRPCAPI()

View File

@ -20,14 +20,14 @@
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE. # SOFTWARE.
from asyncio import ensure_future, gather, get_event_loop
import logging import logging
from asyncio import gather, get_event_loop, ensure_future
from colorlog import ColoredFormatter from colorlog import ColoredFormatter
from secret_handshake import SHSServer from secret_handshake import SHSServer
from ssb.packet_stream import PacketStream
from ssb.muxrpc import MuxRPCAPI from ssb.muxrpc import MuxRPCAPI
from ssb.packet_stream import PacketStream
from ssb.util import load_ssb_secret from ssb.util import load_ssb_secret
api = MuxRPCAPI() api = MuxRPCAPI()

18
poetry.lock generated
View File

@ -509,20 +509,20 @@ files = [
[[package]] [[package]]
name = "isort" name = "isort"
version = "4.3.21" version = "5.12.0"
description = "A Python utility / library to sort Python imports." description = "A Python utility / library to sort Python imports."
optional = false optional = false
python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*" python-versions = ">=3.8.0"
files = [ files = [
{file = "isort-4.3.21-py2.py3-none-any.whl", hash = "sha256:6e811fcb295968434526407adb8796944f1988c5b65e8139058f2014cbe100fd"}, {file = "isort-5.12.0-py3-none-any.whl", hash = "sha256:f84c2818376e66cf843d497486ea8fed8700b340f308f076c6fb1229dff318b6"},
{file = "isort-4.3.21.tar.gz", hash = "sha256:54da7e92468955c4fceacd0c86bd0ec997b0e1ee80d97f67c35a78b719dccab1"}, {file = "isort-5.12.0.tar.gz", hash = "sha256:8bef7dde241278824a6d83f44a544709b065191b95b6e50894bdc722fcba0504"},
] ]
[package.extras] [package.extras]
pipfile = ["pipreqs", "requirementslib"] colors = ["colorama (>=0.4.3)"]
pyproject = ["toml"] pipfile-deprecated-finder = ["pip-shims (>=0.5.2)", "pipreqs", "requirementslib"]
requirements = ["pip-api", "pipreqs"] plugins = ["setuptools"]
xdg-home = ["appdirs (>=1.4.0)"] requirements-deprecated-finder = ["pip-api", "pipreqs"]
[[package]] [[package]]
name = "jinja2" name = "jinja2"
@ -1241,4 +1241,4 @@ testing = ["big-O", "jaraco.functools", "jaraco.itertools", "more-itertools", "p
[metadata] [metadata]
lock-version = "2.0" lock-version = "2.0"
python-versions = "^3.9" python-versions = "^3.9"
content-hash = "68f8505b0bc199dbcf9d3ea4ae37ee43f36128d05427ea99bd3a09fb201bcd72" content-hash = "4eb60a723d8be38d3d197522f58d19f4bdae3887bd006d13ab87fb058c75b467"

View File

@ -23,7 +23,7 @@ black = "^23.10.1"
check-manifest = "^0.39" check-manifest = "^0.39"
commitizen = "^3.12.0" commitizen = "^3.12.0"
coverage = "^7.3.2" coverage = "^7.3.2"
isort = "^4.3.20" isort = "^5.12.0"
pep257 = "^0.7.0" pep257 = "^0.7.0"
pytest = "^7.4.3" pytest = "^7.4.3"
pytest-asyncio = "^0.21.1" pytest-asyncio = "^0.21.1"
@ -45,6 +45,11 @@ skip_covered = true
fail_under = 70 fail_under = 70
omit = ["examples/*"] omit = ["examples/*"]
[tool.isort]
force_sort_within_sections = true
line_length = 120
profile = "black"
[tool.pytest.ini_options] [tool.pytest.ini_options]
addopts = ["--cov=.", "--no-cov-on-fail"] addopts = ["--cov=.", "--no-cov-on-fail"]
python_files = ["tests/test_*.py"] python_files = ["tests/test_*.py"]

View File

@ -20,6 +20,6 @@
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE. # SOFTWARE.
from .models import Feed, LocalFeed, Message, LocalMessage, NoPrivateKeyException from .models import Feed, LocalFeed, LocalMessage, Message, NoPrivateKeyException
__all__ = ("Feed", "LocalFeed", "Message", "LocalMessage", "NoPrivateKeyException") __all__ = ("Feed", "LocalFeed", "Message", "LocalMessage", "NoPrivateKeyException")

View File

@ -20,16 +20,15 @@
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE. # SOFTWARE.
import datetime
from base64 import b64encode from base64 import b64encode
from collections import namedtuple, OrderedDict from collections import OrderedDict, namedtuple
import datetime
from hashlib import sha256 from hashlib import sha256
from simplejson import dumps, loads from simplejson import dumps, loads
from ssb.util import tag from ssb.util import tag
OrderedMsg = namedtuple("OrderedMsg", ("previous", "author", "sequence", "timestamp", "hash", "content")) OrderedMsg = namedtuple("OrderedMsg", ("previous", "author", "sequence", "timestamp", "hash", "content"))

View File

@ -20,18 +20,16 @@
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE. # SOFTWARE.
import logging
import struct
from asyncio import Event, Queue from asyncio import Event, Queue
from enum import Enum from enum import Enum
from time import time import logging
from math import ceil from math import ceil
import struct
from time import time
import simplejson
from async_generator import async_generator, yield_ from async_generator import async_generator, yield_
from secret_handshake import SHSClient, SHSServer from secret_handshake import SHSClient, SHSServer
import simplejson
logger = logging.getLogger("packet_stream") logger = logging.getLogger("packet_stream")

View File

@ -20,11 +20,11 @@
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE. # SOFTWARE.
import os
import yaml
from base64 import b64decode, b64encode from base64 import b64decode, b64encode
import os
from nacl.signing import SigningKey from nacl.signing import SigningKey
import yaml
class ConfigException(Exception): class ConfigException(Exception):

View File

@ -23,11 +23,10 @@
from base64 import b64decode from base64 import b64decode
from collections import OrderedDict from collections import OrderedDict
import pytest
from nacl.signing import SigningKey, VerifyKey from nacl.signing import SigningKey, VerifyKey
import pytest
from ssb.feed import LocalMessage, LocalFeed, Feed, Message, NoPrivateKeyException from ssb.feed import Feed, LocalFeed, LocalMessage, Message, NoPrivateKeyException
SERIALIZED_M1 = b"""{ SERIALIZED_M1 = b"""{
"previous": null, "previous": null,

View File

@ -20,13 +20,13 @@
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE. # SOFTWARE.
from asyncio import Event, ensure_future, gather
import json import json
from asyncio import ensure_future, gather, Event
import pytest
from nacl.signing import SigningKey from nacl.signing import SigningKey
import pytest
from secret_handshake.network import SHSDuplexStream from secret_handshake.network import SHSDuplexStream
from ssb.packet_stream import PacketStream, PSMessageType from ssb.packet_stream import PacketStream, PSMessageType

View File

@ -25,8 +25,7 @@ from unittest.mock import mock_open, patch
import pytest import pytest
from ssb.util import load_ssb_secret, ConfigException from ssb.util import ConfigException, load_ssb_secret
CONFIG_FILE = """ CONFIG_FILE = """
## Comments should be supported too ## Comments should be supported too