-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpick_kringle.py
28 lines (22 loc) · 944 Bytes
/
pick_kringle.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
"""Docstring for the kringle"""
import datetime
from file_worker import FileWorker
from kringlecalc import kriskringle
class pickKringle(object):
""" Try to assign Kris Kringles. """
def __init__(self):
kris_kringle = kriskringle()
recipients = kris_kringle.assign_recipient_list()
self.write_this_years_file(recipients)
self.display_kringles(recipients)
def display_kringles(self, recipients):
""" Show the results. """
print '{0:14} {1}'.format('Kringle', 'Recipient')
print '=========================='
for kringle, recip in recipients.iteritems():
print '{0:14} {1}'.format(kringle, recip)
def write_this_years_file(self, recipients):
""" Write the recipients to this year's file. """
year = datetime.datetime.now().year
filename = 'kringles' + str(year) + '.json'
FileWorker().writefile(filename, recipients)