mirror of
https://github.com/davidhalter/typeshed.git
synced 2025-12-14 15:57:07 +08:00
Add LiteralString overloads to path module (#7727)
Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
This commit is contained in:
@@ -43,6 +43,7 @@ from posixpath import (
|
||||
supports_unicode_filenames as supports_unicode_filenames,
|
||||
)
|
||||
from typing import AnyStr, overload
|
||||
from typing_extensions import LiteralString
|
||||
|
||||
if sys.version_info >= (3, 7) or sys.platform != "win32":
|
||||
__all__ = [
|
||||
@@ -130,12 +131,14 @@ else:
|
||||
|
||||
def splitunc(p: AnyStr) -> tuple[AnyStr, AnyStr]: ... # deprecated
|
||||
|
||||
altsep: str
|
||||
altsep: LiteralString
|
||||
|
||||
# First parameter is not actually pos-only,
|
||||
# but must be defined as pos-only in the stub or cross-platform code doesn't type-check,
|
||||
# as the parameter name is different in posixpath.join()
|
||||
@overload
|
||||
def join(__path: LiteralString, *paths: LiteralString) -> LiteralString: ...
|
||||
@overload
|
||||
def join(__path: StrPath, *paths: StrPath) -> str: ...
|
||||
@overload
|
||||
def join(__path: BytesPath, *paths: BytesPath) -> bytes: ...
|
||||
|
||||
Reference in New Issue
Block a user