mirror of
https://github.com/davidhalter/typeshed.git
synced 2026-07-29 19:26:45 +08:00
Annotate pathlib.Path.{owner,group,is_mount} on windows (#13613)
This commit is contained in:
+11
-5
@@ -16,7 +16,7 @@ from io import BufferedRandom, BufferedReader, BufferedWriter, FileIO, TextIOWra
|
||||
from os import PathLike, stat_result
|
||||
from types import TracebackType
|
||||
from typing import IO, Any, BinaryIO, ClassVar, Literal, overload
|
||||
from typing_extensions import Self, deprecated
|
||||
from typing_extensions import Never, Self, deprecated
|
||||
|
||||
if sys.version_info >= (3, 9):
|
||||
from types import GenericAlias
|
||||
@@ -226,9 +226,13 @@ class Path(PurePath):
|
||||
def open(
|
||||
self, mode: str, buffering: int = -1, encoding: str | None = None, errors: str | None = None, newline: str | None = None
|
||||
) -> IO[Any]: ...
|
||||
if sys.platform != "win32":
|
||||
# These methods do "exist" on Windows, but they always raise NotImplementedError,
|
||||
# so it's safer to pretend they don't exist
|
||||
|
||||
# These methods do "exist" on Windows on <3.13, but they always raise NotImplementedError.
|
||||
if sys.platform == "win32":
|
||||
if sys.version_info < (3, 13):
|
||||
def owner(self: Never) -> str: ... # type: ignore[misc]
|
||||
def group(self: Never) -> str: ... # type: ignore[misc]
|
||||
else:
|
||||
if sys.version_info >= (3, 13):
|
||||
def owner(self, *, follow_symlinks: bool = True) -> str: ...
|
||||
def group(self, *, follow_symlinks: bool = True) -> str: ...
|
||||
@@ -238,7 +242,9 @@ class Path(PurePath):
|
||||
|
||||
# This method does "exist" on Windows on <3.12, but always raises NotImplementedError
|
||||
# On py312+, it works properly on Windows, as with all other platforms
|
||||
if sys.platform != "win32" or sys.version_info >= (3, 12):
|
||||
if sys.platform == "win32" and sys.version_info < (3, 12):
|
||||
def is_mount(self: Never) -> bool: ... # type: ignore[misc]
|
||||
else:
|
||||
def is_mount(self) -> bool: ...
|
||||
|
||||
if sys.version_info >= (3, 9):
|
||||
|
||||
Reference in New Issue
Block a user