mirror of
https://github.com/davidhalter/typeshed.git
synced 2025-12-09 05:24:52 +08:00
PathLike cleanup (#5242)
Copy builtins._PathLike to os.PathLike Use os.PathLike exclusively outside of builtins
This commit is contained in:
@@ -57,7 +57,6 @@ from typing import (
|
||||
Union,
|
||||
ValuesView,
|
||||
overload,
|
||||
runtime_checkable,
|
||||
)
|
||||
from typing_extensions import Literal, SupportsIndex
|
||||
|
||||
@@ -959,11 +958,10 @@ if sys.version_info >= (3, 7):
|
||||
def callable(__obj: object) -> bool: ...
|
||||
def chr(__i: int) -> str: ...
|
||||
|
||||
# This class is to be exported as PathLike from os,
|
||||
# but we define it here as _PathLike to avoid import cycle issues.
|
||||
# We define this here instead of using os.PathLike to avoid import cycle issues.
|
||||
# See https://github.com/python/typeshed/pull/991#issuecomment-288160993
|
||||
_AnyStr_co = TypeVar("_AnyStr_co", str, bytes, covariant=True)
|
||||
@runtime_checkable
|
||||
|
||||
class _PathLike(Protocol[_AnyStr_co]):
|
||||
def __fspath__(self) -> _AnyStr_co: ...
|
||||
|
||||
|
||||
Reference in New Issue
Block a user