Use strict flake8-type-checking settings in Ruff

This commit is contained in:
Adam Turner
2025-01-13 21:56:36 +00:00
parent f6d1665f84
commit 66905d24e1
39 changed files with 125 additions and 60 deletions

View File

@@ -1,7 +1,10 @@
from __future__ import annotations
import io # NoQA: TC003
from typing import Optional, overload
from typing import TYPE_CHECKING, overload
if TYPE_CHECKING:
from typing import Optional
myint = int

View File

@@ -1,6 +1,9 @@
from __future__ import annotations
from typing import Any, overload
from typing import TYPE_CHECKING, overload
if TYPE_CHECKING:
from typing import Any
@overload

View File

@@ -1,7 +1,7 @@
from __future__ import annotations
from datetime import datetime
from typing import Any
from typing import Any # NoQA: TC003
CONSTANT = 'foo'
SENTINEL = object()

View File

@@ -1,7 +1,10 @@
from __future__ import annotations
import pathlib
from typing import Any, Tuple, TypeVar, Union # NoQA: UP035
from typing import TYPE_CHECKING, Tuple, TypeVar, Union # NoQA: UP035
if TYPE_CHECKING:
from typing import Any
CONST1: int
#: docstring

View File

@@ -2,7 +2,7 @@ from __future__ import annotations
from contextlib import contextmanager
from functools import lru_cache
from typing import Generator # NoQA: UP035
from typing import Generator # NoQA: TC003,UP035
@lru_cache(maxsize=None) # NoQA: UP033

View File

@@ -21,7 +21,6 @@ from urllib3.poolmanager import PoolManager
import sphinx.util.http_date
from sphinx.builders.linkcheck import (
CheckRequest,
CheckResult,
Hyperlink,
HyperlinkAvailabilityCheckWorker,
RateLimit,
@@ -41,6 +40,9 @@ if TYPE_CHECKING:
from urllib3 import HTTPConnectionPool
from sphinx.builders.linkcheck import (
CheckResult,
)
from sphinx.testing.util import SphinxTestApp