import logging
import weakref
from time import time
-from typing import Any, Dict
+from typing import Any
import pytest
pool.ConnectionPool(min_size=min_size, max_size=max_size)
-class MyRow(Dict[str, Any]):
+class MyRow(dict[str, Any]):
pass
import logging
import weakref
from time import time
-from typing import Any, Dict
+from typing import Any
import pytest
pool.AsyncConnectionPool(min_size=min_size, max_size=max_size)
-class MyRow(Dict[str, Any]):
+class MyRow(dict[str, Any]):
pass
from __future__ import annotations
import logging
-from typing import Any, Dict
+from typing import Any
import pytest
from packaging.version import parse as ver # noqa: F401 # used in skipif
pool.NullConnectionPool(min_size=min_size, max_size=max_size)
-class MyRow(Dict[str, Any]):
+class MyRow(dict[str, Any]):
pass
from __future__ import annotations
import logging
-from typing import Any, Dict
+from typing import Any
import pytest
from packaging.version import parse as ver # noqa: F401 # used in skipif
pool.AsyncNullConnectionPool(min_size=min_size, max_size=max_size)
-class MyRow(Dict[str, Any]):
+class MyRow(dict[str, Any]):
pass
cp = mypy.run_on_source(src)
out = cp.stdout.decode("utf8", "replace").splitlines()
assert len(out) == 2, "\n".join(out)
- got, want = [mypy.get_revealed(line) for line in out]
+ got, want = (mypy.get_revealed(line) for line in out)
assert got == want
cp = mypy.run_on_source(src)
out = cp.stdout.decode("utf8", "replace").splitlines()
assert len(out) == 2, "\n".join(out)
- got, want = [mypy.get_revealed(line) for line in out]
+ got, want = (mypy.get_revealed(line) for line in out)
assert got == want
def update_file(fn: Path, content: str) -> None:
logger.info("updating %s", fn)
- with open(fn, "r") as f:
+ with open(fn) as f:
lines = f.read().splitlines()
- istart, iend = [
+ istart, iend = (
i
for i, line in enumerate(lines)
if re.match(r"\s*(#|\.\.)\s*autogenerated:\s+(start|end)", line)
- ]
+ )
lines[istart + 1 : iend] = [content]
def update_file(fn, new_lines):
logger.info("updating %s", fn)
- with open(fn, "r") as f:
+ with open(fn) as f:
lines = f.read().splitlines()
- istart, iend = [
+ istart, iend = (
i
for i, line in enumerate(lines)
if re.match(r"\s*(#|\.\.)\s*autogenerated:\s+(start|end)", line)
- ]
+ )
lines[istart + 1 : iend] = new_lines
def update_file(fn: Path, new: list[str]) -> None:
with fn.open("r") as f:
lines = f.read().splitlines()
- istart, iend = [
+ istart, iend = (
i
for i, line in enumerate(lines)
if re.match(r"\s*#\s*autogenerated:\s+(start|end)", line)
- ]
+ )
lines[istart + 1 : iend] = new + [""]
with fn.open("w") as f: