docstr: Returns the expected next state based on the event and
  the current state.
docstr_tok: ["Returns","the","expected","next","state","based","on","the","event","and","the","current","state","."]
code: def compute_next_state(self, current_state):
      """
      Returns the expected next state based on the event and
      the current state.
      """
      if (
          self.event_name == "pull_request_target"
          and self.event_payload["action"] == "opened"
      ):
          if self.is_committer("pull_request"):
              return PullRequestState.committer_review
          else:
              return PullRequestState.review
      elif (
          self.event_name == "pull_request_review"
          and self.event_payload["action"] == "submitted"
      ):
          review_state = self.event_payload["review"]["state"].lower()
          if not self.is_committer("review"):
              # Non-committer reviews cannot change state once committer has already
              # reviewed, requested changes or approved
              if current_state in (
                  PullRequestState.change_review,
                  PullRequestState.changes,
                  PullRequestState.merge,
              ):
                  return current_state
              else:
                  return PullRequestState.committer_review
          if review_state == "approved":
              return PullRequestState.merge
          else:
              return PullRequestState.changes
      elif (
          self.event_name == "pull_request_target"
          and self.event_payload["action"] == "synchronize"
          and current_state == PullRequestState.changes
      ):
          return PullRequestState.change_review
      # Default already opened PRs to Review state.
      if current_state is None:
          current_state = PullRequestState.review
      return current_state
  
imports: import enum
  import os
  import shlex
  from pathlib import Path
  from functools import lru_cache, partial
  import tempfile
  import click
  import github
  from .utils.git import git
  from .utils.logger import logger
  from .crossbow import Repo, Queue, Config, Target, Job, CommentReport
label_desc: Use image node_id 8 for calling the PullRequestWorkflowBot obj's underlying member method code with example usage: obj.compute_next_state(current_state) and returns: current_state, PullRequestState, PullRequestState, PullRequestState, PullRequestState, PullRequestState, current_state, PullRequestState