parameters: (input_file, output_file)
docstring: Core method of the script, parses <personFlow> tags in an XML file and generates <person> elements.
      The generated <person> elements are sorted by their depart time.
      The original file is not modified and the result is written in another file.
      The resulting file will not contain the <personFlow> elements.
      Note that the output file is overwritten if it is already exist
      :param input_file: The path of the input file
      :param output_file: The path of the output file
docstring_summary: Core method of the script, parses <personFlow> tags in an XML file and generates <person> elements.
      The generated <person> elements are sorted by their depart time.
      The original file is not modified and the result is written in another file.
      The resulting file will not contain the <personFlow> elements.
      Note that the output file is overwritten if it is already exist
      :param input_file: The path of the input file
      :param output_file: The path of the output file
docstring_tokens: Core method of the script parses <personFlow > tags in an XML file and generates <person > elements . The generated <person > elements are sorted by their depart time . The original file is not modified and the result is written in another file . The resulting file will not contain the <personFlow > elements . Note that the output file is overwritten if it is already exist : param input_file : The path of the input file : param output_file : The path of the output file
function: def generate_persons(input_file, output_file):
      """
      Core method of the script, parses <personFlow> tags in an XML file and generates <person> elements.
      The generated <person> elements are sorted by their depart time.
      The original file is not modified and the result is written in another file.
      The resulting file will not contain the <personFlow> elements.
      Note that the output file is overwritten if it is already exist
      :param input_file: The path of the input file
      :param output_file: The path of the output file
      """
      # Parse the input file
      tree = etree.parse(input_file)
  
      routes = tree.getroot()
      children = list(routes)
      for child in children:
          routes.remove(child)
      PersonRouteElement.wrap_elements(children)
      person_routes = [child for child in children if isinstance(child, PersonRouteElement)]
      PersonFlowElement.wrap_elements(children, routes=person_routes)
      for person_route in person_routes:
          children.remove(person_route)
      person_elements = PersonGenerationElement.generate_multiple(children)
      person_elements.sort(key=lambda e: int(e.get('depart')))
      routes.extend(person_elements)
  
      with open(output_file, "w") as f:
          f.write(etree.tostring(routes).decode())
          f.close()
function_tokens: def generate_persons ( input_file , output_file ) : # Parse the input file tree = etree . parse ( input_file ) routes = tree . getroot ( ) children = list ( routes ) for child in children : routes . remove ( child ) PersonRouteElement . wrap_elements ( children ) person_routes = [ child for child in children if isinstance ( child , PersonRouteElement ) ] PersonFlowElement . wrap_elements ( children , routes = person_routes ) for person_route in person_routes : children . remove ( person_route ) person_elements = PersonGenerationElement . generate_multiple ( children ) person_elements . sort ( key = lambda e : int ( e . get ( 'depart' ) ) ) routes . extend ( person_elements ) with open ( output_file , "w" ) as f : f . write ( etree . tostring ( routes ) . decode ( ) ) f . close ( )