Add stubs for aiofiles.os.path (#6787)

This commit is contained in:
Joseph Young
2022-01-13 10:31:19 +00:00
committed by GitHub
parent f7534891f1
commit 13e31aa3bf
3 changed files with 35 additions and 4 deletions

View File

@@ -40,3 +40,12 @@ aiofiles.os.mkdir
aiofiles.os.makedirs
aiofiles.os.rmdir
aiofiles.os.removedirs
aiofiles.ospath.exists
aiofiles.ospath.isfile
aiofiles.ospath.isdir
aiofiles.ospath.getsize
aiofiles.ospath.getmtime
aiofiles.ospath.getatime
aiofiles.ospath.getctime
aiofiles.ospath.samefile
aiofiles.ospath.sameopenfile

View File

@@ -4,10 +4,12 @@ from asyncio.events import AbstractEventLoop
from os import stat_result
from typing import Any, Sequence, Union, overload
from . import ospath as path
_FdOrAnyPath = Union[int, StrOrBytesPath]
async def stat(
path: _FdOrAnyPath,
path: _FdOrAnyPath, # noqa: F811
*,
dir_fd: int | None = ...,
follow_symlinks: bool = ...,
@@ -33,16 +35,21 @@ async def replace(
executor: Any = ...,
) -> None: ...
async def remove(
path: StrOrBytesPath, *, dir_fd: int | None = ..., loop: AbstractEventLoop | None = ..., executor: Any = ...
path: StrOrBytesPath, *, dir_fd: int | None = ..., loop: AbstractEventLoop | None = ..., executor: Any = ... # noqa: F811
) -> None: ...
async def mkdir(
path: StrOrBytesPath, mode: int = ..., *, dir_fd: int | None = ..., loop: AbstractEventLoop | None = ..., executor: Any = ...
path: StrOrBytesPath, # noqa: F811
mode: int = ...,
*,
dir_fd: int | None = ...,
loop: AbstractEventLoop | None = ...,
executor: Any = ..., # noqa: F811
) -> 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 = ...
path: StrOrBytesPath, *, dir_fd: int | None = ..., loop: AbstractEventLoop | None = ..., executor: Any = ... # noqa: F811
) -> None: ...
async def removedirs(name: StrOrBytesPath, *, loop: AbstractEventLoop | None = ..., executor: Any = ...) -> None: ...

View File

@@ -0,0 +1,15 @@
from _typeshed import StrOrBytesPath
from asyncio.events import AbstractEventLoop
from typing import Any
async def exists(path: StrOrBytesPath | int, *, loop: AbstractEventLoop | None = ..., executor: Any = ...) -> bool: ...
async def isfile(path: StrOrBytesPath | int, *, loop: AbstractEventLoop | None = ..., executor: Any = ...) -> bool: ...
async def isdir(s: StrOrBytesPath | int, *, loop: AbstractEventLoop | None = ..., executor: Any = ...) -> bool: ...
async def getsize(filename: StrOrBytesPath | int, *, loop: AbstractEventLoop | None = ..., executor: Any = ...) -> int: ...
async def getmtime(filename: StrOrBytesPath | int, *, loop: AbstractEventLoop | None = ..., executor: Any = ...) -> float: ...
async def getatime(filename: StrOrBytesPath | int, *, loop: AbstractEventLoop | None = ..., executor: Any = ...) -> float: ...
async def getctime(filename: StrOrBytesPath | int, *, loop: AbstractEventLoop | None = ..., executor: Any = ...) -> float: ...
async def samefile(
f1: StrOrBytesPath | int, f2: StrOrBytesPath | int, *, loop: AbstractEventLoop | None = ..., executor: Any = ...
) -> bool: ...
async def sameopenfile(fp1: int, fp2: int, *, loop: AbstractEventLoop | None = ..., executor: Any = ...) -> bool: ...