Skip to content

Commit 779e08a

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

15 files changed

Lines changed: 51 additions & 27 deletions

File tree

‎README.md‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,6 @@ async def main() -> None:
6868

6969
print(res.result())
7070
db_pool.close()
71-
7271
```
7372

7473
## Benchmarks

‎docs/components/connection.md‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ db_pool: Final = ConnectionPool(
1616
dsn="postgres://postgres:postgres@localhost:5432/postgres",
1717
)
1818

19+
1920
async def main() -> None:
2021
connection = await db_pool.connection()
2122
```
@@ -24,6 +25,7 @@ async def main() -> None:
2425
```python
2526
from psqlpy import connect
2627

28+
2729
async def main() -> None:
2830
db_connection: Final = await connect(
2931
dsn="postgres://postgres:postgres@localhost:5432/postgres",
@@ -39,6 +41,7 @@ db_pool: Final = ConnectionPool(
3941
dsn="postgres://postgres:postgres@localhost:5432/postgres",
4042
)
4143

44+
4245
async def main() -> None:
4346
async with db_pool.acquire() as connection:
4447
# connection is valid here
@@ -197,6 +200,7 @@ async def main() -> None:
197200
```python
198201
from psqlpy import IsolationLevel, ReadVariant
199202

203+
200204
async def main() -> None:
201205
...
202206
connection = await db_pool.connection()
@@ -236,6 +240,7 @@ Prepare statement and return new instance.
236240
```python
237241
from psqlpy import IsolationLevel, ReadVariant
238242

243+
239244
async def main() -> None:
240245
...
241246
connection = await db_pool.connection()

‎docs/components/copy.md‎

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -75,12 +75,13 @@ This is the ergonomic alternative to `binary_copy_to_table` when you have Python
7575
```python
7676
from datetime import datetime, timezone
7777

78+
7879
async def main() -> None:
7980
...
8081
connection = await db_pool.connection()
8182
records = [
82-
(1, "alpha", 1.5, datetime(2026, 1, 1, tzinfo=timezone.utc)),
83-
(2, "beta", 2.25, datetime(2026, 1, 2, tzinfo=timezone.utc)),
83+
(1, "alpha", 1.5, datetime(2026, 1, 1, tzinfo=timezone.utc)),
84+
(2, "beta", 2.25, datetime(2026, 1, 2, tzinfo=timezone.utc)),
8485
(3, "gamma", None, datetime(2026, 1, 3, tzinfo=timezone.utc)),
8586
]
8687
inserted = await connection.copy_records_to_table(
@@ -94,12 +95,13 @@ async def main() -> None:
9495
```python
9596
from datetime import datetime, timezone
9697

98+
9799
async def main() -> None:
98100
...
99101
connection = await db_pool.connection()
100102
records = [
101-
(1, "alpha", 1.5, datetime(2026, 1, 1, tzinfo=timezone.utc)),
102-
(2, "beta", 2.25, datetime(2026, 1, 2, tzinfo=timezone.utc)),
103+
(1, "alpha", 1.5, datetime(2026, 1, 1, tzinfo=timezone.utc)),
104+
(2, "beta", 2.25, datetime(2026, 1, 2, tzinfo=timezone.utc)),
103105
(3, "gamma", None, datetime(2026, 1, 3, tzinfo=timezone.utc)),
104106
]
105107
async with connection.transaction() as transaction:

‎docs/components/cursor.md‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ Cursor can be used in different ways.
2222
```python
2323
from psqlpy import ConnectionPool, QueryResult
2424

25+
2526
async def main() -> None:
2627
db_pool = ConnectionPool()
2728
connection = await db_pool.connection()
@@ -38,6 +39,7 @@ async def main() -> None:
3839
```python
3940
from psqlpy import ConnectionPool, QueryResult
4041

42+
4143
async def main() -> None:
4244
db_pool = ConnectionPool()
4345
connection = await db_pool.connection()
@@ -54,6 +56,7 @@ async def main() -> None:
5456
```python
5557
from psqlpy import ConnectionPool, QueryResult
5658

59+
5760
async def main() -> None:
5861
db_pool = ConnectionPool()
5962
connection = await db_pool.connection()
@@ -70,6 +73,7 @@ async def main() -> None:
7073
```python
7174
from psqlpy import ConnectionPool, QueryResult
7275

76+
7377
async def main() -> None:
7478
db_pool = ConnectionPool()
7579
connection = await db_pool.connection()

‎docs/components/listener.md‎

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ db_pool = ConnectionPool(
2121
dsn="postgres://postgres:postgres@localhost:5432/postgres",
2222
)
2323

24+
2425
async def test_channel_callback(
2526
connection: Connection,
2627
payload: str,
@@ -30,6 +31,7 @@ async def test_channel_callback(
3031
# do some important staff
3132
...
3233

34+
3335
async def main() -> None:
3436
# Create listener object
3537
listener: Listener = db_pool.listener()
@@ -66,6 +68,7 @@ db_pool = ConnectionPool(
6668
dsn="postgres://postgres:postgres@localhost:5432/postgres",
6769
)
6870

71+
6972
async def main() -> None:
7073
# Create listener object
7174
listener: Listener = db_pool.listener()
@@ -127,22 +130,21 @@ Callback signature is like this:
127130
```python
128131
from psqlpy import Connection
129132

133+
130134
async def callback(
131135
connection: Connection,
132136
payload: str,
133137
channel: str,
134138
process_id: int,
135-
) -> None:
136-
...
139+
) -> None: ...
137140
```
138141

139142
Parameters for callback are based like `args`, so this signature is correct to:
140143
```python
141144
async def callback(
142145
connection: Connection,
143146
*args,
144-
) -> None:
145-
...
147+
) -> None: ...
146148
```
147149

148150
**Example:**
@@ -152,8 +154,8 @@ async def test_channel_callback(
152154
payload: str,
153155
channel: str,
154156
process_id: int,
155-
) -> None:
156-
...
157+
) -> None: ...
158+
157159

158160
async def main() -> None:
159161
listener = db_pool.listener()

‎docs/components/prepared_statement.md‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ db_pool: Final = ConnectionPool(
1616
dsn="postgres://postgres:postgres@localhost:5432/postgres",
1717
)
1818

19+
1920
async def main() -> None:
2021
connection = await db_pool.connection()
2122
prepared_stmt = await connection.prepare(
@@ -34,6 +35,7 @@ db_pool: Final = ConnectionPool(
3435
dsn="postgres://postgres:postgres@localhost:5432/postgres",
3536
)
3637

38+
3739
async def main() -> None:
3840
connection = await db_pool.connection()
3941
prepared_stmt: PreparedStatement = await connection.prepare(

‎docs/components/transaction.md‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -334,7 +334,6 @@ async def main() -> None:
334334
),
335335
]
336336
)
337-
338337
```
339338

340339
### Create Savepoint
@@ -424,7 +423,7 @@ async def main() -> None:
424423

425424
async for fetched_result in cursor:
426425
dict_result: List[Dict[Any, Any]] = fetched_result.result()
427-
... # do something with the result.
426+
... # do something with the result.
428427
```
429428

430429
### COPY FROM STDIN

‎docs/faq.md‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ The main problem is PostgreSQL expects `LIMIT` and `OFFSET` to be BIGINT type bu
1212
from psqlpy import ConnectionPool
1313
from psqlpy.extra_types import BigInt
1414

15+
1516
# --- Incorrect ---
1617
async def main() -> None:
1718
pool = ConnectionPool()
@@ -37,6 +38,7 @@ Instead of using `WHERE <field> IN ()` clause you must use `WHERE <field> = ANY(
3738
```python
3839
from psqlpy import ConnectionPool
3940

41+
4042
# --- Incorrect ---
4143
async def main() -> None:
4244
pool = ConnectionPool()
@@ -72,6 +74,7 @@ For example, when we want to make `WHERE` clause with `ANY` and string values, w
7274
from psqlpy import ConnectionPool
7375
from psqlpy.extra_types import TextArray
7476

77+
7578
# --- Incorrect ---
7679
async def main() -> None:
7780
pool = ConnectionPool()
@@ -105,6 +108,7 @@ The main problem that we cannot determine the type of the empty sequence passed
105108
from psqlpy import ConnectionPool
106109
from psqlpy.extra_types import VarCharArray
107110

111+
108112
# --- Incorrect ---
109113
async def main() -> None:
110114
pool = ConnectionPool()

‎docs/usage/frameworks/aiohttp.md‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,10 +47,9 @@ async def pg_pool_example(request: web.Request):
4747

4848
application = web.Application()
4949
application.on_startup.append(start_db_pool)
50-
application.add_routes([web.get('/', pg_pool_example)])
50+
application.add_routes([web.get("/", pg_pool_example)])
5151

5252

5353
if __name__ == "__main__":
5454
web.run_app(application)
55-
5655
```

‎docs/usage/frameworks/litestar.md‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,5 +61,4 @@ if __name__ == "__main__":
6161
uvicorn.run(
6262
"start_example:app",
6363
)
64-
6564
```

0 commit comments

Comments
 (0)