nodes: 0, module; 1, function_definition; 2, function_name:get_all_artifacts_per_task_id; 3, parameters; 4, block; 5, identifier:chain; 6, identifier:upstream_artifacts; 7, expression_statement; 8, expression_statement; 9, for_statement; 10, if_statement; 11, comment:# Avoid duplicate paths per task_id; 12, for_statement; 13, return_statement; 14, comment:"""Return every artifact to download, including the Chain Of Trust Artifacts.
  
      Args:
          chain (ChainOfTrust): the chain of trust object
          upstream_artifacts: the list of upstream artifact definitions
  
      Returns:
          dict: sorted list of paths to downloaded artifacts ordered by taskId
  
      """; 15, assignment; 16, identifier:link; 17, attribute; 18, comment:# Download task-graph.json for decision+action task cot verification; 19, block; 20, identifier:upstream_artifacts; 21, block; 22, pattern_list; 23, call; 24, block; 25, identifier:all_artifacts_per_task_id; 26, identifier:all_artifacts_per_task_id; 27, dictionary; 28, identifier:chain; 29, identifier:links; 30, if_statement; 31, comment:# Download actions.json for decision+action task cot verification; 32, if_statement; 33, for_statement; 34, identifier:task_id; 35, identifier:paths; 36, attribute; 37, argument_list; 38, expression_statement; 39, comparison_operator:link.task_type in PARENT_TASK_TYPES; 40, block; 41, comparison_operator:link.task_type in DECISION_TASK_TYPES; 42, block; 43, identifier:upstream_dict; 44, identifier:upstream_artifacts; 45, block; 46, identifier:all_artifacts_per_task_id; 47, identifier:items; 48, assignment; 49, attribute; 50, identifier:PARENT_TASK_TYPES; 51, expression_statement; 52, attribute; 53, identifier:DECISION_TASK_TYPES; 54, expression_statement; 55, expression_statement; 56, expression_statement; 57, subscript; 58, call; 59, identifier:link; 60, identifier:task_type; 61, call; 62, identifier:link; 63, identifier:task_type; 64, call; 65, call; 66, call; 67, identifier:all_artifacts_per_task_id; 68, identifier:task_id; 69, identifier:sorted; 70, argument_list; 71, identifier:add_enumerable_item_to_dict; 72, argument_list; 73, identifier:add_enumerable_item_to_dict; 74, argument_list; 75, identifier:add_enumerable_item_to_dict; 76, argument_list; 77, identifier:add_enumerable_item_to_dict; 78, argument_list; 79, call; 80, keyword_argument; 81, keyword_argument; 82, keyword_argument; 83, keyword_argument; 84, keyword_argument; 85, keyword_argument; 86, keyword_argument; 87, keyword_argument; 88, keyword_argument; 89, keyword_argument; 90, keyword_argument; 91, keyword_argument; 92, identifier:set; 93, argument_list; 94, identifier:dict_; 95, identifier:all_artifacts_per_task_id; 96, identifier:key; 97, attribute; 98, identifier:item; 99, string; 100, identifier:dict_; 101, identifier:all_artifacts_per_task_id; 102, identifier:key; 103, attribute; 104, identifier:item; 105, string; 106, identifier:dict_; 107, identifier:all_artifacts_per_task_id; 108, identifier:key; 109, attribute; 110, identifier:item; 111, string; 112, identifier:dict_; 113, identifier:all_artifacts_per_task_id; 114, identifier:key; 115, subscript; 116, identifier:item; 117, subscript; 118, identifier:paths; 119, identifier:link; 120, identifier:task_id; 121, string_content:public/task-graph.json; 122, identifier:link; 123, identifier:task_id; 124, string_content:public/actions.json; 125, identifier:link; 126, identifier:task_id; 127, string_content:public/parameters.yml; 128, identifier:upstream_dict; 129, string; 130, identifier:upstream_dict; 131, string; 132, string_content:taskId; 133, string_content:paths
code: def get_all_artifacts_per_task_id(chain, upstream_artifacts):
      """Return every artifact to download, including the Chain Of Trust Artifacts.
  
      Args:
          chain (ChainOfTrust): the chain of trust object
          upstream_artifacts: the list of upstream artifact definitions
  
      Returns:
          dict: sorted list of paths to downloaded artifacts ordered by taskId
  
      """
      all_artifacts_per_task_id = {}
      for link in chain.links:
          # Download task-graph.json for decision+action task cot verification
          if link.task_type in PARENT_TASK_TYPES:
              add_enumerable_item_to_dict(
                  dict_=all_artifacts_per_task_id, key=link.task_id, item='public/task-graph.json'
              )
          # Download actions.json for decision+action task cot verification
          if link.task_type in DECISION_TASK_TYPES:
              add_enumerable_item_to_dict(
                  dict_=all_artifacts_per_task_id, key=link.task_id, item='public/actions.json'
              )
              add_enumerable_item_to_dict(
                  dict_=all_artifacts_per_task_id, key=link.task_id, item='public/parameters.yml'
              )
  
      if upstream_artifacts:
          for upstream_dict in upstream_artifacts:
              add_enumerable_item_to_dict(
                  dict_=all_artifacts_per_task_id, key=upstream_dict['taskId'], item=upstream_dict['paths']
              )
  
      # Avoid duplicate paths per task_id
      for task_id, paths in all_artifacts_per_task_id.items():
          all_artifacts_per_task_id[task_id] = sorted(set(paths))
  
      return all_artifacts_per_task_id