Skip to content

Commit cbb3fa0

Browse files
authored
Ensure proper type checking imports (#226)
1 parent ac59f75 commit cbb3fa0

File tree

5 files changed

+20
-8
lines changed

5 files changed

+20
-8
lines changed

bot/cogs/admin.py

+8-3
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,21 @@
1+
from __future__ import annotations
2+
13
import asyncio
24
import importlib
35
import os
46
import re
57
import subprocess # nosec # We already know this is dangerous, but it's needed
68
import sys
7-
from typing import Literal, Optional
9+
from typing import TYPE_CHECKING, Literal, Optional
810

911
import discord
1012
from discord.ext import commands
1113
from discord.ext.commands import Greedy
12-
from libs.utils import RoboContext
13-
from rodhaj import Rodhaj
14+
15+
if TYPE_CHECKING:
16+
from libs.utils import RoboContext
17+
18+
from bot.rodhaj import Rodhaj
1419

1520
GIT_PULL_REGEX = re.compile(r"\s+(?P<filename>.*)\b\s+\|\s+[\d]")
1621

bot/cogs/config.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@
2424
from discord import app_commands
2525
from discord.ext import commands, menus
2626
from libs.tickets.utils import get_cached_thread
27-
from libs.utils import GuildContext
2827
from libs.utils.checks import (
2928
bot_check_permissions,
3029
check_permissions,
@@ -38,6 +37,7 @@
3837
from libs.utils.time import FriendlyTimeResult, UserFriendlyTime
3938

4039
if TYPE_CHECKING:
40+
from libs.utils import GuildContext
4141
from rodhaj import Rodhaj
4242

4343
from cogs.tickets import Tickets

bot/cogs/utilities.py

+9-2
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,23 @@
1+
from __future__ import annotations
2+
13
import datetime
24
import itertools
35
import platform
46
from time import perf_counter
7+
from typing import TYPE_CHECKING
58

69
import discord
710
import psutil
811
import pygit2
912
from discord.ext import commands
1013
from discord.utils import format_dt
11-
from libs.utils import Embed, RoboContext, human_timedelta, is_docker
14+
from libs.utils import Embed, human_timedelta, is_docker
1215
from pygit2.enums import SortMode
13-
from rodhaj import Rodhaj
16+
17+
if TYPE_CHECKING:
18+
from libs.utils import RoboContext
19+
20+
from bot.rodhaj import Rodhaj
1421

1522

1623
# A cog houses a category of commands

bot/libs/utils/reloader.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
from watchfiles import Change, awatch
1212

1313
if TYPE_CHECKING:
14-
from rodhaj import Rodhaj
14+
from bot.rodhaj import Rodhaj
1515

1616

1717
class Reloader:

bot/libs/utils/tree.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
from .embeds import FullErrorEmbed
99

1010
if TYPE_CHECKING:
11-
from rodhaj import Rodhaj
11+
from bot.rodhaj import Rodhaj
1212

1313

1414
# Later on if we needed global interaction checks, we can do it here

0 commit comments

Comments
 (0)