mirror of
https://github.com/davidhalter/typeshed.git
synced 2025-12-08 04:54:47 +08:00
Fold remaining custom stdlib *Buffer types into _typeshed. (#6082)
Add ctypes base type to WriteableBuffer. Add a ReadOnlyBuffer type from fcntl. Base ReadableBuffer on WriteableBuffer and ReadOnlyBuffer. Use these types in fcntl and ctypes stubs.
This commit is contained in:
committed by
GitHub
parent
328d09a9a5
commit
4c0dccac0f
@@ -1,7 +1,6 @@
|
||||
import sys
|
||||
from _typeshed import FileDescriptorLike
|
||||
from array import array
|
||||
from typing import Any, Union, overload
|
||||
from _typeshed import FileDescriptorLike, ReadOnlyBuffer, WriteableBuffer
|
||||
from typing import Any, overload
|
||||
from typing_extensions import Literal
|
||||
|
||||
FASYNC: int
|
||||
@@ -85,17 +84,13 @@ LOCK_WRITE: int
|
||||
def fcntl(__fd: FileDescriptorLike, __cmd: int, __arg: int = ...) -> int: ...
|
||||
@overload
|
||||
def fcntl(__fd: FileDescriptorLike, __cmd: int, __arg: bytes) -> bytes: ...
|
||||
|
||||
_ReadOnlyBuffer = bytes
|
||||
_WritableBuffer = Union[bytearray, memoryview, array[Any]]
|
||||
|
||||
@overload
|
||||
def ioctl(__fd: FileDescriptorLike, __request: int, __arg: int = ..., __mutate_flag: bool = ...) -> int: ...
|
||||
@overload
|
||||
def ioctl(__fd: FileDescriptorLike, __request: int, __arg: _WritableBuffer, __mutate_flag: Literal[True] = ...) -> int: ...
|
||||
def ioctl(__fd: FileDescriptorLike, __request: int, __arg: WriteableBuffer, __mutate_flag: Literal[True] = ...) -> int: ...
|
||||
@overload
|
||||
def ioctl(__fd: FileDescriptorLike, __request: int, __arg: _WritableBuffer, __mutate_flag: Literal[False]) -> bytes: ...
|
||||
def ioctl(__fd: FileDescriptorLike, __request: int, __arg: WriteableBuffer, __mutate_flag: Literal[False]) -> bytes: ...
|
||||
@overload
|
||||
def ioctl(__fd: FileDescriptorLike, __request: int, __arg: _ReadOnlyBuffer, __mutate_flag: bool = ...) -> bytes: ...
|
||||
def ioctl(__fd: FileDescriptorLike, __request: int, __arg: ReadOnlyBuffer, __mutate_flag: bool = ...) -> bytes: ...
|
||||
def flock(__fd: FileDescriptorLike, __operation: int) -> None: ...
|
||||
def lockf(__fd: FileDescriptorLike, __cmd: int, __len: int = ..., __start: int = ..., __whence: int = ...) -> Any: ...
|
||||
|
||||
Reference in New Issue
Block a user