Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Python: `enum.auto()` Generating Warning That Parameter is Unfilled

I have the below code that defines an enum and uses enum.auto() to give entries generated values starting from 1:

from enum import Enum, auto


class Colors(Enum):
    RED = auto()
    BLUE = auto()
    YELLOW = auto()


def main():
    print(Colors.RED.value)
    print(Colors.BLUE.value)
    print(Colors.YELLOW.value)


if __name__ == '__main__':
    main()

Output:

1
2
3

The code works fine and used to not have any warnings, but after updating PyCharm today, I am now getting the following warning for auto():

Parameter(s) unfilled 
Possible callees: 
EnumMeta.__call__(cls: Type[_T], value, names: None = ...) 
EnumMeta.__call__(cls: EnumMeta, value: str, names: Union[str, Iterable[str], Iterable[Iterable[str]], Mapping[str, Any]], *, module: Optional[str] = ..., qualname: Optional[str] = ..., type: Optional[type] = ..., start: int = ..., boundary: Optional[FlagBoundary] = ...) 
EnumMeta.__call__(cls: Type[_T], value, names: None = ...) 
EnumMeta.__call__(cls: EnumMeta, value: str, names: Union[str, Iterable[str], Iterable[Iterable[str]], Mapping[str, Any]], *, module: Optional[str] = ..., qualname: Optional[str] = ..., type: Optional[type] = ..., start: int = ...) 

I checked the Python documentation but couldn't find anything relevant, as all the examples still use auto() without any parameters.

I assume the new warning is because PyCharm is using updated Python linting rules.

How do I resolve this warning?

UPDATE 1:

It seems that PyCharm is detecting enum.auto() as enum.auto(IntFlag), thus the warning that the parameter is unfilled:

enter image description here

I will also report this issue to the PyCharm devs. Perhaps it's a bug.

UPDATE 2:

Nevermind, everyone. I just found out this was a bug and was reported a month ago here.

UPDATE 3:

The bug has finally been fixed! 🎉

like image 980
Floating Sunfish Avatar asked Nov 21 '25 23:11

Floating Sunfish


1 Answers

Nevermind, everyone. I just found out this was a bug and was reported a month ago here.

UPDATE:

The bug has finally been fixed! 🎉

like image 199
Floating Sunfish Avatar answered Nov 24 '25 13:11

Floating Sunfish



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!