Skip to content

Commit 390f28e

Browse files
authored
Use ==/!= to compare str, bytes, and int literals
flake8 testing of https://github.com/jupyter/kernel_gateway on Python 3.8.0 $ __flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics__ ``` ./kernel_gateway/notebook_http/request_utils.py:68:18: F632 use ==/!= to compare str, bytes, and int literals body = '' if body is b'' or body is None else body.decode(encoding='UTF-8') ^ 1 F632 use ==/!= to compare str, bytes, and int literals 1 ```
1 parent ec7ae2b commit 390f28e

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

kernel_gateway/notebook_http/request_utils.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ def parse_body(request):
6565
"""
6666
content_type = TEXT_PLAIN
6767
body = request.body
68-
body = '' if body is b'' or body is None else body.decode(encoding='UTF-8')
68+
body = body.decode(encoding='UTF-8') if body else ''
6969
if 'Content-Type' in request.headers:
7070
content_type = request.headers['Content-Type']
7171
return_body = body

0 commit comments

Comments
 (0)