mirror of
https://github.com/Cog-Creators/Red-DiscordBot.git
synced 2025-11-07 03:38:53 -05:00
[V3] Use typing.TYPE_CHECKING instead of utils.TYPE_CHECKING (#1778)
Not needed any more as we no longer support python<3.6
This commit is contained in:
parent
8610b47a68
commit
19b05e632c
@ -3,9 +3,8 @@ import distutils.dir_util
|
|||||||
import shutil
|
import shutil
|
||||||
from enum import Enum
|
from enum import Enum
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
from typing import MutableMapping, Any
|
from typing import MutableMapping, Any, TYPE_CHECKING
|
||||||
|
|
||||||
from redbot.core.utils import TYPE_CHECKING
|
|
||||||
from .log import log
|
from .log import log
|
||||||
from .json_mixins import RepoJSONMixin
|
from .json_mixins import RepoJSONMixin
|
||||||
|
|
||||||
@ -25,7 +24,7 @@ class Installable(RepoJSONMixin):
|
|||||||
- Modules
|
- Modules
|
||||||
- Repo Libraries
|
- Repo Libraries
|
||||||
- Other stuff?
|
- Other stuff?
|
||||||
|
|
||||||
The attributes of this class will mostly come from the installation's
|
The attributes of this class will mostly come from the installation's
|
||||||
info.json.
|
info.json.
|
||||||
|
|
||||||
|
|||||||
@ -1,15 +1,13 @@
|
|||||||
import logging
|
import logging
|
||||||
import collections
|
import collections
|
||||||
from copy import deepcopy
|
from copy import deepcopy
|
||||||
from typing import Union, Tuple
|
from typing import Union, Tuple, TYPE_CHECKING
|
||||||
|
|
||||||
import discord
|
import discord
|
||||||
|
|
||||||
from .data_manager import cog_data_path, core_data_path
|
from .data_manager import cog_data_path, core_data_path
|
||||||
from .drivers import get_driver
|
from .drivers import get_driver
|
||||||
|
|
||||||
from .utils import TYPE_CHECKING
|
|
||||||
|
|
||||||
if TYPE_CHECKING:
|
if TYPE_CHECKING:
|
||||||
from .drivers.red_base import BaseDriver
|
from .drivers.red_base import BaseDriver
|
||||||
|
|
||||||
|
|||||||
@ -13,6 +13,7 @@ from pathlib import Path
|
|||||||
from random import SystemRandom
|
from random import SystemRandom
|
||||||
from string import ascii_letters, digits
|
from string import ascii_letters, digits
|
||||||
from distutils.version import StrictVersion
|
from distutils.version import StrictVersion
|
||||||
|
from typing import TYPE_CHECKING
|
||||||
|
|
||||||
import aiohttp
|
import aiohttp
|
||||||
import discord
|
import discord
|
||||||
@ -21,9 +22,7 @@ import pkg_resources
|
|||||||
from redbot.core import __version__
|
from redbot.core import __version__
|
||||||
from redbot.core import checks
|
from redbot.core import checks
|
||||||
from redbot.core import i18n
|
from redbot.core import i18n
|
||||||
from redbot.core import rpc
|
|
||||||
from redbot.core import commands
|
from redbot.core import commands
|
||||||
from .utils import TYPE_CHECKING
|
|
||||||
from .utils.chat_formatting import pagify, box, inline
|
from .utils.chat_formatting import pagify, box, inline
|
||||||
|
|
||||||
if TYPE_CHECKING:
|
if TYPE_CHECKING:
|
||||||
|
|||||||
@ -9,10 +9,6 @@ import logging
|
|||||||
import appdirs
|
import appdirs
|
||||||
|
|
||||||
from .json_io import JsonIO
|
from .json_io import JsonIO
|
||||||
from .utils import TYPE_CHECKING
|
|
||||||
|
|
||||||
if TYPE_CHECKING:
|
|
||||||
from . import Config
|
|
||||||
|
|
||||||
__all__ = [
|
__all__ = [
|
||||||
"load_basic_configuration",
|
"load_basic_configuration",
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
__all__ = ["TYPE_CHECKING", "NewType", "safe_delete", "fuzzy_command_search"]
|
__all__ = ["safe_delete", "fuzzy_command_search"]
|
||||||
|
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
import os
|
import os
|
||||||
@ -7,18 +7,6 @@ from redbot.core import commands
|
|||||||
from fuzzywuzzy import process
|
from fuzzywuzzy import process
|
||||||
from .chat_formatting import box
|
from .chat_formatting import box
|
||||||
|
|
||||||
try:
|
|
||||||
from typing import TYPE_CHECKING
|
|
||||||
except ImportError:
|
|
||||||
TYPE_CHECKING = False
|
|
||||||
|
|
||||||
try:
|
|
||||||
from typing import NewType
|
|
||||||
except ImportError:
|
|
||||||
|
|
||||||
def NewType(name, tp):
|
|
||||||
return type(name, (tp,), {})
|
|
||||||
|
|
||||||
|
|
||||||
def safe_delete(pth: Path):
|
def safe_delete(pth: Path):
|
||||||
if pth.exists():
|
if pth.exists():
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user