Move as_dict property to its own method

This helps declutter the init method, and is one less thing to create in
memory when it’s not needed.
This commit is contained in:
Chris Hill-Scott
2019-05-07 10:36:41 +01:00
parent 9199db3400
commit 5879df5c03

View File

@@ -226,7 +226,10 @@ class Spreadsheet():
def __init__(self, csv_data, filename=''):
self.filename = filename
self.as_csv_data = csv_data
self.as_dict = {
@property
def as_dict(self):
return {
'file_name': self.filename,
'data': self.as_csv_data
}