Skip to content
Merged
Changes from 4 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
4 changes: 3 additions & 1 deletion stdlib/3.4/enum.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,10 @@ def unique(enumeration: _S) -> _S: ...
if sys.version_info >= (3, 6):
_auto_null = ... # type: Any

class auto:
class auto(IntFlag):
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you add a comment explaining why we're lying here? Maybe link to the mypy issue or PR.

Copy link
Copy Markdown
Contributor Author

@mistermocha mistermocha May 24, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

enum.IntFlag has all the right methods & properties to most closely match the behavior of anything returned by enum.auto()

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you add that in the code itself?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done. I hope a docstring is apporopriate.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A comment is preferred. (Also, why is an __init__ needed?)

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As written in my comment, I don't think the comment is telling the truth but the inadvertent result of some misunderstanding. https://youtrack.jetbrains.com/issue/PY-53388/PyCharm-thinks-enumauto-needs-an-argument#focus=Comments-27-6301482.0-0

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you think there are problems with how things are implemented, please open a new issue.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please open a typeshed issue if you want typeshed people to do something about it.

"""auto: subclassing IntFlag so it picks up all implemented base functions, best modeling behavior of enum.auto()"""
value = ... # type: Any
def __init__(self) -> None: ...

class Flag(Enum):
def __contains__(self: _T, other: _T) -> bool: ...
Expand Down