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:
Christian Clauss 2024-03-15 12:17:50 +01:00 committed by GitHub
parent a677b09729
commit 86da355eb9
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -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):