parameters: (review_request, reviews)
docstring: Apply multiple reviews at once.
docstring_summary: Apply multiple reviews at once.
docstring_tokens: Apply multiple reviews at once .
function: def apply_reviews(review_request, reviews):
      """Apply multiple reviews at once."""
      # If there are no reviewers specified throw an error.
      if not review_request["target_people"]:
          raise ReviewError("No reviewers specified. Please find a reviewer by"
                            " asking on JIRA or the mailing list.")
  
      # If there is a circular dependency throw an error.`
      if review_request["id"] in reviews:
          raise ReviewError(
              "Circular dependency detected for review %s."
              "Please fix the 'depends_on' field." % review_request["id"])
  
      reviews.append(review_request["id"])
  
      # First recursively apply the dependent reviews.
      for review in review_request["depends_on"]:
          review_url = review["href"]
          print("Dependent review: %s " % review_url)
          apply_reviews(api(review_url)["review_request"], reviews)
  
      # Now apply this review if not yet submitted.
      if review_request["status"] != "submitted":
          # If the patch does not apply we translate the error to a
          # `ReviewError`; otherwise we let the original exception
          # propagate.
          try:
              apply_review(review_request["id"])
          except subprocess.CalledProcessError as err:
              error = err.output.decode("utf-8")
              if "patch does not apply" in error:
                  raise ReviewError(error)
  
              raise err
function_tokens: def apply_reviews ( review_request , reviews ) : # If there are no reviewers specified throw an error. if not review_request [ "target_people" ] : raise ReviewError ( "No reviewers specified. Please find a reviewer by" " asking on JIRA or the mailing list." ) # If there is a circular dependency throw an error.` if review_request [ "id" ] in reviews : raise ReviewError ( "Circular dependency detected for review %s." "Please fix the 'depends_on' field." % review_request [ "id" ] ) reviews . append ( review_request [ "id" ] ) # First recursively apply the dependent reviews. for review in review_request [ "depends_on" ] : review_url = review [ "href" ] print ( "Dependent review: %s " % review_url ) apply_reviews ( api ( review_url ) [ "review_request" ] , reviews ) # Now apply this review if not yet submitted. if review_request [ "status" ] != "submitted" : # If the patch does not apply we translate the error to a # `ReviewError`; otherwise we let the original exception # propagate. try : apply_review ( review_request [ "id" ] ) except subprocess . CalledProcessError as err : error = err . output . decode ( "utf-8" ) if "patch does not apply" in error : raise ReviewError ( error ) raise err