Skip to content

Commit ca481c6

Browse files
stankudrowstankudrowamyreese
authored
Drop Python 3.8, set Python3.9 as the minimum version. (#313)
* run pyupgrade --py39-plus ... * format and lint aiosqlite + tests * bump Python in the CONTRIBUTING.md * Enforce target python version for mypy --------- Co-authored-by: stankudrow <[email protected]> Co-authored-by: Amethyst Reese <[email protected]>
1 parent 883695f commit ca481c6

File tree

5 files changed

+16
-31
lines changed

5 files changed

+16
-31
lines changed

CONTRIBUTING.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
## Preparation
44

5-
You'll need to have at least Python 3.8 available for testing.
5+
You'll need to have at least Python 3.9 available for testing.
66

77
You can do this with [pyenv][]:
88

aiosqlite/context.py

+4-2
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,17 @@
22
# Licensed under the MIT license
33

44

5+
from collections.abc import Coroutine, Generator
6+
from contextlib import AbstractAsyncContextManager
57
from functools import wraps
6-
from typing import Any, AsyncContextManager, Callable, Coroutine, Generator, TypeVar
8+
from typing import Any, Callable, TypeVar
79

810
from .cursor import Cursor
911

1012
_T = TypeVar("_T")
1113

1214

13-
class Result(AsyncContextManager[_T], Coroutine[Any, Any, _T]):
15+
class Result(AbstractAsyncContextManager[_T], Coroutine[Any, Any, _T]):
1416
__slots__ = ("_coro", "_obj")
1517

1618
def __init__(self, coro: Coroutine[Any, Any, _T]):

aiosqlite/core.py

+5-15
Original file line numberDiff line numberDiff line change
@@ -8,22 +8,12 @@
88
import asyncio
99
import logging
1010
import sqlite3
11+
from collections.abc import AsyncIterator, Generator, Iterable
1112
from functools import partial
1213
from pathlib import Path
1314
from queue import Empty, Queue, SimpleQueue
1415
from threading import Thread
15-
from typing import (
16-
Any,
17-
AsyncIterator,
18-
Callable,
19-
Generator,
20-
Iterable,
21-
Literal,
22-
Optional,
23-
Tuple,
24-
Type,
25-
Union,
26-
)
16+
from typing import Any, Callable, Literal, Optional, Union
2717
from warnings import warn
2818

2919
from .context import contextmanager
@@ -63,7 +53,7 @@ def __init__(
6353
self._running = True
6454
self._connection: Optional[sqlite3.Connection] = None
6555
self._connector = connector
66-
self._tx: SimpleQueue[Tuple[asyncio.Future, Callable[[], Any]]] = SimpleQueue()
56+
self._tx: SimpleQueue[tuple[asyncio.Future, Callable[[], Any]]] = SimpleQueue()
6757
self._iter_chunk_size = iter_chunk_size
6858

6959
if loop is not None:
@@ -264,11 +254,11 @@ def isolation_level(self, value: IsolationLevel) -> None:
264254
self._conn.isolation_level = value
265255

266256
@property
267-
def row_factory(self) -> Optional[Type]:
257+
def row_factory(self) -> Optional[type]:
268258
return self._conn.row_factory
269259

270260
@row_factory.setter
271-
def row_factory(self, factory: Optional[Type]) -> None:
261+
def row_factory(self, factory: Optional[type]) -> None:
272262
self._conn.row_factory = factory
273263

274264
@property

aiosqlite/cursor.py

+5-13
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,8 @@
22
# Licensed under the MIT license
33

44
import sqlite3
5-
from typing import (
6-
Any,
7-
AsyncIterator,
8-
Callable,
9-
Iterable,
10-
Optional,
11-
Tuple,
12-
Type,
13-
TYPE_CHECKING,
14-
)
5+
from collections.abc import AsyncIterator, Iterable
6+
from typing import Any, Callable, Optional, TYPE_CHECKING
157

168
if TYPE_CHECKING:
179
from .core import Connection
@@ -66,7 +58,7 @@ async def fetchone(self) -> Optional[sqlite3.Row]:
6658

6759
async def fetchmany(self, size: Optional[int] = None) -> Iterable[sqlite3.Row]:
6860
"""Fetch up to `cursor.arraysize` number of rows."""
69-
args: Tuple[int, ...] = ()
61+
args: tuple[int, ...] = ()
7062
if size is not None:
7163
args = (size,)
7264
return await self._execute(self._cursor.fetchmany, *args)
@@ -96,15 +88,15 @@ def arraysize(self, value: int) -> None:
9688
self._cursor.arraysize = value
9789

9890
@property
99-
def description(self) -> Tuple[Tuple[str, None, None, None, None, None, None], ...]:
91+
def description(self) -> tuple[tuple[str, None, None, None, None, None, None], ...]:
10092
return self._cursor.description
10193

10294
@property
10395
def row_factory(self) -> Optional[Callable[[sqlite3.Cursor, sqlite3.Row], object]]:
10496
return self._cursor.row_factory
10597

10698
@row_factory.setter
107-
def row_factory(self, factory: Optional[Type]) -> None:
99+
def row_factory(self, factory: Optional[type]) -> None:
108100
self._cursor.row_factory = factory
109101

110102
@property

pyproject.toml

+1
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,7 @@ skip_covered = true
6969

7070
[tool.mypy]
7171
ignore_missing_imports = true
72+
python_version = "3.9"
7273

7374
[[tool.mypy.overrides]]
7475
module = "aiosqlite.tests.perf"

0 commit comments

Comments
 (0)