You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Since 2.17.2 Pylint does not accept using a double negation on django Q objects.
I reproduced the issue in a venv using Python 3.10.10 with nothing but pylint and django installed.
The issue also occures when only using pylint. I reported this issue to pylint, but was asked to report it here.
"""Bug reproduction: false positive E1130"""fromdjango.db.modelsimportQdeffalse_positive(need_text=False) ->Q:
"""note the double negation"""has_text=~Q(text="")
ifneed_text:
returnhas_textreturn~has_text# E1130: bad operand type for unary ~: Node (invalid-unary-operand-type)defthis_is_ok(need_text=False) ->Q:
"""no double negation here"""has_no_text=Q(text="")
ifneed_text:
return~has_no_textreturnhas_no_text
Bug description
Since 2.17.2 Pylint does not accept using a double negation on django Q objects.
I reproduced the issue in a venv using Python 3.10.10 with nothing but pylint and django installed.
The issue also occures when only using pylint. I reported this issue to pylint, but was asked to report it here.
Configuration
no_settings.py
is an empty fileCommand used
DJANGO_SETTINGS_MODULE='no_settings' pylint --load-plugins pylint_django reproduce.py
Pylint output
Expected behavior
Same behaviour as in v2.17.1 (no error)
The text was updated successfully, but these errors were encountered: