parameters: (response)
docstring: Remove excess tickets
docstring_summary: Remove excess tickets
docstring_tokens: Remove excess tickets
function: def remove_excess_tickets(response):
      """
      Remove excess tickets
      """
      logger = logging.getLogger(__name__)
  
      fare_ticket_id_list = set()
      for j in response.journeys:
          for t_id in j.fare.ticket_id:
              fare_ticket_id_list.add(t_id)
          # ridesharing case
          for s in j.sections:
              for rj in s.ridesharing_journeys:
                  for t_id in rj.fare.ticket_id:
                      fare_ticket_id_list.add(t_id)
  
      for t in reversed(response.tickets):
          if not t.id in fare_ticket_id_list:
              logger.debug('remove excess ticket id %s', t.id)
              response.tickets.remove(t)
function_tokens: def remove_excess_tickets ( response ) : logger = logging . getLogger ( __name__ ) fare_ticket_id_list = set ( ) for j in response . journeys : for t_id in j . fare . ticket_id : fare_ticket_id_list . add ( t_id ) # ridesharing case for s in j . sections : for rj in s . ridesharing_journeys : for t_id in rj . fare . ticket_id : fare_ticket_id_list . add ( t_id ) for t in reversed ( response . tickets ) : if not t . id in fare_ticket_id_list : logger . debug ( 'remove excess ticket id %s' , t . id ) response . tickets . remove ( t )