class_docstr: Compile and run Python source code.
  
      
docstr: Execute the configured source code in a module and run any post
  checks.
  
  Args:
      module (Module) :
          A module to execute the configured code in.
  
      post_check (callable, optional) :
          A function that raises an exception if expected post-conditions
          are not met after code execution.
docstr_tok: ["Execute","the","configured","source","code","in","a","module","and","run","any","post","checks",".","Args",":","module","(","Module",")",":","A","module","to","execute","the","configured","code","in",".","post_check","(","callable",",","optional",")",":","A","function","that","raises","an","exception","if","expected","post-conditions","are","not","met","after","code","execution","."]
code: def run(
      self,
      module: ModuleType,
      post_check: Callable[[], None] | None = None,
  ) -> None:
      """Execute the configured source code in a module and run any post
      checks.
  
      Args:
          module (Module) :
              A module to execute the configured code in.
  
          post_check (callable, optional) :
              A function that raises an exception if expected post-conditions
              are not met after code execution.
  
      """
      # Simulate the sys.path behaviour described here:
      #
      # https://docs.python.org/2/library/sys.html#sys.path
      _cwd = os.getcwd()
      _sys_path = list(sys.path)
      _sys_argv = list(sys.argv)
      sys.path.insert(0, os.path.dirname(self._path))
      sys.argv = [os.path.basename(self._path), *self._argv]
  
      # XXX: self._code shouldn't be None at this point but types don't reflect this
      assert self._code is not None
  
      try:
          exec(self._code, module.__dict__)
  
          if post_check:
              post_check()
      except Exception as e:
          handle_exception(self, e)
      finally:
          # undo sys.path, CWD fixups
          os.chdir(_cwd)
          sys.path = _sys_path
          sys.argv = _sys_argv
          self.ran = True
  
imports: from __future__ import annotations
  import logging
  import os
  import sys
  import traceback
  from os.path import basename
  from types import CodeType, ModuleType
  from typing import Callable
  from ...core.types import PathLike
  from ...util.serialization import make_globally_unique_id
  from .handler import handle_exception
label_desc: Use image node_id 10 for calling the CodeRunner obj's underlying member method code with example usage: obj.run(module, post_check) without return types