Skip to content

Commit 742bb23

Browse files
committed
Fixed a bug in type hinting
1 parent 4f09774 commit 742bb23

File tree

3 files changed

+9
-15
lines changed

3 files changed

+9
-15
lines changed

core/changelog.py

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,9 @@
44
from typing import List
55
from collections import defaultdict
66

7-
from bot import ModmailBot
8-
97

108
class Version:
11-
def __init__(self, bot: ModmailBot, version: str, lines: str):
9+
def __init__(self, bot, version: str, lines: str):
1210
self.bot = bot
1311
self.version = version
1412
self.lines = [x for x in lines.splitlines() if x]
@@ -52,7 +50,7 @@ class ChangeLog:
5250
'kyb3r/modmail/master/CHANGELOG.md')
5351
regex = re.compile(r'# (v\d+\.\d+\.\d+)([\S\s]*?(?=# v|$))')
5452

55-
def __init__(self, bot: ModmailBot, text: str):
53+
def __init__(self, bot, text: str):
5654
self.bot = bot
5755
self.text = text
5856
self.versions = [Version(bot, *m) for m in self.regex.findall(text)]
@@ -66,7 +64,7 @@ def embeds(self) -> List[Embed]:
6664
return [v.embed for v in self.versions]
6765

6866
@classmethod
69-
async def from_repo(cls, bot: ModmailBot, url: str = ''):
67+
async def from_repo(cls, bot, url: str = ''):
7068
url = url or cls.changelog_url
7169
resp = await bot.session.get(url)
7270
return cls(bot, await resp.text())

core/clients.py

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,9 @@
88
from json import JSONDecodeError
99
from pymongo import ReturnDocument
1010

11-
from bot import ModmailBot
12-
1311

1412
class ApiClient:
15-
def __init__(self, bot: ModmailBot):
13+
def __init__(self, bot):
1614
self.bot = bot
1715
self.session = bot.session
1816
self.headers: dict = None
@@ -45,7 +43,7 @@ class Github(ApiClient):
4543
FORK_URL = REPO + '/forks'
4644
STAR_URL = BASE + '/user/starred/kyb3r/modmail'
4745

48-
def __init__(self, bot: ModmailBot,
46+
def __init__(self, bot,
4947
access_token: str = None,
5048
username: str = None):
5149
super().__init__(bot)
@@ -94,7 +92,7 @@ async def get_latest_commits(self, limit=3):
9492
...
9593

9694
@classmethod
97-
async def login(cls, bot: ModmailBot) -> 'Github':
95+
async def login(cls, bot) -> 'Github':
9896
self = cls(bot, bot.config.get('github_access_token'))
9997
resp: dict = await self.request('https://api.github.com/user')
10098
self.username: str = resp['login']
@@ -113,7 +111,7 @@ class ModmailApiClient(ApiClient):
113111
LOGS = BASE + '/logs'
114112
CONFIG = BASE + '/config'
115113

116-
def __init__(self, bot: ModmailBot):
114+
def __init__(self, bot):
117115
super().__init__(bot)
118116
self.token: Optional[str] = bot.config.get('modmail_api_token')
119117
if self.token:
@@ -213,7 +211,7 @@ def post_log(self, channel_id: Union[int, str], payload: dict):
213211

214212
class SelfHostedClient(ModmailApiClient):
215213

216-
def __init__(self, bot: ModmailBot):
214+
def __init__(self, bot):
217215
super().__init__(bot)
218216
self.token: Optional[str] = bot.config.get('github_access_token')
219217
if self.token:

core/config.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,6 @@
55

66
import box
77

8-
from bot import ModmailBot
9-
108

119
class ConfigManager:
1210
"""Class that manages a cached configuration"""
@@ -32,7 +30,7 @@ class ConfigManager:
3230

3331
valid_keys = allowed_to_change_in_command | internal_keys | protected_keys
3432

35-
def __init__(self, bot: ModmailBot):
33+
def __init__(self, bot):
3634
self.bot = bot
3735
self.cache = box.Box()
3836
self.ready_event = asyncio.Event()

0 commit comments

Comments
 (0)