Skip to content

Commit ef05795

Browse files
committed
Cleanup
1 parent 02c652c commit ef05795

File tree

7 files changed

+24
-20
lines changed

7 files changed

+24
-20
lines changed

README.md

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,12 @@
1212
**pysignalr** is a modern, reliable, and async-ready client for the [SignalR protocol](https://docs.microsoft.com/en-us/aspnet/core/signalr/introduction?view=aspnetcore-5.0). This project started as an asyncio fork of mandrewcito's [signalrcore](https://github.com/mandrewcito/signalrcore) library and ended up as a complete rewrite.
1313

1414
## Table of Contents
15+
1516
1. [Installation](#installation)
1617
2. [Basic Usage](#basic-usage)
1718
3. [Usage with Token Authentication](#usage-with-token-authentication)
1819
4. [API Reference](#api-reference)
19-
5. [Roadmap](#roadmap)
20-
6. [Contributing](#contributing)
21-
7. [License](#license)
20+
5. [License](#license)
2221

2322
## Installation
2423

example.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,13 @@
22

33
import asyncio
44
from contextlib import suppress
5+
from typing import TYPE_CHECKING
56
from typing import Any
67

78
from pysignalr.client import SignalRClient
8-
from pysignalr.messages import CompletionMessage
9+
10+
if TYPE_CHECKING:
11+
from pysignalr.messages import CompletionMessage
912

1013

1114
async def on_open() -> None:

example_with_token.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,13 @@
22

33
import asyncio
44
from contextlib import suppress
5+
from typing import TYPE_CHECKING
56
from typing import Any
67

78
from pysignalr.client import SignalRClient
8-
from pysignalr.messages import CompletionMessage
9+
10+
if TYPE_CHECKING:
11+
from pysignalr.messages import CompletionMessage
912

1013

1114
async def on_open() -> None:

pyproject.toml

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ homepage = "https://github.com/baking-bad/pysignalr"
2525
authors = [
2626
"Lev Gorodetskii <[email protected]>",
2727
"mandrewcito <[email protected]>",
28-
"Caio Barbieri <[email protected]",
28+
"Caio Barbieri <[email protected]>",
2929
]
3030
maintainers = [
3131
"Lev Gorodetskii <[email protected]>",
@@ -64,11 +64,6 @@ line-length = 120
6464
target-version = "py38"
6565

6666
[tool.ruff.lint]
67-
ignore = [
68-
"E402", # module level import not at top of file
69-
"E501", # line too long
70-
"TCH001", # breaks our runtime Pydantic magic
71-
]
7267
extend-select = ["B", "C4", "FA", "G", "I", "PTH", "Q", "RUF", "TCH", "UP"]
7368
flake8-quotes = { inline-quotes = "single", multiline-quotes = "double" }
7469
isort = { force-single-line = true, known-first-party = ["pysignalr"] }
@@ -79,7 +74,10 @@ strict = true
7974

8075
[tool.pytest.ini_options]
8176
asyncio_mode = "auto"
82-
log_cli_level = "WARNING"
77+
log_cli = true
78+
log_cli_level = "INFO"
79+
log_cli_format = "%(asctime)s [%(levelname)s] %(message)s"
80+
log_cli_date_format = "%Y-%m-%d %H:%M:%S"
8381

8482
[tool.coverage.report]
8583
precision = 2

src/pysignalr/client.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
import uuid
44
from collections import defaultdict
55
from contextlib import asynccontextmanager
6+
from typing import TYPE_CHECKING
67
from typing import Any
78
from typing import AsyncIterator
89
from typing import Awaitable
@@ -20,14 +21,16 @@
2021
from pysignalr.messages import PingMessage
2122
from pysignalr.messages import StreamInvocationMessage
2223
from pysignalr.messages import StreamItemMessage
23-
from pysignalr.protocol.abstract import Protocol
2424
from pysignalr.protocol.json import JSONProtocol
25-
from pysignalr.transport.abstract import Transport
2625
from pysignalr.transport.websocket import DEFAULT_CONNECTION_TIMEOUT
2726
from pysignalr.transport.websocket import DEFAULT_MAX_SIZE
2827
from pysignalr.transport.websocket import DEFAULT_PING_INTERVAL
2928
from pysignalr.transport.websocket import WebsocketTransport
3029

30+
if TYPE_CHECKING:
31+
from pysignalr.protocol.abstract import Protocol
32+
from pysignalr.transport.abstract import Transport
33+
3134
EmptyCallback = Callable[[], Awaitable[None]]
3235
AnyCallback = Callable[[Any], Awaitable[None]]
3336
MessageCallback = Callable[[Message], Awaitable[None]]

src/pysignalr/transport/websocket.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
import logging
55
from contextlib import suppress
66
from http import HTTPStatus
7+
from typing import TYPE_CHECKING
78
from typing import Awaitable
89
from typing import Callable
910

@@ -20,13 +21,15 @@
2021
from pysignalr.messages import CompletionMessage
2122
from pysignalr.messages import Message
2223
from pysignalr.messages import PingMessage
23-
from pysignalr.protocol.abstract import Protocol
2424
from pysignalr.transport.abstract import ConnectionState
2525
from pysignalr.transport.abstract import Transport
2626
from pysignalr.utils import get_connection_url
2727
from pysignalr.utils import get_negotiate_url
2828
from pysignalr.utils import replace_scheme
2929

30+
if TYPE_CHECKING:
31+
from pysignalr.protocol.abstract import Protocol
32+
3033
DEFAULT_MAX_SIZE = 2**20 # 1 MB
3134
DEFAULT_PING_INTERVAL = 10
3235
DEFAULT_CONNECTION_TIMEOUT = 10

tests/pytest.ini

Lines changed: 0 additions & 5 deletions
This file was deleted.

0 commit comments

Comments
 (0)