Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion csv2txf.py
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ def main(argv):
year = int(options.year)
else:
year = datetime.today().year - 1
utils.Warning(f'Year not specified, defaulting to {year} (last year)')
utils.warn(f'Year not specified, defaulting to {year} (last year)')

output = None
if options.out_format == 'summary':
Expand Down
12 changes: 6 additions & 6 deletions interactive_brokers.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,16 +98,16 @@ def parseFileToTxnList(cls, filename: str, tax_year: Optional[int]) -> list[util
elif row[1] == 'II':
part = 2
else:
utils.Warning('unknown part line: "%s"' % row)
utils.warn('unknown part line: "%s"' % row)
elif row[0] == 'Box' and len(row) == 3:
if row[1] == 'A' or row[1] == 'B' or row[1] == 'C':
box = row[1]
entry_code = cls.DetermineEntryCode(part, box)
else:
utils.Warning('unknown box line: "%s"' % row)
utils.warn('unknown box line: "%s"' % row)
elif row[0] == 'Data' and len(row) == 9:
if not entry_code:
utils.Warning('ignoring data: "%s" as the code is not defined')
utils.warn('ignoring data: "%s" as the code is not defined')
continue
txn = utils.Transaction()
txn.desc = row[1]
Expand All @@ -120,12 +120,12 @@ def parseFileToTxnList(cls, filename: str, tax_year: Optional[int]) -> list[util
txn.adjustment = cls.ParseDollarValue(row[7])
txn.entryCode = entry_code
if tax_year and year and year != tax_year:
utils.Warning('ignoring txn: "%s" as the sale is not from %d' %
(txn.desc, tax_year))
utils.warn('ignoring txn: "%s" as the sale is not from %d' %
(txn.desc, tax_year))
else:
txn_list.append(txn)
txn = None
elif (row[0] != 'Header' and row[0] != 'Footer') or len(row) != 9:
utils.Warning('unknown line: "%s"' % row)
utils.warn('unknown line: "%s"' % row)

return txn_list
4 changes: 2 additions & 2 deletions tdameritrade.py
Original file line number Diff line number Diff line change
Expand Up @@ -139,8 +139,8 @@ def parseFileToTxnList(cls, filename: str, tax_year: Optional[int]) -> list[util
curr_txn.entryCode = 323 # "LT gain/loss - security"

if tax_year and sellDate.year != tax_year:
utils.Warning('ignoring txn: "%s" (line %d) as the sale is not from %d' %
(curr_txn.desc, line_num, tax_year))
utils.warn('ignoring txn: "%s" (line %d) as the sale is not from %d' %
(curr_txn.desc, line_num, tax_year))
continue

txn_list.append(curr_txn)
Expand Down
2 changes: 1 addition & 1 deletion utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ def __str__(self) -> str:
return self.msg


def Warning(msg: str):
def warn(msg: str) -> None:
sys.stderr.write('warning: %s\n' % msg)


Expand Down
6 changes: 3 additions & 3 deletions vanguard.py
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ def parseFileToTxnList(cls, filename: str, tax_year: Optional[int]) -> list[util

buyDate: Optional[datetime] = curr_txn.buyDate
if buyDate is None:
utils.Warning(f'Missing buy date for current transaction: {curr_txn}')
utils.warn(f'Missing buy date for current transaction: {curr_txn}')
continue

sellDate: datetime = cls.date(sell)
Expand All @@ -144,8 +144,8 @@ def parseFileToTxnList(cls, filename: str, tax_year: Optional[int]) -> list[util

assert sellDate >= buyDate, f'Sell date ({sellDate}) must be on or after buy date ({buyDate})'
if tax_year and sellDate.year != tax_year:
utils.Warning('ignoring txn: "%s" as the sale is not from %d' %
(curr_txn.desc, tax_year))
utils.warn('ignoring txn: "%s" as the sale is not from %d' %
(curr_txn.desc, tax_year))
continue

txn_list.append(curr_txn)
Expand Down
Loading