@@ -6,7 +6,6 @@ import types
66from _collections_abc import dict_items , dict_keys , dict_values
77from _typeshed import (
88 AnnotationForm ,
9- AnyStr_co ,
109 ConvertibleToFloat ,
1110 ConvertibleToInt ,
1211 FileDescriptorOrPath ,
@@ -33,6 +32,7 @@ from _typeshed import (
3332)
3433from collections .abc import Awaitable , Callable , Iterable , Iterator , MutableSet , Reversible , Set as AbstractSet , Sized
3534from io import BufferedRandom , BufferedReader , BufferedWriter , FileIO , TextIOWrapper
35+ from os import PathLike
3636from types import CellType , CodeType , GenericAlias , TracebackType
3737
3838# mypy crashes if any of {ByteString, Sequence, MutableSequence, Mapping, MutableMapping}
@@ -1353,11 +1353,6 @@ def breakpoint(*args: Any, **kws: Any) -> None: ...
13531353def callable (obj : object , / ) -> TypeIs [Callable [..., object ]]: ...
13541354def chr (i : int | SupportsIndex , / ) -> str : ...
13551355
1356- # We define this here instead of using os.PathLike to avoid import cycle issues.
1357- # See https://github.com/python/typeshed/pull/991#issuecomment-288160993
1358- class _PathLike (Protocol [AnyStr_co ]):
1359- def __fspath__ (self ) -> AnyStr_co : ...
1360-
13611356if sys .version_info >= (3 , 10 ):
13621357 def aiter (async_iterable : SupportsAiter [_SupportsAnextT_co ], / ) -> _SupportsAnextT_co : ...
13631358
@@ -1378,7 +1373,7 @@ if sys.version_info >= (3, 10):
13781373@overload
13791374def compile (
13801375 source : str | ReadableBuffer | _ast .Module | _ast .Expression | _ast .Interactive ,
1381- filename : str | ReadableBuffer | _PathLike [Any ],
1376+ filename : str | ReadableBuffer | PathLike [Any ],
13821377 mode : str ,
13831378 flags : Literal [0 ],
13841379 dont_inherit : bool = False ,
@@ -1389,7 +1384,7 @@ def compile(
13891384@overload
13901385def compile (
13911386 source : str | ReadableBuffer | _ast .Module | _ast .Expression | _ast .Interactive ,
1392- filename : str | ReadableBuffer | _PathLike [Any ],
1387+ filename : str | ReadableBuffer | PathLike [Any ],
13931388 mode : str ,
13941389 * ,
13951390 dont_inherit : bool = False ,
@@ -1399,7 +1394,7 @@ def compile(
13991394@overload
14001395def compile (
14011396 source : str | ReadableBuffer | _ast .Module | _ast .Expression | _ast .Interactive ,
1402- filename : str | ReadableBuffer | _PathLike [Any ],
1397+ filename : str | ReadableBuffer | PathLike [Any ],
14031398 mode : str ,
14041399 flags : Literal [1024 ],
14051400 dont_inherit : bool = False ,
@@ -1410,7 +1405,7 @@ def compile(
14101405@overload
14111406def compile (
14121407 source : str | ReadableBuffer | _ast .Module | _ast .Expression | _ast .Interactive ,
1413- filename : str | ReadableBuffer | _PathLike [Any ],
1408+ filename : str | ReadableBuffer | PathLike [Any ],
14141409 mode : str ,
14151410 flags : int ,
14161411 dont_inherit : bool = False ,
0 commit comments