mirror of
https://github.com/davidhalter/typeshed.git
synced 2025-12-09 05:24:52 +08:00
16 lines
454 B
Python
16 lines
454 B
Python
from typing import Any, BinaryIO, Callable, Protocol, Text, Union, overload
|
|
|
|
class _ReadableBinary(Protocol):
|
|
def tell(self) -> int: ...
|
|
def read(self, size: int) -> bytes: ...
|
|
def seek(self, offset: int) -> Any: ...
|
|
|
|
_File = Union[Text, _ReadableBinary]
|
|
|
|
@overload
|
|
def what(file: _File, h: None = ...) -> str | None: ...
|
|
@overload
|
|
def what(file: Any, h: bytes) -> str | None: ...
|
|
|
|
tests: list[Callable[[bytes, BinaryIO | None], str | None]]
|