mirror of
https://github.com/davidhalter/typeshed.git
synced 2026-07-10 18:36:31 +08:00
Annotate pathlib.Path.{owner,group,is_mount} on windows (#13613)
This commit is contained in:
@@ -44,16 +44,6 @@ xml.parsers.expat.XMLParserType.SetReparseDeferralEnabled
|
||||
xml.sax.expatreader.ExpatParser.flush
|
||||
|
||||
|
||||
# =============================================================
|
||||
# Allowlist entries that cannot or should not be fixed; <= 3.11
|
||||
# =============================================================
|
||||
|
||||
# pathlib methods that exist on Windows, but always raise NotImplementedError,
|
||||
# so are omitted from the stub
|
||||
pathlib.Path.is_mount
|
||||
pathlib.WindowsPath.is_mount
|
||||
|
||||
|
||||
# =============================================================
|
||||
# Allowlist entries that cannot or should not be fixed; <= 3.12
|
||||
# =============================================================
|
||||
@@ -63,7 +53,3 @@ crypt
|
||||
nis
|
||||
ossaudiodev
|
||||
spwd
|
||||
|
||||
# pathlib functions that rely on modules that don't exist on Windows
|
||||
pathlib.Path.owner
|
||||
pathlib.Path.group
|
||||
|
||||
@@ -11,16 +11,6 @@ email.utils.getaddresses
|
||||
email.utils.parseaddr
|
||||
|
||||
|
||||
# =============================================================
|
||||
# Allowlist entries that cannot or should not be fixed; <= 3.11
|
||||
# =============================================================
|
||||
|
||||
# pathlib methods that exist on Windows, but always raise NotImplementedError,
|
||||
# so are omitted from the stub
|
||||
pathlib.Path.is_mount
|
||||
pathlib.WindowsPath.is_mount
|
||||
|
||||
|
||||
# =============================================================
|
||||
# Allowlist entries that cannot or should not be fixed; <= 3.12
|
||||
# =============================================================
|
||||
@@ -30,7 +20,3 @@ crypt
|
||||
nis
|
||||
ossaudiodev
|
||||
spwd
|
||||
|
||||
# pathlib functions that rely on modules that don't exist on Windows
|
||||
pathlib.Path.owner
|
||||
pathlib.Path.group
|
||||
|
||||
@@ -25,7 +25,3 @@ crypt
|
||||
nis
|
||||
ossaudiodev
|
||||
spwd
|
||||
|
||||
# pathlib functions that rely on modules that don't exist on Windows
|
||||
pathlib.Path.owner
|
||||
pathlib.Path.group
|
||||
|
||||
@@ -53,16 +53,6 @@ xml.parsers.expat.XMLParserType.SetReparseDeferralEnabled
|
||||
xml.sax.expatreader.ExpatParser.flush
|
||||
|
||||
|
||||
# =============================================================
|
||||
# Allowlist entries that cannot or should not be fixed; <= 3.11
|
||||
# =============================================================
|
||||
|
||||
# pathlib methods that exist on Windows, but always raise NotImplementedError,
|
||||
# so are omitted from the stub
|
||||
pathlib.Path.is_mount
|
||||
pathlib.WindowsPath.is_mount
|
||||
|
||||
|
||||
# =============================================================
|
||||
# Allowlist entries that cannot or should not be fixed; <= 3.12
|
||||
# =============================================================
|
||||
@@ -72,7 +62,3 @@ crypt
|
||||
nis
|
||||
ossaudiodev
|
||||
spwd
|
||||
|
||||
# pathlib functions that rely on modules that don't exist on Windows
|
||||
pathlib.Path.owner
|
||||
pathlib.Path.group
|
||||
|
||||
+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