nodes: 0, module; 1, function_definition; 2, function_name:getmerge; 3, parameters; 4, block; 5, identifier:self; 6, identifier:path; 7, identifier:dst; 8, default_parameter; 9, default_parameter; 10, expression_statement; 11, if_statement; 12, if_statement; 13, expression_statement; 14, expression_statement; 15, expression_statement; 16, try_statement; 17, identifier:newline; 18, False; 19, identifier:check_crc; 20, False; 21, string; 22, not_operator; 23, block; 24, not_operator; 25, block; 26, assignment; 27, assignment; 28, assignment; 29, block; 30, finally_clause; 31, string_content:Get all the files in the directories that
          match the source file pattern and merge and sort them to only
          one file on local fs.
  
          :param paths: Directory containing files that will be merged
          :type paths: string
          :param dst: Path of file that will be written
          :type dst: string
          :param nl: Add a newline character at the end of each file.
          :type nl: boolean
          :returns: string content of the merged file at dst; 32, identifier:path; 33, raise_statement; 34, identifier:dst; 35, raise_statement; 36, identifier:temporary_target; 37, binary_operator:"%s._COPYING_" % dst; 38, identifier:f; 39, call; 40, identifier:processor; 41, lambda; 42, for_statement; 43, expression_statement; 44, block; 45, call; 46, call; 47, string:"%s._COPYING_"; 48, identifier:dst; 49, identifier:open; 50, argument_list; 51, lambda_parameters; 52, call; 53, identifier:item; 54, call; 55, block; 56, yield; 57, if_statement; 58, identifier:InvalidInputException; 59, argument_list; 60, identifier:InvalidInputException; 61, argument_list; 62, identifier:temporary_target; 63, string; 64, identifier:path; 65, identifier:node; 66, default_parameter; 67, default_parameter; 68, attribute; 69, argument_list; 70, attribute; 71, argument_list; 72, for_statement; 73, if_statement; 74, dictionary; 75, call; 76, block; 77, string:"getmerge: no path given"; 78, string:"getmerge: no destination given"; 79, string_content:w; 80, identifier:dst; 81, identifier:dst; 82, identifier:check_crc; 83, identifier:check_crc; 84, identifier:self; 85, identifier:_handle_getmerge; 86, identifier:path; 87, identifier:node; 88, identifier:dst; 89, identifier:check_crc; 90, identifier:self; 91, identifier:_find_items; 92, list; 93, identifier:processor; 94, keyword_argument; 95, keyword_argument; 96, keyword_argument; 97, identifier:load; 98, identifier:item; 99, block; 100, boolean_operator; 101, block; 102, pair; 103, pair; 104, pair; 105, pair; 106, pair; 107, attribute; 108, argument_list; 109, expression_statement; 110, expression_statement; 111, identifier:path; 112, identifier:include_toplevel; 113, True; 114, identifier:recurse; 115, False; 116, identifier:include_children; 117, True; 118, if_statement; 119, identifier:newline; 120, subscript; 121, expression_statement; 122, string:"path"; 123, identifier:dst; 124, string:"response"; 125, string; 126, string:"result"; 127, True; 128, string:"error"; 129, subscript; 130, string:"source_path"; 131, identifier:path; 132, attribute; 133, identifier:isfile; 134, identifier:temporary_target; 135, call; 136, call; 137, subscript; 138, block; 139, elif_clause; 140, identifier:load; 141, string; 142, call; 143, identifier:load; 144, string; 145, identifier:os; 146, identifier:path; 147, attribute; 148, argument_list; 149, attribute; 150, argument_list; 151, identifier:load; 152, string; 153, expression_statement; 154, not_operator; 155, block; 156, string_content:response; 157, attribute; 158, argument_list; 159, string_content:error; 160, identifier:f; 161, identifier:close; 162, identifier:os; 163, identifier:rename; 164, identifier:temporary_target; 165, identifier:dst; 166, string_content:result; 167, call; 168, comparison_operator:load['error'] is ''; 169, if_statement; 170, raise_statement; 171, identifier:f; 172, identifier:write; 173, string:"\n"; 174, attribute; 175, argument_list; 176, subscript; 177, string; 178, call; 179, block; 180, call; 181, identifier:f; 182, identifier:write; 183, subscript; 184, identifier:load; 185, string; 186, attribute; 187, argument_list; 188, expression_statement; 189, identifier:FatalException; 190, argument_list; 191, identifier:load; 192, string; 193, string_content:error; 194, attribute; 195, identifier:isfile; 196, identifier:temporary_target; 197, call; 198, subscript; 199, string_content:response; 200, identifier:os; 201, identifier:path; 202, attribute; 203, argument_list; 204, identifier:load; 205, string; 206, identifier:os; 207, identifier:remove; 208, identifier:temporary_target; 209, string_content:error
code: def getmerge(self, path, dst, newline=False, check_crc=False):
          ''' Get all the files in the directories that
          match the source file pattern and merge and sort them to only
          one file on local fs.
  
          :param paths: Directory containing files that will be merged
          :type paths: string
          :param dst: Path of file that will be written
          :type dst: string
          :param nl: Add a newline character at the end of each file.
          :type nl: boolean
          :returns: string content of the merged file at dst
          '''
          if not path:
              raise InvalidInputException("getmerge: no path given")
          if not dst:
              raise InvalidInputException("getmerge: no destination given")
  
          temporary_target = "%s._COPYING_" % dst
          f = open(temporary_target, 'w')
  
          processor = lambda path, node, dst=dst, check_crc=check_crc: self._handle_getmerge(path, node, dst, check_crc)
          try:
              for item in self._find_items([path], processor, include_toplevel=True, recurse=False, include_children=True):
                  for load in item:
                      if load['result']:
                          f.write(load['response'])
                      elif not load['error'] is '':
                          if os.path.isfile(temporary_target):
                              os.remove(temporary_target)
                          raise FatalException(load['error'])
                  if newline and load['response']:
                      f.write("\n")
              yield {"path": dst, "response": '', "result": True, "error": load['error'], "source_path": path}
  
          finally:
              if os.path.isfile(temporary_target):
                  f.close()
                  os.rename(temporary_target, dst)