Use SupportsFlush from typeshed to fix TODO (#13166)

This commit is contained in:
Konstantin Baikov
2024-12-03 09:05:06 +01:00
committed by GitHub
parent 9d743a3f1e
commit 09dca1a7d0

View File

@@ -1,7 +1,7 @@
# pyright: reportInvalidStubStatement=none
import sys
from _typeshed import StrPath, SupportsKeysAndGetItem, SupportsWrite
from _typeshed import StrPath, SupportsFlush, SupportsKeysAndGetItem, SupportsWrite
from argparse import Namespace
from collections.abc import Callable, Iterable, Sequence
from logging import Logger
@@ -20,9 +20,7 @@ _AlembicConfigValue: TypeAlias = Any
alembic_version: tuple[int, int, int]
log: Logger
# TODO: Use _typeshed.SupportsFlush when it's available in type checkers.
class _SupportsWriteAndFlush(SupportsWrite[_T_contra], Protocol):
def flush(self) -> object: ...
class _SupportsWriteAndFlush(SupportsWrite[_T_contra], SupportsFlush, Protocol): ...
class Config: # should inherit from alembic.config.Config which is not possible yet
template_directory: str | None