Skip to content
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

Too many arguments for IntEnum reported #8344

Closed
Spenhouet opened this issue Jan 30, 2020 · 14 comments
Closed

Too many arguments for IntEnum reported #8344

Spenhouet opened this issue Jan 30, 2020 · 14 comments

Comments

@Spenhouet
Copy link

If I define the following IntEnum:

Numbers = IntEnum('Numbers', ['ZERO', 'ONE', 'TWO'], start=0)

mypy throws the following lint error: Too many arguments for IntEnum().

The start parameter is an official methods:

use the start parameter to specify a different starting value

https://docs.python.org/3/library/enum.html

@Michael0x2a
Copy link
Collaborator

Michael0x2a commented Jan 31, 2020

Yeah, it looks like the checks in https:/python/mypy/blob/master/mypy/semanal_enum.py#L99 are too strict.

If you're feeling up for submitting a PR, I think it would probably be good enough relax the checks so they make sure there are only two positional arguments, not just two arguments in total, and that the keyword arguments all have the right names -- see call.arg_kinds, call.arg_names, and https:/python/mypy/blob/master/mypy/nodes.py#L1501.

And if you also feel like checking the type, we can probably get away with insisting the user always uses an int literal for start. (Supporting arbitrary variables is tricky, since we special-case handling enums before the type checking phase).

Not sure if it's worth trying to support the other keyword arguments though, especially module and qualnames: idk what mypy would do with them.

@rahulrj
Copy link
Contributor

rahulrj commented Feb 4, 2020

@JukkaL is this a feature or a mypy bug? Can i submit a PR for this?

@mridullpandey
Copy link

hi bro @rahulrj are you working on it...

@swetavooda
Copy link

If nobody is assigned for this issue, I would like to work on it.

@rahulrj
Copy link
Contributor

rahulrj commented Feb 24, 2020

I am not working on this @mridullpandey

@mridullpandey
Copy link

hi @swetavooda i have did some sort of modifications on it,will you please take another one ..pls let me know asap thanks :-)

@mridullpandey
Copy link

@Michael0x2a will you please elaborate it what to actually do

@swetavooda
Copy link

@mridullpandey If you are really willing to work on this, you may continue. I'll find another issue to work on.

@Arshaan-256
Copy link

Merge pull request #8436. Hopefully that would fix the issue.

@mridullpandey
Copy link

then why this is still alive
@Arshaan-256

@Arshaan-256
Copy link

Arshaan-256 commented Feb 26, 2020

@mridullpandey Because it hasn't been reviewed yet. Once the PR is reviewed by the collaborator, only then can the issue be closed. The PR has passed the tests as well.

@killthekitten
Copy link

What's the status on this one?

@momohatt
Copy link
Contributor

This seems to have been already fixed in #9123

@JelleZijlstra
Copy link
Member

Indeed, closing this issue

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

10 participants