[stdlib][os] Change some str types to LiteralString (#15018)

This commit is contained in:
Guo Ci
2025-11-14 15:42:26 -05:00
committed by GitHub
parent 79ac2bce40
commit 0244ef7748
+14 -13
View File
@@ -41,10 +41,22 @@ from typing import (
runtime_checkable,
type_check_only,
)
from typing_extensions import Self, TypeAlias, Unpack, deprecated
from typing_extensions import LiteralString, Self, TypeAlias, Unpack, deprecated
from . import path as _path
# Re-export common definitions from os.path to reduce duplication
from .path import (
altsep as altsep,
curdir as curdir,
defpath as defpath,
devnull as devnull,
extsep as extsep,
pardir as pardir,
pathsep as pathsep,
sep as sep,
)
__all__ = [
"F_OK",
"O_APPEND",
@@ -674,19 +686,8 @@ if sys.platform != "win32":
ST_NOSUID: Final[int]
ST_RDONLY: Final[int]
curdir: str
pardir: str
sep: str
if sys.platform == "win32":
altsep: str
else:
altsep: str | None
extsep: str
pathsep: str
defpath: str
linesep: Literal["\n", "\r\n"]
devnull: str
name: str
name: LiteralString
F_OK: Final = 0
R_OK: Final = 4