From: Siu Kwan Lam <1929845+sklam@users.noreply.github.com>
Origin: https://github.com/numba/numba/pull/8545
Date: Wed, 26 Oct 2022 09:45:54 -0500
Subject: Flake8 fixes

---
 numba/core/bytecode.py    |  1 +
 numba/core/byteflow.py    | 22 +++++++++++++---------
 numba/core/controlflow.py |  4 +++-
 numba/core/interpreter.py |  5 ++---
 numba/core/lowering.py    |  4 +++-
 5 files changed, 22 insertions(+), 14 deletions(-)

diff --git a/numba/core/bytecode.py b/numba/core/bytecode.py
index 8f635ce..2a22bf7 100644
--- a/numba/core/bytecode.py
+++ b/numba/core/bytecode.py
@@ -328,6 +328,7 @@ class ByteCode(object):
             ent = max(candidates)[1]
             return ent
 
+
 class FunctionIdentity(serialize.ReduceMixin):
     """
     A function's identity and metadata.
diff --git a/numba/core/byteflow.py b/numba/core/byteflow.py
index 2b72c78..853d470 100644
--- a/numba/core/byteflow.py
+++ b/numba/core/byteflow.py
@@ -10,7 +10,7 @@ from functools import total_ordering
 from numba.core.utils import UniqueDict, PYVERSION
 from numba.core.controlflow import NEW_BLOCKERS, CFGraph
 from numba.core.ir import Loc
-from numba.core.errors import UnsupportedError, CompilerError
+from numba.core.errors import UnsupportedError
 
 
 _logger = logging.getLogger(__name__)
@@ -113,7 +113,8 @@ class Flow(object):
                     # Terminated?
                     if state.has_terminated():
                         break
-                    elif not state.in_with() and (state.has_active_try() and
+                    elif not state.in_with() and (
+                            state.has_active_try() and
                             state.get_inst().opname not in _NO_RAISE_OPS):
                         # Is in a *try* block
                         state.fork(pc=state.get_inst().next)
@@ -125,18 +126,21 @@ class Flow(object):
                         # Must the new PC be a new block?
                         if PYVERSION == (3, 11):
                             if not state.in_with() and state.is_in_exception():
-                                _logger.debug("3.11 exception %s PC=%s", state.get_exception(), state._pc)
+                                _logger.debug("3.11 exception %s PC=%s",
+                                              state.get_exception(), state._pc)
                                 eh = state.get_exception()
                                 eh_top = state.get_top_block('TRY')
                                 if eh_top and eh_top['end'] == eh.target:
                                     # Same exception
                                     eh_block = None
                                 else:
-                                    eh_block = state.make_block("TRY", end=eh.target)
+                                    eh_block = state.make_block(
+                                        "TRY", end=eh.target)
                                     eh_block['end_offset'] = eh.end
                                     eh_block['stack_depth'] = eh.depth
                                     eh_block['push_lasti'] = eh.lasti
-                                    state.fork(pc=state._pc, extra_block=eh_block)
+                                    state.fork(pc=state._pc,
+                                               extra_block=eh_block)
                                     break
 
                         if self._is_implicit_new_block(state):
@@ -839,7 +843,6 @@ class TraceRunner(object):
         # Forces a new block
         state.fork(pc=inst.next)
 
-
     def op_SETUP_WITH(self, state, inst):
         cm = state.pop()    # the context-manager
 
@@ -891,7 +894,6 @@ class TraceRunner(object):
         state.push(state.make_temp("exception"))
         state.push(tos)
 
-
     def op_SETUP_EXCEPT(self, state, inst):
         # Opcode removed since py3.8
         state.append(inst)
@@ -913,7 +915,7 @@ class TraceRunner(object):
             blk = state.pop_block()
             if blk['kind'] not in {BlockKind('EXCEPT'), BlockKind('FINALLY')}:
                 raise UnsupportedError(
-                    "POP_EXCEPT got an unexpected block: {}".format(blk['kind']),
+                    f"POP_EXCEPT got an unexpected block: {blk['kind']}",
                     loc=self.get_debug_loc(inst.lineno),
                 )
             state.pop()
@@ -1669,7 +1671,8 @@ class State(object):
         for edge in self._outedges:
             state = State(bytecode=self._bytecode, pc=edge.pc,
                           nstack=len(edge.stack), blockstack=edge.blockstack,
-                          nullvals=[i for i, v in enumerate(edge.stack) if _is_null_temp_reg(v)])
+                          nullvals=[i for i, v in enumerate(edge.stack)
+                                    if _is_null_temp_reg(v)])
             ret.append(state)
             # Map outgoing_phis
             for phi, i in state._phis.items():
@@ -1716,6 +1719,7 @@ class StatePy311(State):
             if ent["kind"] == BlockKind("WITH"):
                 return True
 
+
 if PYVERSION >= (3, 11):
     State = StatePy311
 
diff --git a/numba/core/controlflow.py b/numba/core/controlflow.py
index e169850..70fc5e7 100644
--- a/numba/core/controlflow.py
+++ b/numba/core/controlflow.py
@@ -8,7 +8,9 @@ from numba.core.errors import UnsupportedError
 
 # List of bytecodes creating a new block in the control flow graph
 # (in addition to explicit jump labels).
-NEW_BLOCKERS = frozenset(['SETUP_LOOP', 'FOR_ITER', 'SETUP_WITH', 'BEFORE_WITH'])
+NEW_BLOCKERS = frozenset([
+    'SETUP_LOOP', 'FOR_ITER', 'SETUP_WITH', 'BEFORE_WITH'
+])
 
 
 class CFBlock(object):
diff --git a/numba/core/interpreter.py b/numba/core/interpreter.py
index a1cba5e..0faea35 100644
--- a/numba/core/interpreter.py
+++ b/numba/core/interpreter.py
@@ -1531,7 +1531,6 @@ class Interpreter(object):
             if newtryblk is not tryblk:
                 self._insert_try_block_begin()
 
-
     def _end_current_block(self):
         # Handle try block
         if not self.current_block.is_terminated:
@@ -2855,7 +2854,7 @@ class Interpreter(object):
         op = BINOPS_TO_OPERATORS["is"]
 
         lhs = self.store(value=ir.Const(None, loc=self.loc),
-                            name="${inst.offset}constnone")
+                         name="${inst.offset}constnone")
         rhs = self.get(pred)
         isnone = ir.Expr.binop(op, lhs=lhs, rhs=rhs, loc=self.loc)
 
@@ -2937,7 +2936,7 @@ class Interpreter(object):
             # Numba can't handle this case and it's caught else where, this is a
             # runtime guard in case this is reached by unknown means.
             msg = (f"Unreachable condition reached (op code RERAISE executed)"
-                f"{error_extras['reportable']}")
+                   f"{error_extras['reportable']}")
             stmt = ir.StaticRaise(AssertionError, (msg,), self.loc)
             self.current_block.append(stmt)
 
diff --git a/numba/core/lowering.py b/numba/core/lowering.py
index d43ac2f..3daec9d 100644
--- a/numba/core/lowering.py
+++ b/numba/core/lowering.py
@@ -20,6 +20,7 @@ from numba.misc.firstlinefinder import get_func_body_first_lineno
 
 _VarArgItem = namedtuple("_VarArgItem", ("vararg", "index"))
 
+
 class BaseLower(object):
     """
     Lower IR to LLVM
@@ -304,7 +305,8 @@ class BaseLower(object):
 
     def debug_print(self, msg):
         if config.DEBUG_JIT:
-            self.context.debug_print(self.builder, f"DEBUGJIT [{self.fndesc.qualname}]: {msg}")
+            self.context.debug_print(
+                self.builder, f"DEBUGJIT [{self.fndesc.qualname}]: {msg}")
 
     def print_variable(self, msg, varname):
         """Helper to emit ``print(msg, varname)`` for debugging.
