Skip to content

Commit

Permalink
[pre-commit.ci] auto fixes from pre-commit.com hooks
Browse files Browse the repository at this point in the history
for more information, see https://pre-commit.ci
  • Loading branch information
pre-commit-ci[bot] committed Oct 28, 2024
1 parent da9e4c8 commit 3921993
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 12 deletions.
2 changes: 1 addition & 1 deletion docs/changelog.rst
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ Changelog
0.11.0 (2024-04-12)
-------------------

- Switch to the ``whenever`` package for date/time types, instead of Arrow. See
- Switch to the ``whenever`` package for date/time types, instead of Arrow. See
https://dev.arie.bovenberg.net/blog/python-datetime-pitfalls/ for more information as to why.
- ``pg-purepy`` now passes Pyright strict mode.
- :class:`.Converter` is now a generic type.
Expand Down
2 changes: 1 addition & 1 deletion docs/conversion.rst
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ Date/Time types

.. note::

I use Whenever over the vanilla ``datetime`` objects because I don't like ``datetime``. Write
I use Whenever over the vanilla ``datetime`` objects because I don't like ``datetime``. Write
your own converter if you disagree with me.

Enumeration types
Expand Down
19 changes: 9 additions & 10 deletions src/pg_purepy/connection.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

import types
import warnings
from asyncio import lowlevel
from collections.abc import AsyncGenerator, AsyncIterator, Mapping
from contextlib import aclosing, asynccontextmanager
from os import PathLike, fspath
Expand Down Expand Up @@ -187,7 +188,7 @@ async def _read_until_ready(
"""

if self._protocol.ready:
await anyio.sleep(0)
await lowlevel.checkpoint()
return

while True:
Expand All @@ -210,7 +211,7 @@ async def _read_until_ready(
yield next_event

if isinstance(next_event, ReadyForQuery):
await anyio.sleep(0) # checkpoint()
await lowlevel.checkpoint() # checkpoint()
return

to_send = self._protocol.get_needed_synchronisation()
Expand Down Expand Up @@ -288,13 +289,11 @@ async def lowlevel_query(
if not self._protocol.ready:
await self.wait_until_ready()

simple_query = all(
(
not (params or kwargs),
not isinstance(query, PreparedStatementInfo),
max_rows is None,
)
)
simple_query = all((
not (params or kwargs),
not isinstance(query, PreparedStatementInfo),
max_rows is None,
))

logger.debug("Executing query", query=query)
if simple_query:
Expand Down Expand Up @@ -527,7 +526,7 @@ async def row_count(self) -> int:
"""

if self._row_count >= 0:
await anyio.sleep(0) # checkpoint
await lowlevel.checkpoint() # checkpoint
return self._row_count

async for _ in self:
Expand Down

0 comments on commit 3921993

Please sign in to comment.