mirror of
https://github.com/davidhalter/typeshed.git
synced 2025-12-08 21:14:48 +08:00
fixes for os.path.commonpath and os.path.commonprefix (#5363)
This commit is contained in:
@@ -3,7 +3,8 @@ import sys
|
||||
from _typeshed import AnyPath, BytesPath, StrPath
|
||||
from genericpath import exists as exists
|
||||
from os import PathLike
|
||||
from typing import Any, AnyStr, Optional, Sequence, Tuple, TypeVar, overload
|
||||
from os.path import commonpath as commonpath, commonprefix as commonprefix, lexists as lexists
|
||||
from typing import AnyStr, Optional, Tuple, TypeVar, overload
|
||||
|
||||
_T = TypeVar("_T")
|
||||
|
||||
@@ -57,15 +58,6 @@ def realpath(path: PathLike[AnyStr]) -> AnyStr: ...
|
||||
@overload
|
||||
def realpath(path: AnyStr) -> AnyStr: ...
|
||||
|
||||
# In reality it returns str for sequences of StrPath and bytes for sequences
|
||||
# of BytesPath, but mypy does not accept such a signature.
|
||||
def commonpath(paths: Sequence[AnyPath]) -> Any: ...
|
||||
|
||||
# NOTE: Empty lists results in '' (str) regardless of contained type.
|
||||
# So, fall back to Any
|
||||
def commonprefix(m: Sequence[AnyPath]) -> Any: ...
|
||||
def lexists(path: AnyPath) -> bool: ...
|
||||
|
||||
# These return float if os.stat_float_times() == True,
|
||||
# but int is a subclass of float.
|
||||
def getatime(filename: AnyPath) -> float: ...
|
||||
|
||||
Reference in New Issue
Block a user