Replace custom infinite iterator with itertools.count

main
Luca 3 years ago
parent 52e8d70ad7
commit 72e6d9bb1a

@ -17,6 +17,7 @@
from collections import namedtuple from collections import namedtuple
from datetime import * from datetime import *
from icalendar import Calendar from icalendar import Calendar
from itertools import count
from xml.dom import Node from xml.dom import Node
from xml.dom.minidom import getDOMImplementation from xml.dom.minidom import getDOMImplementation
@ -102,12 +103,6 @@ def calendar_to_xml(cal):
return e return e
def positive_integers():
i = 1
while True:
yield i
i += 1
root(elem( root(elem(
'version', 'version',
str(version), str(version),
@ -120,7 +115,7 @@ def calendar_to_xml(cal):
)) ))
fmt = lambda dt: dt.isoformat(timespec='seconds') fmt = lambda dt: dt.isoformat(timespec='seconds')
id = positive_integers() id = count(1)
for index, day in enumerate(sorted(days.keys())): for index, day in enumerate(sorted(days.keys())):
start, end, rooms = days[day] start, end, rooms = days[day]
root(elem( root(elem(

Loading…
Cancel
Save