Skip to content

Commit 324a766

Browse files
[pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
1 parent d5d4458 commit 324a766

File tree

3 files changed

+15
-16
lines changed

3 files changed

+15
-16
lines changed

python/psqlpy/_internal/__init__.pyi

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1775,46 +1775,45 @@ class Listener:
17751775
self: Self,
17761776
channel: str,
17771777
callback: Callable[
1778-
[str, str, int, Connection], Awaitable[None],
1778+
[str, str, int, Connection],
1779+
Awaitable[None],
17791780
],
17801781
) -> None:
17811782
"""Add callback to the channel.
1782-
1783+
17831784
Callback must be async function and have signature like this:
17841785
```python
17851786
async def callback(
17861787
channel: str,
17871788
payload: str,
17881789
process_id: str,
17891790
connection: Connection,
1790-
) -> None:
1791-
...
1791+
) -> None: ...
17921792
```
17931793
"""
1794-
1794+
17951795
async def clear_channel_callbacks(self, channel: str) -> None:
17961796
"""Remove all callbacks for the channel.
1797-
1797+
17981798
### Parameters:
17991799
- `channel`: name of the channel.
18001800
"""
18011801

18021802
async def listen(self: Self) -> None:
18031803
"""Start listening.
18041804
1805-
Start actual listening.
1806-
In the background it creates task in Rust event loop.
1805+
Start actual listening.
1806+
In the background it creates task in Rust event loop.
18071807
You must save returned Future to the array.
18081808
"""
18091809

18101810
async def abort_listen(self: Self) -> None:
18111811
"""Abort listen.
1812-
1813-
If `listen()` method was called, stop listening,
1812+
1813+
If `listen()` method was called, stop listening,
18141814
else don't do anything.
18151815
"""
18161816

1817-
18181817
class ListenerNotificationMsg:
18191818
"""Listener message in async iterator."""
18201819

src/driver/listener/core.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ impl Listener {
115115

116116
return Ok(());
117117
}
118-
118+
119119
return Err(RustPSQLDriverError::ListenerClosedError)
120120
}
121121

src/driver/listener/structs.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -74,17 +74,17 @@ impl ListenerNotificationMsg {
7474
fn process_id(&self) -> i32 {
7575
self.process_id
7676
}
77-
77+
7878
#[getter]
7979
fn channel(&self) -> String {
8080
self.channel.clone()
8181
}
82-
82+
8383
#[getter]
8484
fn payload(&self) -> String {
8585
self.payload.clone()
8686
}
87-
87+
8888
#[getter]
8989
fn connection(&self) -> Connection {
9090
self.connection.clone()
@@ -129,7 +129,7 @@ impl ListenerCallback {
129129
}
130130
(self.callback.clone(), None)
131131
});
132-
132+
133133
if let Some(task_locals) = task_locals {
134134
tokio_runtime().spawn(pyo3_async_runtimes::tokio::scope(task_locals, async move {
135135
let future = Python::with_gil(|py| {

0 commit comments

Comments
 (0)