-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
move stat.FILE_ATTRIBUTE_* to _stat.pyi and fix availability #6761
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
ff9d101
move FILE_ATTRIBUTE_* constants to _stat.pyi
Akuli 79b2582
fix allowlist
Akuli b98ba39
try making available on windows
Akuli afe15a4
fix allowlists
Akuli 6d1b830
Revert "try making available on windows"
Akuli 19c7f3c
fix check
Akuli File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1 @@ | ||
from typing_extensions import Literal | ||
|
||
from _stat import * | ||
|
||
FILE_ATTRIBUTE_ARCHIVE: Literal[32] | ||
FILE_ATTRIBUTE_COMPRESSED: Literal[2048] | ||
FILE_ATTRIBUTE_DEVICE: Literal[64] | ||
FILE_ATTRIBUTE_DIRECTORY: Literal[16] | ||
FILE_ATTRIBUTE_ENCRYPTED: Literal[16384] | ||
FILE_ATTRIBUTE_HIDDEN: Literal[2] | ||
FILE_ATTRIBUTE_INTEGRITY_STREAM: Literal[32768] | ||
FILE_ATTRIBUTE_NORMAL: Literal[128] | ||
FILE_ATTRIBUTE_NOT_CONTENT_INDEXED: Literal[8192] | ||
FILE_ATTRIBUTE_NO_SCRUB_DATA: Literal[131072] | ||
FILE_ATTRIBUTE_OFFLINE: Literal[4096] | ||
FILE_ATTRIBUTE_READONLY: Literal[1] | ||
FILE_ATTRIBUTE_REPARSE_POINT: Literal[1024] | ||
FILE_ATTRIBUTE_SPARSE_FILE: Literal[512] | ||
FILE_ATTRIBUTE_SYSTEM: Literal[4] | ||
FILE_ATTRIBUTE_TEMPORARY: Literal[256] | ||
FILE_ATTRIBUTE_VIRTUAL: Literal[65536] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is not true, I can use these values on macos

Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I merged because a) Akuli did this intentionally (see comments in stubtest allowlists), b) they're documented as Windows only (https://docs.python.org/3/library/stat.html), c) there genuinely doesn't seem to be a use for them on other platforms and maybe that could uncover a bug.
That said, typeshed tries to avoid editorialising too much and we accomplish that by sticking close to implementation details, so if you (or anyone else) feel strongly or find this too opinionated I'm happy to have these definitions be unconditional.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, thanks for the explanation! I don't know when and why these values are used, so I don't have any strong opinions here 🙂