Skip to content
Open
Show file tree
Hide file tree
Changes from 6 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 0 additions & 3 deletions stdlib/@tests/stubtest_allowlists/darwin.txt
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,6 @@ multiprocessing.popen_spawn_win32 # exists on Darwin but fails to import
readline.append_history_file # Only available if compiled with GNU readline, not editline
select.poll # Actually a function; we have a class so it can be used as a type

# Some of these exist on non-windows, but they are useless and this is not intended
stat.FILE_ATTRIBUTE_[A-Z_]+

tkinter.Tk.createfilehandler # Methods that come from __getattr__() at runtime
tkinter.Tk.deletefilehandler # Methods that come from __getattr__() at runtime

Expand Down
3 changes: 0 additions & 3 deletions stdlib/@tests/stubtest_allowlists/linux.txt
Original file line number Diff line number Diff line change
Expand Up @@ -54,9 +54,6 @@ _?socket.SOL_IPX
_?socket.SOL_NETROM
_?socket.SOL_ROSE

# Some of these exist on non-windows, but they are useless and this is not intended
stat.FILE_ATTRIBUTE_[A-Z_]+

# This is available on Linux, but it's documented as for kernel debugging and
# not present on GitHub Actions runners.
termios.TIOCTTYGSTRUCT
Expand Down
22 changes: 22 additions & 0 deletions stdlib/stat.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,28 @@ import sys
from _stat import *
from typing import Final

# _stat.c defines FILE_ATTRIBUTE_* constants conditionally,
# making them available only at runtime on Windows.
# stat.py unconditionally redefines the same FILE_ATTRIBUTE_* constants
# on all platforms.
FILE_ATTRIBUTE_ARCHIVE: Final = 32 # type: ignore[misc]
FILE_ATTRIBUTE_COMPRESSED: Final = 2048 # type: ignore[misc]
FILE_ATTRIBUTE_DEVICE: Final = 64 # type: ignore[misc]
FILE_ATTRIBUTE_DIRECTORY: Final = 16 # type: ignore[misc]
FILE_ATTRIBUTE_ENCRYPTED: Final = 16384 # type: ignore[misc]
FILE_ATTRIBUTE_HIDDEN: Final = 2 # type: ignore[misc]
FILE_ATTRIBUTE_INTEGRITY_STREAM: Final = 32768 # type: ignore[misc]
FILE_ATTRIBUTE_NORMAL: Final = 128 # type: ignore[misc]
FILE_ATTRIBUTE_NOT_CONTENT_INDEXED: Final = 8192 # type: ignore[misc]
FILE_ATTRIBUTE_NO_SCRUB_DATA: Final = 131072 # type: ignore[misc]
FILE_ATTRIBUTE_OFFLINE: Final = 4096 # type: ignore[misc]
FILE_ATTRIBUTE_READONLY: Final = 1 # type: ignore[misc]
FILE_ATTRIBUTE_REPARSE_POINT: Final = 1024 # type: ignore[misc]
FILE_ATTRIBUTE_SPARSE_FILE: Final = 512 # type: ignore[misc]
FILE_ATTRIBUTE_SYSTEM: Final = 4 # type: ignore[misc]
FILE_ATTRIBUTE_TEMPORARY: Final = 256 # type: ignore[misc]
FILE_ATTRIBUTE_VIRTUAL: Final = 65536 # type: ignore[misc]

if sys.version_info >= (3, 13):
# https://github.com/python/cpython/issues/114081#issuecomment-2119017790
SF_RESTRICTED: Final = 0x00080000
Loading