Skip to content

Commit

Permalink
fix: Fix some linter errors (#193)
Browse files Browse the repository at this point in the history
  • Loading branch information
juissi-t authored Mar 13, 2023
1 parent 1bcebbb commit 9858ea0
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 12 deletions.
8 changes: 3 additions & 5 deletions in_game_messages/discord_messaging.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ async def send_discord_message(
self,
channel: discord.TextChannel,
msg: Dict,
parent: Dict = None,
parent: Optional[Dict] = None,
parent_msg: Optional[discord.Message] = None,
parent_thread: Optional[discord.Thread] = None,
) -> Tuple[discord.Message, Optional[discord.Thread]]:
Expand All @@ -63,9 +63,7 @@ async def send_discord_message(
parent_msg.id,
)

thread_name = (
f'Turn {parent["turn"]} - {parent["sender"]["name"]}' # type: ignore # noqa
)
thread_name = f'Turn {parent["turn"]} - {parent["sender"]["name"]}' # type: ignore # noqa
parent_message = await channel.fetch_message(parent_msg.id)
parent_thread = await parent_message.create_thread(name=thread_name)
if self.discord_user_ids:
Expand All @@ -81,7 +79,7 @@ async def send_discord_message(
raise

async def send_new_messages_to_discord(
self, messages: List, planets_game_id: str, mbox_path: Path = None
self, messages: List, planets_game_id: str, mbox_path: Optional[Path] = None
) -> None:
"""Fetch messages from a game and send new ones to Discord."""
if not mbox_path:
Expand Down
4 changes: 2 additions & 2 deletions in_game_messages/mbox.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import logging
import mailbox
from pathlib import Path
from typing import Dict
from typing import Dict, Optional


class Mbox:
Expand All @@ -31,7 +31,7 @@ def get_message_ids(self) -> Dict:
def save_email_message(
self,
message: Dict,
thread_id: str = None,
thread_id: Optional[str] = None,
) -> bool:
"""Construct an e-mail from an in-game message and save it to a mailbox."""
try:
Expand Down
4 changes: 2 additions & 2 deletions in_game_messages/messaging.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
import re
import struct
from datetime import datetime, timedelta, timezone
from typing import Dict, List
from typing import Dict, List, Optional

import requests

Expand Down Expand Up @@ -132,7 +132,7 @@ def get_message_participants(self, message: Dict) -> Dict:

@staticmethod
def construct_outlook_thread_index(
message: Dict, parent_thread_index: str = None
message: Dict, parent_thread_index: Optional[str] = None
) -> str:
"""Construct a thread index to allow threading in Outlook."""
thread_index = ""
Expand Down
6 changes: 3 additions & 3 deletions in_game_messages/slack_messaging.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import re
import time
from pathlib import Path
from typing import Dict, List
from typing import Dict, List, Optional

from slack_sdk import WebClient
from slack_sdk.errors import SlackApiError
Expand All @@ -29,7 +29,7 @@ def __init__(
self.logger = logging.getLogger(__name__)

def send_slack_message(
self, text: str, sender: Dict, parent: str = None
self, text: str, sender: Dict, parent: Optional[str] = None
) -> SlackResponse:
"""Send Slack message to the configured channel."""
try:
Expand Down Expand Up @@ -70,7 +70,7 @@ def send_slack_message(
raise

def send_new_messages_to_slack(
self, messages: List, planets_game_id: str, mbox_path: Path = None
self, messages: List, planets_game_id: str, mbox_path: Optional[Path] = None
) -> None:
"""Fetch messages from a game and send new ones to Slack."""
if not mbox_path:
Expand Down
2 changes: 2 additions & 0 deletions in_game_messages/version.py
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
"""In-game-messages version number."""

__version__ = "0.3.3"

0 comments on commit 9858ea0

Please sign in to comment.