From eb0f79389592f3b910d827eb66618151aa5d1ca5 Mon Sep 17 00:00:00 2001 From: cclauss Date: Thu, 4 Jul 2019 19:40:58 +0200 Subject: [PATCH] Identity is not the same thing as equality in Python [flake8](http://flake8.pycqa.org) F632 Use ==/!= to compare str, bytes, and int literals $ __python__ ```python >>> 0 == 0.0 True >>> 0 is 0.0 False ``` --- DjangoBlog/whoosh_cn_backend.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/DjangoBlog/whoosh_cn_backend.py b/DjangoBlog/whoosh_cn_backend.py index 52e304a..d8b43cc 100644 --- a/DjangoBlog/whoosh_cn_backend.py +++ b/DjangoBlog/whoosh_cn_backend.py @@ -624,7 +624,7 @@ class WhooshSearchBackend(BaseSearchBackend): if string_key in index.fields and hasattr(index.fields[string_key], 'convert'): # Special-cased due to the nature of KEYWORD fields. if index.fields[string_key].is_multivalued: - if value is None or len(value) is 0: + if value is None or len(value) == 0: additional_fields[string_key] = [] else: additional_fields[string_key] = value.split(',')