diff --git a/stdlib/os/__init__.pyi b/stdlib/os/__init__.pyi index 580452739f7f..bb0a57153948 100644 --- a/stdlib/os/__init__.pyi +++ b/stdlib/os/__init__.pyi @@ -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