mirror of
https://github.com/davidhalter/typeshed.git
synced 2025-12-07 20:54:28 +08:00
Hopeful fix for fcntl stubs -- change return values back to Any.
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
from typing import Union
|
||||
from typing import Any, Union
|
||||
import io
|
||||
|
||||
FASYNC = ... # type: int
|
||||
@@ -74,12 +74,14 @@ LOCK_WRITE = ... # type: int
|
||||
|
||||
_ANYFILE = Union[int, io.IOBase]
|
||||
|
||||
def fcntl(fd: _ANYFILE, op: int, arg: Union[int, str] = ...) -> Union[int, str]: ...
|
||||
# TODO All these return either int or bytes depending on the value of
|
||||
# cmd (not on the type of arg).
|
||||
def fcntl(fd: _ANYFILE, op: int, arg: Union[int, bytes] = ...) -> Any: ...
|
||||
|
||||
# TODO: arg: int or read-only buffer interface or read-write buffer interface
|
||||
def ioctl(fd: _ANYFILE, op: int, arg: Union[int, str] = ...,
|
||||
mutate_flag: bool = ...) -> Union[int, str]: ...
|
||||
def ioctl(fd: _ANYFILE, op: int, arg: Union[int, bytes] = ...,
|
||||
mutate_flag: bool = ...) -> Any: ...
|
||||
|
||||
def flock(fd: _ANYFILE, op: int) -> None: ...
|
||||
def lockf(fd: _ANYFILE, op: int, length: int = ..., start: int = ...,
|
||||
whence: int = ...) -> Union[int, str]: ...
|
||||
whence: int = ...) -> Any: ...
|
||||
|
||||
@@ -77,18 +77,20 @@ LOCK_WRITE = ... # type: int
|
||||
|
||||
_AnyFile = Union[int, IO[Any]]
|
||||
|
||||
# TODO All these return either int or bytes depending on the value of
|
||||
# cmd (not on the type of arg).
|
||||
def fcntl(fd: _AnyFile,
|
||||
cmd: int,
|
||||
arg: Union[int, bytes] = ...) -> Union[int, bytes]: ...
|
||||
arg: Union[int, bytes] = ...) -> Any: ...
|
||||
# TODO This function accepts any object supporting a buffer interface,
|
||||
# as arg, is there a better way to express this than bytes?
|
||||
def ioctl(fd: _AnyFile,
|
||||
request: int,
|
||||
arg: Union[int, bytes] = ...,
|
||||
mutate_flag: bool = ...) -> Union[int, bytes]: ...
|
||||
mutate_flag: bool = ...) -> Any: ...
|
||||
def flock(fd: _AnyFile, operation: int) -> None: ...
|
||||
def lockf(fd: _AnyFile,
|
||||
cmd: int,
|
||||
len: int = ...,
|
||||
start: int = ...,
|
||||
whence: int = ...) -> Union[int, bytes]: ...
|
||||
whence: int = ...) -> Any: ...
|
||||
|
||||
Reference in New Issue
Block a user