original_docstring: Parses the menu for the current week for the Metropol lunch restaurant
      in Innopoli 2 from the restaurant's web page.
docstring: Parses the menu for the current week for the Metropol lunch restaurant
  in Innopoli 2 from the restaurant's web page.
docstring_tokens: Parses the menu for the current week for the Metropol lunch restaurant in Innopoli 2 from the restaurant ' s web page .
code: def parse_metropol_menu(name, url):
      """Parses the menu for the current week for the Metropol lunch restaurant
      in Innopoli 2 from the restaurant's web page."""
      pattern = re.compile(r'([\w\s:;,-]+) \d+,\d+.+')
      day_ids = ['day-ma', 'day-ti', 'day-ke', 'day-to', 'day-pe']
      menu = {}
  
      resp = requests.get(url)
      if not resp.ok:
          return {}
  
      soup = BeautifulSoup(resp.content, 'lxml')
      for day_id in day_ids:
          if not soup.find(id=day_id):
              continue
          day_date = soup.find(id=day_id).find('p').find('strong').text.split(' ')[1]
          menu_list = soup.find(id=day_id).find_all('li')
          day_menu = []
  
          for item in menu_list:
              match = re.match(pattern, item.text)
              if match:
                  day_menu.append(match.groups()[0])
  
          if len(day_menu) > 1:
              parsed_date = datetime.strptime(day_date, '%d.%m.%Y').date()
              menu[parsed_date.isoformat()] = day_menu
  
      return {'name': name, 'menu': menu}
code_tokens: def parse_metropol_menu ( name , url ) : pattern = re . compile ( r'([\w\s:;,-]+) \d+,\d+.+' ) day_ids = [ 'day-ma' , 'day-ti' , 'day-ke' , 'day-to' , 'day-pe' ] menu = { } resp = requests . get ( url ) if not resp . ok : return { } soup = BeautifulSoup ( resp . content , 'lxml' ) for day_id in day_ids : if not soup . find ( id = day_id ) : continue day_date = soup . find ( id = day_id ) . find ( 'p' ) . find ( 'strong' ) . text . split ( ' ' ) [ 1 ] menu_list = soup . find ( id = day_id ) . find_all ( 'li' ) day_menu = [ ] for item in menu_list : match = re . match ( pattern , item . text ) if match : day_menu . append ( match . groups ( ) [ 0 ] ) if len ( day_menu ) > 1 : parsed_date = datetime . strptime ( day_date , '%d.%m.%Y' ) . date ( ) menu [ parsed_date . isoformat ( ) ] = day_menu return { 'name' : name , 'menu' : menu }
short_docstring: Parses the menu for the current week for the Metropol lunch restaurant
  in Innopoli 2 from the restaurant's web page.
short_docstring_tokens: Parses the menu for the current week for the Metropol lunch restaurant in Innopoli 2 from the restaurant ' s web page .
comment: """Parses the menu for the current week for the Metropol lunch restaurant
      in Innopoli 2 from the restaurant's web page."""