Skip to content
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
89 changes: 45 additions & 44 deletions stubs/cffi/_cffi_backend.pyi
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import sys
import types
from _typeshed import Incomplete, ReadableBuffer, WriteableBuffer
from _typeshed import ReadableBuffer, WriteableBuffer
from collections.abc import Callable, Hashable
from typing import Any, ClassVar, Literal, Protocol, SupportsIndex, TypeVar, final, overload, type_check_only
from typing_extensions import Self, TypeAlias, disjoint_base
Expand All @@ -27,11 +27,11 @@ if sys.platform != "win32":

@final
class CField:
bitshift: Incomplete
bitsize: Incomplete
flags: Incomplete
offset: Incomplete
type: Incomplete
bitshift: int
bitsize: int
flags: int
offset: int
type: CType

@final
class CLibrary:
Expand All @@ -42,18 +42,21 @@ class CLibrary:

@final
class CType:
abi: Incomplete
args: Incomplete
cname: Incomplete
elements: Incomplete
ellipsis: Incomplete
fields: Incomplete
item: Incomplete
kind: Incomplete
length: Incomplete
relements: Incomplete
result: Incomplete
def __dir__(self): ...
cname: str
kind: Literal["enum", "primitive", "pointer", "array", "void", "struct", "union", "function"]

abi: int
args: tuple[CType, ...]
ellipsis: bool
result: CType

item: CType
length: int | None

fields: list[tuple[str, CField]] | None

relements: dict[str, int]
elements: dict[int, str]

@final
class Lib:
Expand All @@ -62,48 +65,46 @@ class Lib:
@final
class _CDataBase:
__name__: ClassVar[str]
def __add__(self, other, /): ...
def __bool__(self) -> bool: ...
def __call__(self, *args, **kwargs): ...
def __complex__(self) -> complex: ...
def __delitem__(self, other, /) -> None: ...
def __dir__(self): ...
def __enter__(self): ...
def __eq__(self, other, /): ...
def __enter__(self) -> Self: ...
def __exit__(
self, type: type[BaseException] | None, value: BaseException | None, traceback: types.TracebackType | None, /
): ...
def __add__(self, other, /): ...
def __sub__(self, other, /): ...
def __radd__(self, other, /): ...
def __rsub__(self, other, /): ...
def __call__(self, *args): ...
def __hash__(self) -> int: ...
def __bool__(self) -> bool: ...
def __int__(self) -> int: ...
def __float__(self) -> float: ...
def __complex__(self) -> complex: ...
def __eq__(self, other, /): ...
def __ne__(self, other, /): ...
def __ge__(self, other, /): ...
def __getitem__(self, index: SupportsIndex | slice, /): ...
def __gt__(self, other, /): ...
def __hash__(self) -> int: ...
def __int__(self) -> int: ...
def __iter__(self): ...
def __le__(self, other, /): ...
def __len__(self) -> int: ...
def __lt__(self, other, /): ...
def __ne__(self, other, /): ...
def __radd__(self, other, /): ...
def __rsub__(self, other, /): ...
def __iter__(self): ...
def __len__(self) -> int: ...
def __getitem__(self, index: SupportsIndex | slice, /): ...
def __setitem__(self, index: SupportsIndex | slice, object, /) -> None: ...
def __sub__(self, other, /): ...

@final
class buffer:
__hash__: ClassVar[None] # type: ignore[assignment]
def __new__(cls, *args, **kwargs) -> Self: ...
def __new__(cls, cdata: _CDataBase, size: int = -1) -> Self: ...
def __buffer__(self, flags: int, /) -> memoryview: ...
def __delitem__(self, other, /) -> None: ...
def __eq__(self, other, /): ...
def __ge__(self, other, /): ...
def __getitem__(self, index, /): ...
def __gt__(self, other, /): ...
def __le__(self, other, /): ...
def __eq__(self, other: ReadableBuffer, /) -> bool: ... # type: ignore[override]
def __ne__(self, other: ReadableBuffer, /) -> bool: ... # type: ignore[override]
def __ge__(self, other: ReadableBuffer, /) -> bool: ...
def __gt__(self, other: ReadableBuffer, /) -> bool: ...
def __le__(self, other: ReadableBuffer, /) -> bool: ...
def __lt__(self, other: ReadableBuffer, /) -> bool: ...
def __len__(self) -> int: ...
def __lt__(self, other, /): ...
def __ne__(self, other, /): ...
def __setitem__(self, index, object, /) -> None: ...
def __getitem__(self, index: SupportsIndex | slice, /) -> bytes: ...
def __setitem__(self, index: SupportsIndex | slice, value: bytes, /) -> None: ...

# These aliases are to work around pyright complaints.
# Pyright doesn't like it when a class object is defined as an alias
Expand Down
Loading