@@ -6,7 +6,6 @@ import types
6
6
from _collections_abc import dict_items , dict_keys , dict_values
7
7
from _typeshed import (
8
8
AnnotationForm ,
9
- AnyStr_co ,
10
9
ConvertibleToFloat ,
11
10
ConvertibleToInt ,
12
11
FileDescriptorOrPath ,
@@ -33,6 +32,7 @@ from _typeshed import (
33
32
)
34
33
from collections .abc import Awaitable , Callable , Iterable , Iterator , MutableSet , Reversible , Set as AbstractSet , Sized
35
34
from io import BufferedRandom , BufferedReader , BufferedWriter , FileIO , TextIOWrapper
35
+ from os import PathLike
36
36
from types import CellType , CodeType , GenericAlias , TracebackType
37
37
38
38
# mypy crashes if any of {ByteString, Sequence, MutableSequence, Mapping, MutableMapping}
@@ -1353,11 +1353,6 @@ def breakpoint(*args: Any, **kws: Any) -> None: ...
1353
1353
def callable (obj : object , / ) -> TypeIs [Callable [..., object ]]: ...
1354
1354
def chr (i : int | SupportsIndex , / ) -> str : ...
1355
1355
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
-
1361
1356
if sys .version_info >= (3 , 10 ):
1362
1357
def aiter (async_iterable : SupportsAiter [_SupportsAnextT_co ], / ) -> _SupportsAnextT_co : ...
1363
1358
@@ -1378,7 +1373,7 @@ if sys.version_info >= (3, 10):
1378
1373
@overload
1379
1374
def compile (
1380
1375
source : str | ReadableBuffer | _ast .Module | _ast .Expression | _ast .Interactive ,
1381
- filename : str | ReadableBuffer | _PathLike [Any ],
1376
+ filename : str | ReadableBuffer | PathLike [Any ],
1382
1377
mode : str ,
1383
1378
flags : Literal [0 ],
1384
1379
dont_inherit : bool = False ,
@@ -1389,7 +1384,7 @@ def compile(
1389
1384
@overload
1390
1385
def compile (
1391
1386
source : str | ReadableBuffer | _ast .Module | _ast .Expression | _ast .Interactive ,
1392
- filename : str | ReadableBuffer | _PathLike [Any ],
1387
+ filename : str | ReadableBuffer | PathLike [Any ],
1393
1388
mode : str ,
1394
1389
* ,
1395
1390
dont_inherit : bool = False ,
@@ -1399,7 +1394,7 @@ def compile(
1399
1394
@overload
1400
1395
def compile (
1401
1396
source : str | ReadableBuffer | _ast .Module | _ast .Expression | _ast .Interactive ,
1402
- filename : str | ReadableBuffer | _PathLike [Any ],
1397
+ filename : str | ReadableBuffer | PathLike [Any ],
1403
1398
mode : str ,
1404
1399
flags : Literal [1024 ],
1405
1400
dont_inherit : bool = False ,
@@ -1410,7 +1405,7 @@ def compile(
1410
1405
@overload
1411
1406
def compile (
1412
1407
source : str | ReadableBuffer | _ast .Module | _ast .Expression | _ast .Interactive ,
1413
- filename : str | ReadableBuffer | _PathLike [Any ],
1408
+ filename : str | ReadableBuffer | PathLike [Any ],
1414
1409
mode : str ,
1415
1410
flags : int ,
1416
1411
dont_inherit : bool = False ,
0 commit comments