Use the FileDescriptorOrPath alias consistently in the stdlib (#9513)

This commit is contained in:
Avasam
2023-01-12 13:14:48 -05:00
committed by GitHub
parent f64807a468
commit aad1a14890
12 changed files with 61 additions and 57 deletions

View File

@@ -1,5 +1,5 @@
import os
from _typeshed import BytesPath, StrOrBytesPath, StrPath, SupportsRichComparisonT
from _typeshed import BytesPath, FileDescriptorOrPath, StrPath, SupportsRichComparisonT
from collections.abc import Sequence
from typing import overload
from typing_extensions import Literal, LiteralString
@@ -31,16 +31,16 @@ def commonprefix(m: Sequence[BytesPath]) -> bytes | Literal[""]: ...
def commonprefix(m: Sequence[list[SupportsRichComparisonT]]) -> Sequence[SupportsRichComparisonT]: ...
@overload
def commonprefix(m: Sequence[tuple[SupportsRichComparisonT, ...]]) -> Sequence[SupportsRichComparisonT]: ...
def exists(path: StrOrBytesPath | int) -> bool: ...
def getsize(filename: StrOrBytesPath | int) -> int: ...
def isfile(path: StrOrBytesPath | int) -> bool: ...
def isdir(s: StrOrBytesPath | int) -> bool: ...
def exists(path: FileDescriptorOrPath) -> bool: ...
def getsize(filename: FileDescriptorOrPath) -> int: ...
def isfile(path: FileDescriptorOrPath) -> bool: ...
def isdir(s: FileDescriptorOrPath) -> bool: ...
# These return float if os.stat_float_times() == True,
# but int is a subclass of float.
def getatime(filename: StrOrBytesPath | int) -> float: ...
def getmtime(filename: StrOrBytesPath | int) -> float: ...
def getctime(filename: StrOrBytesPath | int) -> float: ...
def samefile(f1: StrOrBytesPath | int, f2: StrOrBytesPath | int) -> bool: ...
def getatime(filename: FileDescriptorOrPath) -> float: ...
def getmtime(filename: FileDescriptorOrPath) -> float: ...
def getctime(filename: FileDescriptorOrPath) -> float: ...
def samefile(f1: FileDescriptorOrPath, f2: FileDescriptorOrPath) -> bool: ...
def sameopenfile(fp1: int, fp2: int) -> bool: ...
def samestat(s1: os.stat_result, s2: os.stat_result) -> bool: ...