Skip to content

Commit

Permalink
Fix mypy tests.
Browse files Browse the repository at this point in the history
  • Loading branch information
elongl committed Jul 21, 2024
1 parent a044ce4 commit 445dc34
Showing 1 changed file with 18 additions and 8 deletions.
26 changes: 18 additions & 8 deletions elementary/clients/slack/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,10 @@ def send_message(self, **kwargs):

@abstractmethod
def send_file(
self, channel_name: str, file_path: str, message: SlackMessageSchema
self,
channel_name: str,
file_path: str,
message: Optional[SlackMessageSchema] = None,
) -> bool:
raise NotImplementedError

Expand Down Expand Up @@ -90,9 +93,9 @@ def send_message(
channel=channel_name,
text=message.text,
blocks=json.dumps(message.blocks) if message.blocks else None,
attachments=json.dumps(message.attachments)
if message.attachments
else None,
attachments=(
json.dumps(message.attachments) if message.attachments else None
),
)
return True
except SlackApiError as err:
Expand Down Expand Up @@ -126,8 +129,10 @@ def send_file(

@sleep_and_retry
@limits(calls=1, period=ONE_SECOND)
def send_report(self, channel: str, report_file_path: str):
send_succeed = self.send_file(channel_name=channel, file_path=report_file_path)
def send_report(self, channel_name: str, report_file_path: str):
send_succeed = self.send_file(
channel_name=channel_name, file_path=report_file_path
)
if send_succeed:
logger.info("Sent report to Slack.")
else:
Expand Down Expand Up @@ -240,10 +245,15 @@ def send_message(self, message: SlackMessageSchema, **kwargs) -> bool:
)
return False

def send_file(self, **kwargs):
def send_file(
self,
channel_name: str,
file_path: str,
message: Optional[SlackMessageSchema] = None,
) -> bool:
raise NotImplementedError

def send_report(self, **kwargs):
def send_report(self, channel_name: str, report_file_path: str):
raise NotImplementedError

def get_user_id_from_email(self, email: str) -> Optional[str]:
Expand Down

0 comments on commit 445dc34

Please sign in to comment.