Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

lint: Update flake8 and friends #3400

Merged
merged 1 commit into from
Jun 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ filelock==3.12.0
# via
# tox
# virtualenv
flake8==6.0.0
flake8==7.0.0
# via -r requirements.in
idna==3.7
# via requests
Expand Down Expand Up @@ -72,9 +72,9 @@ platformdirs==3.5.1
# virtualenv
pluggy==1.0.0
# via tox
pycodestyle==2.10.0
pycodestyle==2.11.1
# via flake8
pyflakes==3.0.1
pyflakes==3.2.0
# via flake8
pygments==2.15.0
# via sphinx
Expand Down
4 changes: 2 additions & 2 deletions tornado/options.py
Original file line number Diff line number Diff line change
Expand Up @@ -427,8 +427,8 @@ def parse_config_file(self, path: str, final: bool = True) -> None:
% (option.name, option.type.__name__)
)

if type(config[name]) == str and (
option.type != str or option.multiple
if type(config[name]) is str and (
option.type is not str or option.multiple
):
option.parse(config[name])
else:
Expand Down
14 changes: 7 additions & 7 deletions tornado/test/web_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -516,16 +516,16 @@ def get(self, *path_args):
# In httpserver.py (i.e. self.request.arguments), they're left
# as bytes. Keys are always native strings.
for key in self.request.arguments:
if type(key) != str:
if type(key) is not str:
raise Exception("incorrect type for key: %r" % type(key))
for bvalue in self.request.arguments[key]:
if type(bvalue) != bytes:
if type(bvalue) is not bytes:
raise Exception("incorrect type for value: %r" % type(bvalue))
for svalue in self.get_arguments(key):
if type(svalue) != unicode_type:
if type(svalue) is not unicode_type:
raise Exception("incorrect type for value: %r" % type(svalue))
for arg in path_args:
if type(arg) != unicode_type:
if type(arg) is not unicode_type:
raise Exception("incorrect type for path arg: %r" % type(arg))
self.write(
dict(
Expand Down Expand Up @@ -630,7 +630,7 @@ def check_type(self, name, obj, expected_type):

class DecodeArgHandler(RequestHandler):
def decode_argument(self, value, name=None):
if type(value) != bytes:
if type(value) is not bytes:
raise Exception("unexpected type for value: %r" % type(value))
# use self.request.arguments directly to avoid recursion
if "encoding" in self.request.arguments:
Expand All @@ -640,9 +640,9 @@ def decode_argument(self, value, name=None):

def get(self, arg):
def describe(s):
if type(s) == bytes:
if type(s) is bytes:
return ["bytes", native_str(binascii.b2a_hex(s))]
elif type(s) == unicode_type:
elif type(s) is unicode_type:
return ["unicode", s]
raise Exception("unknown type")

Expand Down