'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:
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.
Solution 1:[1]
Nevermind, everyone. I just found out this was a bug and was reported a month ago here.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Floating Sunfish |

