nodes: 0, module; 1, function_definition; 2, function_name:cdx_load; 3, parameters; 4, block; 5, identifier:sources; 6, identifier:query; 7, default_parameter; 8, expression_statement; 9, expression_statement; 10, comment:# page count is a special case, no further processing; 11, if_statement; 12, expression_statement; 13, if_statement; 14, expression_statement; 15, for_statement; 16, if_statement; 17, return_statement; 18, identifier:process; 19, True; 20, comment:"""
      merge text CDX lines from sources, return an iterator for
      filtered and access-checked sequence of CDX objects.
  
      :param sources: iterable for text CDX sources.
      :param process: bool, perform processing sorting/filtering/grouping ops
      """; 21, assignment; 22, attribute; 23, block; 24, assignment; 25, boolean_operator; 26, block; 27, assignment; 28, identifier:op; 29, identifier:custom_ops; 30, block; 31, comparison_operator:query.output == 'text'; 32, block; 33, elif_clause; 34, identifier:cdx_iter; 35, identifier:cdx_iter; 36, call; 37, identifier:query; 38, identifier:page_count; 39, return_statement; 40, identifier:cdx_iter; 41, call; 42, identifier:process; 43, not_operator; 44, expression_statement; 45, identifier:custom_ops; 46, attribute; 47, expression_statement; 48, attribute; 49, string; 50, expression_statement; 51, comparison_operator:query.output == 'json'; 52, block; 53, identifier:create_merged_cdx_gen; 54, argument_list; 55, identifier:cdx_iter; 56, identifier:make_obj_iter; 57, argument_list; 58, attribute; 59, assignment; 60, identifier:query; 61, identifier:custom_ops; 62, assignment; 63, identifier:query; 64, identifier:output; 65, string_content:text; 66, assignment; 67, attribute; 68, string; 69, expression_statement; 70, identifier:sources; 71, identifier:query; 72, identifier:cdx_iter; 73, identifier:query; 74, identifier:query; 75, identifier:secondary_index_only; 76, identifier:cdx_iter; 77, call; 78, identifier:cdx_iter; 79, call; 80, identifier:cdx_iter; 81, call; 82, identifier:query; 83, identifier:output; 84, string_content:json; 85, assignment; 86, identifier:process_cdx; 87, argument_list; 88, identifier:op; 89, argument_list; 90, identifier:cdx_to_text; 91, argument_list; 92, identifier:cdx_iter; 93, call; 94, identifier:cdx_iter; 95, identifier:query; 96, identifier:cdx_iter; 97, identifier:query; 98, identifier:cdx_iter; 99, attribute; 100, identifier:cdx_to_json; 101, argument_list; 102, identifier:query; 103, identifier:fields; 104, identifier:cdx_iter; 105, attribute; 106, identifier:query; 107, identifier:fields
code: def cdx_load(sources, query, process=True):
      """
      merge text CDX lines from sources, return an iterator for
      filtered and access-checked sequence of CDX objects.
  
      :param sources: iterable for text CDX sources.
      :param process: bool, perform processing sorting/filtering/grouping ops
      """
      cdx_iter = create_merged_cdx_gen(sources, query)
  
      # page count is a special case, no further processing
      if query.page_count:
          return cdx_iter
  
      cdx_iter = make_obj_iter(cdx_iter, query)
  
      if process and not query.secondary_index_only:
          cdx_iter = process_cdx(cdx_iter, query)
  
      custom_ops = query.custom_ops
      for op in custom_ops:
          cdx_iter = op(cdx_iter, query)
  
      if query.output == 'text':
          cdx_iter = cdx_to_text(cdx_iter, query.fields)
      elif query.output == 'json':
          cdx_iter = cdx_to_json(cdx_iter, query.fields)
  
      return cdx_iter