<commit_before># Lunch-Bot 2.0

import math
import requests
import slackweb
import slackkeys
from bs4 import BeautifulSoup
from datetime import datetime

slack = slackweb.Slack(url=slackkeys.slackKeys['fuf'])

weeklySpots = [
  {
    "location": "https://www.google.com/maps/place/Lumen/@48.7723682,9.156562,17z/",
    "restaurant": "Lumen",
    "number": "lumen",
    "menu": "http://lumen-stuttgart.de/tag/tageskarte/"
  },
  {
    "location": "https://www.google.com/maps/place/Wirtshaus+Troll/@48.7717122,9.1588948,17.25z/",
    "restaurant": "Wirtshaus Troll",
    "number": "wirtshaus_troll",
    "menu": "http://www.wirtshaus-troll.de/Tagesessen.pdf",
    "vacationFrom": "2015-07-29",
    "vacationTo": "2015-09-13"
  },
  {
    "location": "https://www.google.com/maps/place/Rote+Kapelle/@48.7717538,9.1595805,17.25z/",
    "restaurant": "Rote Kapelle",
    "number": "rote_kapelle",
    "menu": "http://rote-kapelle.de/cashs/mittags.php"
  },
  {
    "location": "https://www.google.de/maps/place/Roteb%C3%BChlstra%C3%9Fe+121,+70178+Stuttgart/@48.77072,9.15919,17z/",
    "restaurant": "Tavolino",
    "number": "tavolino",
    "menu": "http://www.tavolino.info/Wochenempfehlung/"
  },
  {
    "location": "https://www.google.com/maps/place/Pizzeria+La+Piccola+Napoli/@48.7714401,9.1577603,17z/",
    "restaurant": "Pizzeria La Piccola Napoli",
    "number": "napoli",
    "menu": "http://www.piccola-napoli.de/mittag.html",
    "vacationFrom": "2015-08-02",
    "vacationTo": "2015-09-03"
  },
  {
    "location": "https://www.google.com/maps/place/Rappen/@48.7754963,9.165019,17.75z/",
    "restaurant": "Rappen",
    "number": "rappen",
    "menu": "http://www.rappen-stuttgart.de/",
    "vacationFrom": "2015-08-30",
    "vacationTo": "2015-09-12"
  },
  {
    "location": "https://www.google.com/maps/place/Caf%C3%A9+Chiquil%C3%ADn/@48.7707633,9.1557995,17z/",
    "restaurant": "Café Chiquilín",
    "number": "chiquilin",
    "menu": "http://chiquilin.de/#wochenkarte",
    "credit": "yes",
    "dayoff": 1
  },
  {
    "location": "https://www.google.com/maps/place/Cafe+Moulu/@48.7761901,9.1620446,17z/",
    "restaurant": "Café Moulu",
    "number": "moulu",
    "menu": "https://www.facebook.com/media/set/?set=a.729087223873898.1073741836.397970303652260&type=3"
  },
  {
    "location": "https://www.google.com/maps/place/Gastst%C3%A4tte+Wohnzimmer/@48.7761901,9.1620446,17z/",
    "restaurant": "Wohnzimmer",
    "number": "wohnzimmer",
    "menu": "http://www.unserwohnzimmer.de/sites/wochenkarte.php"
  },
  {
    "location": "https://www.google.com/maps/place/Auszeit/@48.7714981,9.1637756,17.25z/",
    "restaurant": "Auszeit",
    "number": "auszeit"
  }
]

staticSpots = [
  {
    "location": "https://www.google.com/maps/place/STUGGI+Burger/@48.774937,9.1552269,17z/",
    "restaurant": "STUGGI Burger",
    "number": "stuggi",
    "menu": "https://www.facebook.com/StuggiBurger",
    "vacationFrom": "2015-08-17",
    "vacationTo": "2015-08-30"
  },
  {
    "location": "https://www.google.com/maps/place/The+Burger+Republic/@48.7730483,9.1727579,17z/",
    "restaurant": "The Burger Republic",
    "number": "burger_republic",
    "menu": "http://www.theburgerrepublic.de/#!nemu/ccw7",
    "credit": "yes"
  },
  {
    "location": "https://www.google.com/maps/place/Restaurant+Vapiano+Stuttgart+II/@48.7781245,9.1689675,15.75z/",
    "restaurant": "Vapiano",
    "number": "vapiano",
    "menu": "http://de.vapiano.com/de/menue/specials/",
    "credit": "yes"
  },
  {
    "location": "https://www.google.com/maps/place/Ristorante+Regenbogen/@48.773013,9.1627332,17z/",
    "restaurant": "R<NAME>",
    "number": "rainbow",
    "menu": "http://ristorante-regenbogen.com/#download"
  },
  {
    "location": "https://www.google.com/maps/place/Joey's+Pizza+Service+Stuttgart+West/@48.7716378,9.1586624,16.5z/",
    "restaurant": "Joey's Pizza",
    "number": "joeys",
    "menu": "http://www.joeys.de/store/stuttgart-west/list/mittagsangebot",
    "credit": "yes"
  },
  {
    "location": "https://encrypted.google.com/maps/place/Mai+%26+Sushi/@48.7725488,9.1566256,17z/",
    "restaurant": "Mai & Sushi",
    "number": "sushi",
    "menu": "https://www.facebook.com/Sushi.and.more/photos/pb.400214640042962.-2207520000.1438589211./941992522531835/?type=3&theater",
    "vacationFrom": "2015-08-17",
    "vacationTo": "2015-08-30"
  },
  {
    "location": "https://www.google.com/maps/place/Bugan/@48.7716675,9.1731329,17z/",
    "restaurant": "Bugan",
    "number": "bugan",
    "menu": "http://imgur.com/a/bRVHg",
    "credit": "yes"
  },
  {
    "location": "https://www.google.com/maps/place/Lemon+Grass/@48.772307,9.1686283,19z/",
    "restaurant": "Lemon Grass",
    "number": "lemon_grass"
  },
  {
    "location": "https://www.google.de/maps/place/Silberburgstra%C3%9Fe+149,+70176+Stuttgart/@48.7736708,9.1666873,18z/",
    "restaurant": "Aras",
    "number": "aras"
  }
]


def weekDay(year, month, day):
    offset = [0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334]
    week   = ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday',  'Friday', 'Saturday']
    afterFeb = 1
    if month > 2:
        afterFeb = 0
    aux = year - 1700 - afterFeb
    dayOfWeek  = 5
    dayOfWeek += (aux + afterFeb) * 365
    dayOfWeek += aux / 4 - aux / 100 + (aux + 100) / 400
    dayOfWeek += offset[month - 1] + (day - 1)
    dayOfWeek %= 7
    return week[math.floor(dayOfWeek)]


def restaurants(spots):
  destination = ''
  for x in range(0, len(spots)):
    entry = ''
    if 'vacationFrom' in spots[x] and spots[x]['vacationFrom'] < str(datetime.now()) < spots[x]['vacationTo']:
      entry = ''
    else:
      if 'menu' in spots[x] and 'credit' in spots[x]:  # if lunchspot has payment option other than cash display card emoji
        entry = "<" + spots[x]['location'] + "|:" + spots[x]['number'] + ":> <" + spots[x]['menu'] + "|" + spots[x]['restaurant'] + "> :credit_card:\n"
      elif 'menu' in spots[x]:
        entry = "<" + spots[x]['location'] + "|:" + spots[x]['number'] + ":> <" + spots[x]['menu'] + "|" + spots[x]['restaurant'] + ">\n"
      else:
        entry = "<" + spots[x]['location'] + "|:" + spots[x]['number'] + ":> " + spots[x]['restaurant'] + "\n"
    destination += entry
  return destination

toDay = weekDay(int(str(datetime.now())[:4]), int(str(datetime.now())[5:7].lstrip('0')), int(str(datetime.now())[8:10]))

with requests.Session() as s:
  kapelleUrl = s.get('http://rote-kapelle.de/cashs/mittags.php')
  kapelleSoup = BeautifulSoup(kapelleUrl.content, 'html5lib')
  kapelleFull = kapelleSoup.find_all('span', {'class': 'times12'})
  kapelleToday = "\n:rote_kapelle: " + kapelleFull[4].text

  napoliUrl = s.get('http://www.piccola-napoli.de/datei.html')
  napoliSoup = BeautifulSoup(napoliUrl.content, 'html5lib')
  napoliFull = napoliSoup.find_all('p')
  napoliMonday = str(napoliFull[4].text).splitlines()[1].replace('\t', '').replace('€', '')
  napoliTuesday = str(napoliFull[11].text).splitlines()[1].replace('\t', '').replace('€', '')
  napoliWednesday = str(napoliFull[18].text).splitlines()[1].replace('\t', '').replace('€', '')
  napoliThursday = str(napoliFull[25].text).splitlines()[1].replace('\t', '').replace('€', '')
  napoliFriday = str(napoliFull[32].text).splitlines()[1].replace('\t', '').replace('€', '')
  napoliToday = ''
  if toDay == 'Monday':
    napoliToday = "\n:napoli: " + napoliMonday<commit_msg>Add the second line for Napoli suggestions in parentheses<commit_after># Lunch-Bot 2.0

import math
import requests
import slackweb
import slackkeys
from bs4 import BeautifulSoup
from datetime import datetime

slack = slackweb.Slack(url=slackkeys.slackKeys['fuf'])  # codinggoat

weeklySpots = [
  {
    "location": "https://www.google.com/maps/place/Lumen/@48.7723682,9.156562,17z/",
    "restaurant": "Lumen",
    "number": "lumen",
    "menu": "http://lumen-stuttgart.de/tag/tageskarte/"
  },
  {
    "location": "https://www.google.com/maps/place/Wirtshaus+Troll/@48.7717122,9.1588948,17.25z/",
    "restaurant": "Wirtshaus Troll",
    "number": "wirtshaus_troll",
    "menu": "http://www.wirtshaus-troll.de/Tagesessen.pdf",
    "vacationFrom": "2015-07-29",
    "vacationTo": "2015-09-13"
  },
  {
    "location": "https://www.google.com/maps/place/Rote+Kapelle/@48.7717538,9.1595805,17.25z/",
    "restaurant": "Rote Kapelle",
    "number": "rote_kapelle",
    "menu": "http://rote-kapelle.de/cashs/mittags.php"
  },
  {
    "location": "https://www.google.de/maps/place/Roteb%C3%BChlstra%C3%9Fe+121,+70178+Stuttgart/@48.77072,9.15919,17z/",
    "restaurant": "Tavolino",
    "number": "tavolino",
    "menu": "http://www.tavolino.info/Wochenempfehlung/"
  },
  {
    "location": "https://www.google.com/maps/place/Pizzeria+La+Piccola+Napoli/@48.7714401,9.1577603,17z/",
    "restaurant": "Pizzeria La Piccola Napoli",
    "number": "napoli",
    "menu": "http://www.piccola-napoli.de/mittag.html",
    "vacationFrom": "2015-08-02",
    "vacationTo": "2015-09-03"
  },
  {
    "location": "https://www.google.com/maps/place/Rappen/@48.7754963,9.165019,17.75z/",
    "restaurant": "Rappen",
    "number": "rappen",
    "menu": "http://www.rappen-stuttgart.de/",
    "vacationFrom": "2015-08-30",
    "vacationTo": "2015-09-12"
  },
  {
    "location": "https://www.google.com/maps/place/Caf%C3%A9+Chiquil%C3%ADn/@48.7707633,9.1557995,17z/",
    "restaurant": "<NAME>",
    "number": "chiquilin",
    "menu": "http://chiquilin.de/#wochenkarte",
    "credit": "yes",
    "dayoff": 1
  },
  {
    "location": "https://www.google.com/maps/place/Cafe+Moulu/@48.7761901,9.1620446,17z/",
    "restaurant": "Café Moulu",
    "number": "moulu",
    "menu": "https://www.facebook.com/media/set/?set=a.729087223873898.1073741836.397970303652260&type=3"
  },
  {
    "location": "https://www.google.com/maps/place/Gastst%C3%A4tte+Wohnzimmer/@48.7761901,9.1620446,17z/",
    "restaurant": "Wohnzimmer",
    "number": "wohnzimmer",
    "menu": "http://www.unserwohnzimmer.de/sites/wochenkarte.php"
  },
  {
    "location": "https://www.google.com/maps/place/Auszeit/@48.7714981,9.1637756,17.25z/",
    "restaurant": "Auszeit",
    "number": "auszeit"
  }
]

staticSpots = [
  {
    "location": "https://www.google.com/maps/place/STUGGI+Burger/@48.774937,9.1552269,17z/",
    "restaurant": "STUGGI Burger",
    "number": "stuggi",
    "menu": "https://www.facebook.com/StuggiBurger",
    "vacationFrom": "2015-08-17",
    "vacationTo": "2015-08-30"
  },
  {
    "location": "https://www.google.com/maps/place/The+Burger+Republic/@48.7730483,9.1727579,17z/",
    "restaurant": "The Burger Republic",
    "number": "burger_republic",
    "menu": "http://www.theburgerrepublic.de/#!nemu/ccw7",
    "credit": "yes"
  },
  {
    "location": "https://www.google.com/maps/place/Restaurant+Vapiano+Stuttgart+II/@48.7781245,9.1689675,15.75z/",
    "restaurant": "Vapiano",
    "number": "vapiano",
    "menu": "http://de.vapiano.com/de/menue/specials/",
    "credit": "yes"
  },
  {
    "location": "https://www.google.com/maps/place/Ristorante+Regenbogen/@48.773013,9.1627332,17z/",
    "restaurant": "Ristorante Regenbogen",
    "number": "rainbow",
    "menu": "http://ristorante-regenbogen.com/#download"
  },
  {
    "location": "https://www.google.com/maps/place/Joey's+Pizza+Service+Stuttgart+West/@48.7716378,9.1586624,16.5z/",
    "restaurant": "Joey's Pizza",
    "number": "joeys",
    "menu": "http://www.joeys.de/store/stuttgart-west/list/mittagsangebot",
    "credit": "yes"
  },
  {
    "location": "https://encrypted.google.com/maps/place/Mai+%26+Sushi/@48.7725488,9.1566256,17z/",
    "restaurant": "Mai & Sushi",
    "number": "sushi",
    "menu": "https://www.facebook.com/Sushi.and.more/photos/pb.400214640042962.-2207520000.1438589211./941992522531835/?type=3&theater",
    "vacationFrom": "2015-08-17",
    "vacationTo": "2015-08-30"
  },
  {
    "location": "https://www.google.com/maps/place/Bugan/@48.7716675,9.1731329,17z/",
    "restaurant": "Bugan",
    "number": "bugan",
    "menu": "http://imgur.com/a/bRVHg",
    "credit": "yes"
  },
  {
    "location": "https://www.google.com/maps/place/Lemon+Grass/@48.772307,9.1686283,19z/",
    "restaurant": "Lemon Grass",
    "number": "lemon_grass"
  },
  {
    "location": "https://www.google.de/maps/place/Silberburgstra%C3%9Fe+149,+70176+Stuttgart/@48.7736708,9.1666873,18z/",
    "restaurant": "Aras",
    "number": "aras"
  }
]


def weekDay(year, month, day):
    offset = [0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334]
    week   = ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday',  'Friday', 'Saturday']
    afterFeb = 1
    if month > 2:
        afterFeb = 0
    aux = year - 1700 - afterFeb
    dayOfWeek  = 5
    dayOfWeek += (aux + afterFeb) * 365
    dayOfWeek += aux / 4 - aux / 100 + (aux + 100) / 400
    dayOfWeek += offset[month - 1] + (day - 1)
    dayOfWeek %= 7
    return week[math.floor(dayOfWeek)]


def restaurants(spots):
  destination = ''
  for x in range(0, len(spots)):
    entry = ''
    if 'vacationFrom' in spots[x] and spots[x]['vacationFrom'] < str(datetime.now()) < spots[x]['vacationTo']:
      entry = ''
    else:
      if 'menu' in spots[x] and 'credit' in spots[x]:  # if lunchspot has payment option other than cash display card emoji
        entry = "<" + spots[x]['location'] + "|:" + spots[x]['number'] + ":> <" + spots[x]['menu'] + "|" + spots[x]['restaurant'] + "> :credit_card:\n"
      elif 'menu' in spots[x]:
        entry = "<" + spots[x]['location'] + "|:" + spots[x]['number'] + ":> <" + spots[x]['menu'] + "|" + spots[x]['restaurant'] + ">\n"
      else:
        entry = "<" + spots[x]['location'] + "|:" + spots[x]['number'] + ":> " + spots[x]['restaurant'] + "\n"
    destination += entry
  return destination

toDay = weekDay(int(str(datetime.now())[:4]), int(str(datetime.now())[5:7].lstrip('0')), int(str(datetime.now())[8:10]))

with requests.Session() as s:
  kapelleUrl = s.get('http://rote-kapelle.de/cashs/mittags.php')
  kapelleSoup = BeautifulSoup(kapelleUrl.content, 'html5lib')
  kapelleFull = kapelleSoup.find_all('span', {'class': 'times12'})
  kapelleToday = "\n:rote_kapelle: " + kapelleFull[4].text

  napoliUrl = s.get('http://www.piccola-napoli.de/datei.html')
  napoliSoup = BeautifulSoup(napoliUrl.content, 'html5lib')
  napoliFull = napoliSoup.find_all('p')
  napoliMonday = str(napoliFull[4].text).splitlines()[1].replace('\t', '').replace('€', '') + "(" + str(napoliFull[5].text).splitlines()[0].replace('\t', '') + ' ' + str(napoliFull[5].text).splitlines()[1].replace('\t', '') + ")"
  napoliTuesday = str(napoliFull[11].text).splitlines()[1].replace('\t', '').replace('€', '') + "(" + str(napoliFull[12].text).splitlines()[0].replace('\t', '') + ' ' + str(napoliFull[12].text).splitlines()[1].replace('\t', '') + ")"
  napoliWednesday = str(napoliFull[18].text).splitlines()[1].replace('\t', '').replace('€', '') + "(" + str(napoliFull[19].text).splitlines()[0].replace('\t', '') + ' ' + str(napoliFull[19].text).splitlines()[1].replace('\t', '') + ")"
  napoliThursday = str(napoliFull[25].text).splitlines()[1].replace('\t', '').replace('€', '') + "(" + str(napoliFull[25].text).splitlines()[0].replace('\t', '') + ' ' + str(napoliFull[25].text).splitlines()[1].replace('\t', '') + ")"
  napoliFriday = str(napoliFull[32].text).splitlines()[1].replace('\t', '').replace('€', '') + "(" + str(napoliFull[33].text).splitlines()[0].replace('\t', '') + ' ' + str(napoliFull[33].text).splitlines()[1].replace('\t', '') + ")"
  napoliToday = ''
  if toDay == 'Monday':
    napoliToday = "\n:napoli: " + napoliMonday
{'fraction_non_alphanumeric': 0.22908904021585508, 'fraction_numerical': 0.08531414621611204, 'mean_word_length': 3.829972075705864, 'pattern_counts': {'":': 184, '<': 19, '<?xml version=': 0, '>': 17, 'https://': 44, 'lorem ipsum': 0, 'www.': 58, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7336391', 'n_tokens_mistral': 7257, 'n_tokens_neox': 6255, 'n_words': 790}