Skip to content

Commit b6b499d

Browse files
committed
Change some str types to LiteralString
1 parent 5c8b7fc commit b6b499d

File tree

1 file changed

+15
-12
lines changed

1 file changed

+15
-12
lines changed

stdlib/os/__init__.pyi

Lines changed: 15 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
from typing import LiteralString
12
import sys
23
from _typeshed import (
34
AnyStr_co,
@@ -45,6 +46,19 @@ from typing_extensions import Self, TypeAlias, Unpack, deprecated
4546

4647
from . import path as _path
4748

49+
50+
# Re-export common definitions from os.path to reduce duplication
51+
from .path import (
52+
curdir as curdir,
53+
pardir as pardir,
54+
sep as sep,
55+
altsep as altsep,
56+
extsep as extsep,
57+
pathsep as pathsep,
58+
defpath as defpath,
59+
devnull as devnull,
60+
)
61+
4862
__all__ = [
4963
"F_OK",
5064
"O_APPEND",
@@ -674,19 +688,8 @@ if sys.platform != "win32":
674688
ST_NOSUID: Final[int]
675689
ST_RDONLY: Final[int]
676690

677-
curdir: str
678-
pardir: str
679-
sep: str
680-
if sys.platform == "win32":
681-
altsep: str
682-
else:
683-
altsep: str | None
684-
extsep: str
685-
pathsep: str
686-
defpath: str
687691
linesep: Literal["\n", "\r\n"]
688-
devnull: str
689-
name: str
692+
name: LiteralString
690693

691694
F_OK: Final = 0
692695
R_OK: Final = 4

0 commit comments

Comments
 (0)