Before ruff:
if TYPE_CHECKING:
def compress(bytes: Sequence[int], target: int) -> list[int]:
"""Docs"
... # <- this tells type-checkers to treat this function like a stub and ignore its body
After ruff:
if TYPE_CHECKING:
def compress(bytes: Sequence[int], target: int) -> list[int]: # type: ignore
"""Docs"""
# Without ... the type-checker assumes the return type is None
# thus the type-checker marks the return-type annotation as an error.
The ellipses signals to the type-checker (e.g. pyright) that function is acting as a stub and the body should be ignored. In the latter case, the type-checker thinks that the function returns None and thus marks the return-type as an error.
I.e. without the ellipses, you have to either: provide a fake function body or # type: ignore the function's signature, which would mask actual type-errors in the signature.