Skip to content

Commit 43bcd3b

Browse files
committed
Use ruff for linting
Signed-off-by: Casper Beyer <[email protected]>
1 parent 71feaf6 commit 43bcd3b

28 files changed

+102
-53
lines changed

.github/workflows/check.yml

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,4 +26,25 @@ jobs:
2626
run: uv sync --dev
2727

2828
- name: Run format check
29-
run: uv run ruff format --check
29+
run: uv run ruff format --check nats/
30+
31+
lint:
32+
runs-on: ubuntu-latest
33+
name: Lint
34+
steps:
35+
- name: Check out repository
36+
uses: actions/checkout@v5
37+
38+
- name: Set up Python
39+
uses: actions/setup-python@v6
40+
with:
41+
python-version: "3.8"
42+
43+
- name: Install uv
44+
uses: astral-sh/setup-uv@v6
45+
46+
- name: Install the project
47+
run: uv sync --dev
48+
49+
- name: Run lint check
50+
run: uv run ruff check nats/

nats-client/src/nats/client/__init__.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
from contextlib import AbstractAsyncContextManager
3232
from dataclasses import dataclass
3333
from enum import Enum
34-
from typing import TYPE_CHECKING
34+
from typing import TYPE_CHECKING, Self
3535
from urllib.parse import urlparse
3636

3737
from nats.client.connection import Connection, open_tcp_connection
@@ -49,10 +49,11 @@
4949
from nats.client.protocol.message import ParseError, parse
5050
from nats.client.protocol.types import (
5151
ConnectInfo,
52+
)
53+
from nats.client.protocol.types import (
5254
ServerInfo as ProtocolServerInfo,
5355
)
5456
from nats.client.subscription import Subscription
55-
from typing import Self
5657

5758
if TYPE_CHECKING:
5859
import types

nats-client/src/nats/client/protocol/message.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
from nats.client.protocol.types import ServerInfo
1515

1616
if TYPE_CHECKING:
17-
import asyncio
17+
pass
1818

1919

2020
@runtime_checkable

nats-client/src/nats/client/protocol/types.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,7 @@
77

88
from __future__ import annotations
99

10-
from typing import TypedDict
11-
12-
from typing import NotRequired, Required
10+
from typing import NotRequired, Required, TypedDict
1311

1412

1513
class ConnectInfo(TypedDict):

nats-client/src/nats/client/subscription.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,7 @@
1010
import asyncio
1111
from collections.abc import AsyncIterator, Callable
1212
from contextlib import AbstractAsyncContextManager, suppress
13-
from typing import TYPE_CHECKING, TypeVar
14-
15-
from typing import Self
13+
from typing import TYPE_CHECKING, Self, TypeVar
1614

1715
if TYPE_CHECKING:
1816
import types

nats-client/tests/conftest.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
from collections.abc import AsyncGenerator
44

55
import pytest_asyncio
6+
67
from nats.client import Client, connect
78
from nats.server import Server, run
89

nats-client/tests/test_client.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
import uuid
33

44
import pytest
5+
56
from nats.client import ClientStatus, NoRespondersError, connect
67
from nats.client.message import Headers
78
from nats.server import run, run_cluster

nats-client/tests/test_message.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
"""Tests for message module."""
22

33
import pytest
4+
45
from nats.client.message import Headers
56

67

nats-client/tests/test_protocol.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
import json
55

66
import pytest
7+
78
from nats.client.protocol.command import (
89
encode_connect,
910
encode_hpub,

nats-client/tests/test_subscription.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
import uuid
33

44
import pytest
5+
56
from nats.client import ClientStatus, connect
67
from nats.server import run
78

0 commit comments

Comments
 (0)