Skip to content

add missing kwargs from Enum functional api signature #1710

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

Closed
Closed
Changes from 1 commit
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
5 changes: 3 additions & 2 deletions stdlib/3.4/enum.pyi
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import sys
from typing import List, Any, TypeVar, Union, Iterable, Iterator, TypeVar, Generic, Type, Sized, Reversible, Container, Mapping
from typing import List, Any, TypeVar, Union, Iterable, Iterator, Type, Sized, Reversible, Container, Mapping, Optional
from abc import ABCMeta

_T = TypeVar('_T', bound=Enum)
_T2 = TypeVar('_T2', bound=object)
_S = TypeVar('_S', bound=Type[Enum])

# Note: EnumMeta actually subclasses type directly, not ABCMeta.
Expand All @@ -18,7 +19,7 @@ class EnumMeta(ABCMeta, Iterable[Enum], Sized, Reversible[Enum], Container[Enum]
def __members__(self: Type[_T]) -> Mapping[str, _T]: ...

class Enum(metaclass=EnumMeta):
def __new__(cls: Type[_T], value: Any) -> _T: ...
def __new__(cls: Type[_T], value: str, names: Optional[str], module: Optional[str], qualname: Optional[str], type: Optional[Type[_T2]], start: Optional[int]) -> _T: ...
Copy link
Member

Choose a reason for hiding this comment

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

I don't think this is right—this method is for constructing enum instances, not enum classes. If anything, your change should be on EnumMeta.

Copy link
Member

Choose a reason for hiding this comment

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

So maybe we can't actually do much to fix this in typeshed.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I must admit I find the Enum class rather baffling, I will look more into it

def __repr__(self) -> str: ...
def __str__(self) -> str: ...
def __dir__(self) -> List[str]: ...
Expand Down