Add missing functions and keyword arguments to aiofiles.os (#6785)

Co-authored-by: Akuli <akuviljanen17@gmail.com>
This commit is contained in:
Joseph Young
2022-01-02 18:08:00 +00:00
committed by GitHub
parent 1bfcf30a50
commit 4538770404
3 changed files with 56 additions and 8 deletions

View File

@@ -30,3 +30,13 @@ aiofiles.threadpool.text.AsyncTextIOWrapper.readable
aiofiles.threadpool.text.AsyncTextIOWrapper.seekable
aiofiles.threadpool.text.AsyncTextIOWrapper.tell
aiofiles.threadpool.text.AsyncTextIOWrapper.writable
# These functions get the wrong signature from functools.wraps()
aiofiles.os.stat
aiofiles.os.rename
aiofiles.os.replace
aiofiles.os.remove
aiofiles.os.mkdir
aiofiles.os.makedirs
aiofiles.os.rmdir
aiofiles.os.removedirs

View File

@@ -1 +1 @@
version = "0.7.*"
version = "0.8.*"

View File

@@ -1,21 +1,56 @@
import sys
from _typeshed import StrOrBytesPath
from asyncio.events import AbstractEventLoop
from os import stat_result
from typing import Sequence, Union, overload
from typing import Any, Sequence, Union, overload
_FdOrAnyPath = Union[int, StrOrBytesPath]
async def stat(path: _FdOrAnyPath, *, dir_fd: int | None = ..., follow_symlinks: bool = ...) -> stat_result: ...
async def stat(
path: _FdOrAnyPath,
*,
dir_fd: int | None = ...,
follow_symlinks: bool = ...,
loop: AbstractEventLoop | None = ...,
executor: Any = ...,
) -> stat_result: ...
async def rename(
src: StrOrBytesPath, dst: StrOrBytesPath, *, src_dir_fd: int | None = ..., dst_dir_fd: int | None = ...
src: StrOrBytesPath,
dst: StrOrBytesPath,
*,
src_dir_fd: int | None = ...,
dst_dir_fd: int | None = ...,
loop: AbstractEventLoop | None = ...,
executor: Any = ...,
) -> None: ...
async def remove(path: StrOrBytesPath, *, dir_fd: int | None = ...) -> None: ...
async def mkdir(path: StrOrBytesPath, mode: int = ..., *, dir_fd: int | None = ...) -> None: ...
async def rmdir(path: StrOrBytesPath, *, dir_fd: int | None = ...) -> None: ...
async def replace(
src: StrOrBytesPath,
dst: StrOrBytesPath,
*,
src_dir_fd: int | None = ...,
dst_dir_fd: int | None = ...,
loop: AbstractEventLoop | None = ...,
executor: Any = ...,
) -> None: ...
async def remove(
path: StrOrBytesPath, *, dir_fd: int | None = ..., loop: AbstractEventLoop | None = ..., executor: Any = ...
) -> None: ...
async def mkdir(
path: StrOrBytesPath, mode: int = ..., *, dir_fd: int | None = ..., loop: AbstractEventLoop | None = ..., executor: Any = ...
) -> None: ...
async def makedirs(
name: StrOrBytesPath, mode: int = ..., exist_ok: bool = ..., *, loop: AbstractEventLoop | None = ..., executor: Any = ...
) -> None: ...
async def rmdir(
path: StrOrBytesPath, *, dir_fd: int | None = ..., loop: AbstractEventLoop | None = ..., executor: Any = ...
) -> None: ...
async def removedirs(name: StrOrBytesPath, *, loop: AbstractEventLoop | None = ..., executor: Any = ...) -> None: ...
if sys.platform != "win32":
@overload
async def sendfile(out_fd: int, in_fd: int, offset: int | None, count: int) -> int: ...
async def sendfile(
out_fd: int, in_fd: int, offset: int | None, count: int, *, loop: AbstractEventLoop | None = ..., executor: Any = ...
) -> int: ...
@overload
async def sendfile(
out_fd: int,
@@ -25,4 +60,7 @@ if sys.platform != "win32":
headers: Sequence[bytes] = ...,
trailers: Sequence[bytes] = ...,
flags: int = ...,
*,
loop: AbstractEventLoop | None = ...,
executor: Any = ...,
) -> int: ... # FreeBSD and Mac OS X only