ruff: enable TC — flake8-type-checking (#11368)

## Problem

`TYPE_CHECKING` is used inconsistently across Python tests.

## Summary of changes
- Update `ruff`: 0.7.0 -> 0.11.2
- Enable TC (flake8-type-checking):
https://docs.astral.sh/ruff/rules/#flake8-type-checking-tc
- (auto)fix all new issues
This commit is contained in:
Alexander Bayandin
2025-03-30 20:58:33 +02:00
committed by GitHub
parent db5384e1b0
commit 30a7dd630c
169 changed files with 1263 additions and 888 deletions

View File

@@ -4,9 +4,8 @@ import asyncio
import random
import time
from dataclasses import dataclass
from pathlib import Path
from typing import TYPE_CHECKING
import asyncpg
import pytest
import toml
from fixtures.common_types import Lsn, TenantId, TimelineId
@@ -21,6 +20,11 @@ from fixtures.neon_fixtures import (
from fixtures.remote_storage import RemoteStorageKind
from fixtures.utils import skip_in_debug_build
if TYPE_CHECKING:
from pathlib import Path
import asyncpg
log = getLogger("root.safekeeper_async")
@@ -692,7 +696,7 @@ async def run_race_conditions(env: NeonEnv, endpoint: Endpoint):
expected_sum += i
i += 1
log.info(f"Executed {i-1} queries")
log.info(f"Executed {i - 1} queries")
res = await conn.fetchval("SELECT sum(key) FROM t")
assert res == expected_sum
@@ -766,7 +770,7 @@ async def run_wal_lagging(env: NeonEnv, endpoint: Endpoint, test_output_dir: Pat
endpoint.start()
conn = await endpoint.connect_async()
log.info(f"Executed {i-1} queries")
log.info(f"Executed {i - 1} queries")
res = await conn.fetchval("SELECT sum(key) FROM t")
assert res == expected_sum