Skip to content

Commit 6a40a7b

Browse files
Apply suggestions from code review
Co-authored-by: Christoph Langer <[email protected]>
1 parent 5085b62 commit 6a40a7b

File tree

3 files changed

+3
-3
lines changed

3 files changed

+3
-3
lines changed

pytr/main.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -194,7 +194,7 @@ def formatter(prog):
194194
"output",
195195
help="Output file path",
196196
metavar="OUTPUT",
197-
type=argparse.FileType("w"),
197+
type=argparse.FileType("w", encoding="utf8"),
198198
default="-",
199199
nargs="?",
200200
)

pytr/timeline.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -200,7 +200,7 @@ def finish_timeline_details(self, dl):
200200
indent=2,
201201
)
202202

203-
with (dl.output_path / "account_transactions.csv").open("w") as f:
203+
with (dl.output_path / "account_transactions.csv").open("w", encoding="utf8") as f:
204204
TransactionExporter().export(
205205
f,
206206
[Event.from_dict(ev) for ev in self.events_without_docs + self.events_with_docs],

pytr/transactions.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ def from_event(self, event: Event) -> Iterable[dict[str, Any]]:
129129
"isin": event.isin,
130130
"shares": self._decimal_format(event.shares, False),
131131
"fees": self._decimal_format(-event.fees) if event.fees is not None else None,
132-
"taxes": self._decimal_format(-event.taxes),
132+
"taxes": self._decimal_format(-event.taxes) if event.taxes is not None else None,
133133
}
134134

135135
# Special case for saveback events. Example payload: https://github.com/pytr-org/pytr/issues/116#issuecomment-2377491990

0 commit comments

Comments
 (0)