mirror of
https://github.com/encode/django-rest-framework.git
synced 2025-07-16 11:12:21 +03:00
request.py: E714 Test for object identity should be is not
As discussed in PEP8... ```diff - return not getattr(obj, name) is Empty + return getattr(obj, name) is not Empty ``` % `ruff rule E714` # not-is-test (E714) Derived from the **pycodestyle** linter. Fix is always available. ## What it does Checks for negative comparison using `not {foo} is {bar}`. ## Why is this bad? Negative comparison should be done using `is not`. ## Example ```python if not X is Y: pass Z = not X.B is Y ``` Use instead: ```python if X is not Y: pass Z = X.B is not Y ```
This commit is contained in:
parent
a677b09729
commit
86da355eb9
|
@ -87,7 +87,7 @@ class Empty:
|
|||
|
||||
|
||||
def _hasattr(obj, name):
|
||||
return not getattr(obj, name) is Empty
|
||||
return getattr(obj, name) is not Empty
|
||||
|
||||
|
||||
def clone_request(request, method):
|
||||
|
|
Loading…
Reference in New Issue
Block a user