Skip to content

Commit

Permalink
Type checking fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
sebbASF committed Apr 27, 2024
1 parent f1e458c commit 4d644b1
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 0 deletions.
1 change: 1 addition & 0 deletions server/plugins/messages.py
Original file line number Diff line number Diff line change
Expand Up @@ -558,6 +558,7 @@ def construct(self):
"""Turns a flat array of emails into a nested structure of threads"""
for cur_email in sorted(self.emails, key=lambda x: x["epoch"]):
author = cur_email.get("from")
assert(author)
if author not in self.authors:
self.authors[author] = [0, cur_email.get("gravatar", "")]
self.authors[author][0] += 1
Expand Down
2 changes: 2 additions & 0 deletions tools/archiver.py
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,7 @@ def parse_attachment(
# Allow for empty string
if fd is None:
return None, None
assert(isinstance(fd, bytes)) # decode=True generates bytes
if filename:
attachment = {
"content_type": part.get_content_type(),
Expand Down Expand Up @@ -202,6 +203,7 @@ def __init__(self, part: email.message.Message):
self.bytes = part.get_payload(decode=True)
self.html_as_source = False
if self.bytes is not None:
assert(isinstance(self.bytes, bytes)) # decode=True generates bytes
valid_encodings = [x for x in self.charsets if x]
if valid_encodings:
for cs in valid_encodings:
Expand Down

0 comments on commit 4d644b1

Please sign in to comment.