Commit 92cb5bf4 authored by Maxime Bombar's avatar Maxime Bombar

Remove trailing whitespaces

parent 8a7a50dc
......@@ -2,7 +2,7 @@
#-*- mode:python3 -*-
"""
Dependencies :
Dependencies :
- BeautifulSoup
- icalendar
"""
......@@ -55,7 +55,7 @@ def pretty_schedule(schedule):
def format(days):
"""
days: list of list.
days: list of list.
Each day is a sublist which contains the classes for this day.
Format everything from BeautifulSoup tags to strings, into a list of list of dict
"""
......@@ -85,7 +85,7 @@ def pretty_print(days, date):
date, '%y-%m-%d'
).strftime('%y-W%W') + '-%s' % i, '%y-W%W-%w'
).strftime("%A %B %d, %Y")
print("----------------------------------")
print(" %s:" % day_date)
print("----------------------------------")
......@@ -114,8 +114,8 @@ def fill_calendar(c, days, date):
date, '%y-%m-%d'
).strftime('%y-W%W') + '-%s' % i, '%y-W%W-%w'
)
for clas in days[i-1]:
e = Event()
......@@ -157,13 +157,13 @@ def fill_calendar(c, days, date):
except:
pass
e.add('summary', summary)
e.add('summary', summary)
dtstart = day_date.replace(hour=h_start, minute=m_start)
dtend = day_date.replace(hour=h_end, minute=m_end)
e.add('dtstart', dtstart)
e.add('dtend', dtend)
c.add_component(e)
if __name__ == '__main__':
......@@ -186,9 +186,9 @@ if __name__ == '__main__':
help="export ics",
action="store_true",
)
args = parser.parse_args()
date = datetime.datetime.strptime(
datetime.datetime.strptime(
args.date, '%y-%m-%d'
......@@ -197,9 +197,9 @@ if __name__ == '__main__':
http = urllib3.PoolManager()
request = http.request('GET', 'http://agreg.cmla.ens-cachan.fr/edt.php?option=in&sem=%s&suff=' % (date,))
html = request.data
soup = BeautifulSoup.BeautifulSoup(html, 'lxml') # Create the soup
a = soup.find_all('big')[57:] # Fetch "Big" tags, begins from first class on Monday
......@@ -207,14 +207,14 @@ if __name__ == '__main__':
schedule = get_schedule(a)
days = pretty_schedule(schedule)
if args.pretty:
pretty_print(days, date)
c = Calendar()
fill_calendar(c, days, date)
print(c.to_ical().decode('utf-8'))
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment