Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def begin(self, account_info):
print( dumps(account_info, sort_keys=True), file=self.output)
def write_record(self, transaction):
print( dumps(transaction, sort_keys=True), file=self.output)
class CsvTransactionWriter(TransactionWriter):
def begin(self, account_info):
print('Date,Amount,Description', file=self.output)
def write_record(self, transaction):
print(transaction['date'],transaction['amount'],transaction['name'], file=self.output)
class QifTransactionWriter(TransactionWriter):
def begin(self, account):
print('!Account', file=self.output)
print('N%s' % account['name'], file=self.output)
print('T%s' % account['type'], file=self.output)
if 'description' in account:
print('D%s' % account['description'], file=self.output)
print('^', file=self.output)
print('!Type:%s' % account['type'], file=self.output)
def write_record(self, transaction):
print('C', file=self.output) # cleared status: Values are blank (not cleared), "*" or "c" (cleared) and "X" or "R" (reconciled).
print('D%s' % self.format_date(transaction['date']), file=self.output)
print('N%s' % self.format_chknum(transaction), file=self.output)
print('P%s' % transaction['name'], file=self.output)
print('T%s' % self.format_amount(transaction['amount']), file=self.output)
def write_record(self, transaction):
pass
def end(self):
pass
class JsonTransactionWriter(TransactionWriter):
def begin(self, account_info):
print( dumps(account_info, sort_keys=True), file=self.output)
def write_record(self, transaction):
print( dumps(transaction, sort_keys=True), file=self.output)
class CsvTransactionWriter(TransactionWriter):
def begin(self, account_info):
print('Date,Amount,Description', file=self.output)
def write_record(self, transaction):
print(transaction['date'],transaction['amount'],transaction['name'], file=self.output)
class QifTransactionWriter(TransactionWriter):
def begin(self, account):
print('!Account', file=self.output)
print('N%s' % account['name'], file=self.output)
print('T%s' % account['type'], file=self.output)
if 'description' in account:
print('D%s' % account['description'], file=self.output)
print('^', file=self.output)
print('!Type:%s' % account['type'], file=self.output)
if t == 'raw':
return JsonTransactionWriter(output)
instance = staticmethod(instance)
def begin(self, account_info):
pass
def write_record(self, transaction):
pass
def end(self):
pass
class JsonTransactionWriter(TransactionWriter):
def begin(self, account_info):
print( dumps(account_info, sort_keys=True), file=self.output)
def write_record(self, transaction):
print( dumps(transaction, sort_keys=True), file=self.output)
class CsvTransactionWriter(TransactionWriter):
def begin(self, account_info):
print('Date,Amount,Description', file=self.output)
def write_record(self, transaction):
print(transaction['date'],transaction['amount'],transaction['name'], file=self.output)
class QifTransactionWriter(TransactionWriter):