nodes: 0, module; 1, function_definition; 2, function_name:post_upgrade_checks; 3, parameters; 4, block; 5, identifier:self; 6, identifier:upgrades; 7, expression_statement; 8, expression_statement; 9, for_statement; 10, for_statement; 11, expression_statement; 12, expression_statement; 13, comment:"""Run post-upgrade checks after applying all pending upgrades.
  
          Post checks may be used to emit warnings encountered when applying an
          upgrade, but post-checks can also be used to advice the user to run
          re-indexing or similar long running processes.
  
          Post-checks may query for user-input, but should respect the
          --yes-i-know option to run in an unattended mode.
  
          All applied upgrades post-checks are executed.
  
          :param upgrades: List of upgrades sorted in topological order.
          """; 14, assignment; 15, identifier:u; 16, identifier:upgrades; 17, block; 18, identifier:check; 19, attribute; 20, block; 21, call; 22, call; 23, identifier:errors; 24, list; 25, expression_statement; 26, try_statement; 27, identifier:self; 28, identifier:global_post_upgrade; 29, expression_statement; 30, try_statement; 31, attribute; 32, argument_list; 33, attribute; 34, argument_list; 35, call; 36, block; 37, except_clause; 38, call; 39, block; 40, except_clause; 41, identifier:self; 42, identifier:_teardown_log_prefix; 43, identifier:self; 44, identifier:_check_errors; 45, identifier:errors; 46, concatenated_string; 47, attribute; 48, argument_list; 49, expression_statement; 50, as_pattern; 51, block; 52, attribute; 53, argument_list; 54, expression_statement; 55, as_pattern; 56, block; 57, string:"Post-upgrade check for %s failed with the "; 58, string:"following errors:"; 59, identifier:self; 60, identifier:_setup_log_prefix; 61, keyword_argument; 62, call; 63, identifier:RuntimeError; 64, as_pattern_target; 65, expression_statement; 66, identifier:self; 67, identifier:_setup_log_prefix; 68, keyword_argument; 69, call; 70, identifier:RuntimeError; 71, as_pattern_target; 72, expression_statement; 73, identifier:plugin_id; 74, attribute; 75, attribute; 76, argument_list; 77, identifier:e; 78, call; 79, identifier:plugin_id; 80, attribute; 81, identifier:check; 82, argument_list; 83, identifier:e; 84, call; 85, identifier:u; 86, identifier:name; 87, identifier:u; 88, identifier:post_upgrade; 89, attribute; 90, argument_list; 91, identifier:check; 92, identifier:__name__; 93, attribute; 94, argument_list; 95, identifier:errors; 96, identifier:append; 97, tuple; 98, identifier:errors; 99, identifier:append; 100, tuple; 101, attribute; 102, attribute; 103, attribute; 104, attribute; 105, identifier:u; 106, identifier:name; 107, identifier:e; 108, identifier:args; 109, identifier:check; 110, identifier:__name__; 111, identifier:e; 112, identifier:args
code: def post_upgrade_checks(self, upgrades):
          """Run post-upgrade checks after applying all pending upgrades.
  
          Post checks may be used to emit warnings encountered when applying an
          upgrade, but post-checks can also be used to advice the user to run
          re-indexing or similar long running processes.
  
          Post-checks may query for user-input, but should respect the
          --yes-i-know option to run in an unattended mode.
  
          All applied upgrades post-checks are executed.
  
          :param upgrades: List of upgrades sorted in topological order.
          """
          errors = []
  
          for u in upgrades:
              self._setup_log_prefix(plugin_id=u.name)
              try:
                  u.post_upgrade()
              except RuntimeError as e:
                  errors.append((u.name, e.args))
  
          for check in self.global_post_upgrade:
              self._setup_log_prefix(plugin_id=check.__name__)
              try:
                  check()
              except RuntimeError as e:
                  errors.append((check.__name__, e.args))
  
          self._teardown_log_prefix()
  
          self._check_errors(errors, "Post-upgrade check for %s failed with the "
                             "following errors:")