]> git.ipfire.org Git - thirdparty/tornado.git/commitdiff
lint: Update flake8 and friends 3400/head
authorBen Darnell <ben@bendarnell.com>
Wed, 12 Jun 2024 01:20:20 +0000 (21:20 -0400)
committerBen Darnell <ben@bendarnell.com>
Wed, 12 Jun 2024 01:20:20 +0000 (21:20 -0400)
Use "is" instead of "==" for type comparisons.

requirements.txt
tornado/options.py
tornado/test/web_test.py

index 8dcc978d32f58382b33254db2e267b3f64dfc347..5c0326a1e366bb8d5b0c6a4e9a40735b63758bcd 100644 (file)
@@ -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
@@ -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
index b82966910b16b0cbba6c19dfac2f77fda7ac9f4a..cb66b77114331a092e46bf249a155e4e7796a5f6 100644 (file)
@@ -427,8 +427,8 @@ class OptionParser(object):
                             % (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:
index ecd72635668fa61a78a773bbca99ad21d846c78e..351a2a8971d112171efaa569bdc1101d3c692cf8 100644 (file)
@@ -516,16 +516,16 @@ class EchoHandler(RequestHandler):
         # 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(
@@ -630,7 +630,7 @@ class TypeCheckHandler(RequestHandler):
 
 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:
@@ -640,9 +640,9 @@ class DecodeArgHandler(RequestHandler):
 
     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")