Skip to content

Commit

Permalink
delinting
Browse files Browse the repository at this point in the history
  • Loading branch information
Trafire committed Jun 6, 2022
1 parent cb7f690 commit 2d9d27a
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 8 deletions.
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "promail"
version = "0.5.0"
version = "0.5.1"
authors = ["Antoine Wood <[email protected]>"]
description = "Promail: The Python Email Automation Framework"
license = "GNU"
Expand Down
2 changes: 1 addition & 1 deletion src/promail/clients/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,4 @@
except PackageNotFoundError: # pragma: no cover
__version__ = "unknown"

__all__ = ["email_manager", "gmail", "GmailClient","HotmailClient","SmtpClient"]
__all__ = ["email_manager", "gmail", "GmailClient", "HotmailClient", "SmtpClient"]
6 changes: 4 additions & 2 deletions src/promail/clients/gmail.py
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ def _process_filter_messages(self, email_filter, page_size=100, page_token=None)
.execute()
)

messages = email_filter.filter_results(results.get("messages",[]))
messages = email_filter.filter_results(results.get("messages", []))

for message in messages:
current_message = (
Expand All @@ -173,7 +173,9 @@ def _process_filter_messages(self, email_filter, page_size=100, page_token=None)

next_page = results.get("nextPageToken")
if next_page:
self._process_filter_messages(email_filter, page_size=100, page_token=next_page)
self._process_filter_messages(
email_filter, page_size=100, page_token=next_page
)

# gmail specific functionality
def mailboxes(self):
Expand Down
13 changes: 9 additions & 4 deletions src/promail/core/messages/messages.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,11 @@ def __init__(self, msg: dict) -> None:
@property
def html_body(self) -> str:
"""Get HTML Body of email."""
return str(self.msg.get_body(preferencelist=('related', 'html', 'plain'))) # type: ignore
return str(
self.msg.get_body( # type: ignore
preferencelist=("related", "html", "plain")
)
)

@property
def plain_text(self):
Expand Down Expand Up @@ -78,9 +82,10 @@ def attachments(self):
] = Attachments(email_message_attachment)
return self._attachments

def data(self):
def data(self) -> dict:
"""Get all Email fields."""
return {
"attachments":self.attachments,
"attachments": self.attachments,
"date": self.date,
"subject": self.subject,
"to": self.to,
Expand All @@ -93,4 +98,4 @@ def data(self):

def __str__(self) -> str:
"""String representation."""
return self.subject or ''
return self.subject or ""

0 comments on commit 2d9d27a

Please sign in to comment.