Skip to content

Commit

Permalink
RM unused excel helper functions
Browse files Browse the repository at this point in the history
  • Loading branch information
provinzio committed May 14, 2022
1 parent 3dba427 commit b03af45
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 20 deletions.
19 changes: 0 additions & 19 deletions src/misc.py
Original file line number Diff line number Diff line change
Expand Up @@ -346,22 +346,3 @@ def not_none(v: Optional[T]) -> T:
if v is None:
raise ValueError()
return v


def column_num_to_string(n: int) -> str:
# References: https://stackoverflow.com/a/63013258/8979290
n, rem = divmod(n - 1, 26)
char = chr(65 + rem)
if n:
return column_num_to_string(n) + char
else:
return char


def column_string_to_num(s: str) -> int:
# References: https://stackoverflow.com/a/63013258/8979290
n = ord(s[-1]) - 64
if s[:-1]:
return 26 * (column_string_to_num(s[:-1])) + n
else:
return n
2 changes: 1 addition & 1 deletion src/taxman.py
Original file line number Diff line number Diff line change
Expand Up @@ -931,7 +931,7 @@ def get_format(field: dataclasses.Field) -> Optional[xlsxwriter.format.Format]:
ws.write_row(0, 0, labels, header_format)
# Set height
ws.set_row(0, 45)
ws.autofilter(f"A1:{misc.column_num_to_string(len(labels))}1")
ws.autofilter(0, 0, 0, len(labels) - 1)

# Data
for row, entry in enumerate(tax_report_entries, 1):
Expand Down

0 comments on commit b03af45

Please sign in to comment.