pylint
pylint copied to clipboard
False positive E1130 invalid-unary-operand-type for Flag
Pylint emits a false positive E1130 invalid-unary-operand-type error for enum.Flag:
from enum import Flag
class Perm(Flag):
R = 4
W = 2
X = 1
print(~Perm(2))
Emits two errors:
$ pylint-3 -E a.py
************* Module a
a.py:6:6: E1130: bad operand type for unary ~: Perm (invalid-unary-operand-type)
a.py:6:6: E1130: bad operand type for unary ~: NoneType (invalid-unary-operand-type)
pylint --version output
$ pylint-3 --version
pylint-3 2.1.1
astroid 2.0.4
Python 3.7.3 (default, Mar 27 2019, 13:41:07)
[GCC 8.3.1 20190223 (Red Hat 8.3.1-2)]
Thanks for the report!
This no longer emits on main.
Thanks!
Never mind 😓
It does partially emit... Reopening. New incorrect output is:
❯ pylint test.py --enable=invalid-unary-operand-type
************* Module test
test.py:10:6: E1130: bad operand type for unary ~: EnumMeta (invalid-unary-operand-type)