Python lint: Upgrade to flake8=7.1.1 (#1497)

diff --git a/.circleci/config.yml b/.circleci/config.yml
index 91074c9..8d0a5d6 100644
--- a/.circleci/config.yml
+++ b/.circleci/config.yml
@@ -50,7 +50,7 @@
             apt-get update -q
             apt-get install -q -y python3-pip
       - run: python3 -m pip install --upgrade pip
-      - run: python3 -m pip install flake8==3.9.2
+      - run: python3 -m pip install flake8==7.1.1
       - run: python3 -m flake8 --show-source --statistics --extend-exclude=./scripts
 
   test-linux:
diff --git a/.flake8 b/.flake8
index e49d748..28d70c2 100644
--- a/.flake8
+++ b/.flake8
@@ -1,24 +1,67 @@
 [flake8]
-ignore =
-   E111, # Indentation is not a multiple of four
-   E114, # Indentation is not a multiple of four (comment)
-   E501, # Line too long
-   E121, # Continuation line under-indented for hanging indent
-   E722  # bare excepts
-   E741, # Variable names such as 'l', 'O', or 'I'
+   # E111: Indentation is not a multiple of four
+   # E114: Indentation is not a multiple of four (comment)
+   # E121: Continuation line under-indented for hanging indent
+   # E122: continuation line missing indentation or outdented
+   # E126: continuation line over-indented for hanging indent
+   # E127: continuation line over-indented for visual indent
+   # E128: continuation line under-indented for visual indent
+   # E201: whitespace after '['
+   # E202: whitespace before ']'
+   # E203: whitespace before ':'
+   # E211: whitespace before '('
+   # E221: multiple spaces before operator
+   # E226: missing whitespace around arithmetic operator
+   # E228: missing whitespace around modulo operator
+   # E231: missing whitespace after ','
+   # E241: multiple spaces after ','
+   # E251: unexpected spaces around keyword / parameter equals
+   # E261: at least two spaces before inline comment
+   # E262: inline comment should start with '# '
+   # E266: too many leading '#' for block comment
+   # E271: multiple spaces after keyword
+   # E301: expected 1 blank line, found 0
+   # E302: expected 2 blank lines, found 1
+   # E303: too many blank lines (2)
+   # E305: expected 2 blank lines after class or function definition, found 1
+   # E306: expected 1 blank line before a nested definition, found 0
+   # E402: module level import not at top of file
+   # E501: Line too long
+   # E704: multiple statements on one line (def)
+   # E713: test for membership should be 'not in'
+   # E721: do not compare types, for exact checks use `is` / `is not`, for instance checks use `isinstance()`
+   # E722: bare excepts
+   # E731: do not assign a lambda expression, use a def
+   # E741: Variable names such as 'l', 'O', or 'I'
+   # F401: 'pip._internal.cli.index_command.SessionCommandMixin' imported but unused
+   # F403: 'from .core import *' used; unable to detect undefined names
+   # F405: 'encode' may be undefined, or defined from star imports: .codec, .core
+   # F541: f-string is missing placeholders
+   # F811: redefinition of unused 'Console' from line 8
+   # F821: undefined name 'basestring'
+   # F841: local variable 'foos' is assigned to but never used
+   # W291: trailing whitespace
+   # W391: blank line at end of file
+   # W503: line break before binary operator
+   # W504: line break after binary operator
+ignore = E111, E114, E121, E122, E126, E127, E128, E201, E202, E203, E211, E221, E226,
+   E228, E231, E241, E251, E261, E262, E266, E271, E301, E302, E303, E305, E306, E402,
+   E501, E704, E713, E721, E722, E731, E741, F401, F403, F405, F541, F811, F821, F841,
+   W291, W391, W503, W504
+
 exclude =
-  ./llvm,
-  ./gnu,
-  ./upstream,
-  ./fastcomp,
-  ./fastcomp-clang,
-  ./releases,
-  ./clang,
-  ./emscripten,
   ./binaryen,
+  ./clang,
+  ./crunch,
+  ./downloads,
+  ./emscripten,
+  ./fastcomp-clang,
+  ./fastcomp,
   ./git,
+  ./gnu,
+  ./llvm,
   ./node,
   ./python,
+  ./releases,
   ./temp,
-  ./downloads,
-  ./crunch,
+  ./upstream,