mirror of
https://github.com/Cog-Creators/Red-DiscordBot.git
synced 2025-11-06 11:18:54 -05:00
[V3] Actually add compatibility with 3.5.1 (#1155)
* Fix 3.5.1 issue with TYPE_CHECKING * I hate you * Smarter...
This commit is contained in:
parent
02d7193a92
commit
6d1d699059
@ -4,10 +4,6 @@ import discord
|
|||||||
|
|
||||||
# Let's do all the dumb version checking in one place.
|
# Let's do all the dumb version checking in one place.
|
||||||
|
|
||||||
|
|
||||||
if sys.version_info < (3, 5, 2):
|
|
||||||
typing.TYPE_CHECKING = False
|
|
||||||
|
|
||||||
if discord.version_info.major < 1:
|
if discord.version_info.major < 1:
|
||||||
print("You are not running the rewritten version of discord.py.\n\n"
|
print("You are not running the rewritten version of discord.py.\n\n"
|
||||||
"In order to use Red v3 you MUST be running d.py version"
|
"In order to use Red v3 you MUST be running d.py version"
|
||||||
|
|||||||
@ -18,7 +18,7 @@ from . import (
|
|||||||
)
|
)
|
||||||
from .help_formatter import Help, help as help_
|
from .help_formatter import Help, help as help_
|
||||||
|
|
||||||
from typing import TYPE_CHECKING
|
from .utils import TYPE_CHECKING
|
||||||
|
|
||||||
if TYPE_CHECKING:
|
if TYPE_CHECKING:
|
||||||
from aiohttp_json_rpc import JsonRpc
|
from aiohttp_json_rpc import JsonRpc
|
||||||
|
|||||||
@ -18,9 +18,8 @@ from redbot.core import rpc
|
|||||||
from redbot.core import __version__
|
from redbot.core import __version__
|
||||||
from redbot.core.context import RedContext
|
from redbot.core.context import RedContext
|
||||||
|
|
||||||
from typing import TYPE_CHECKING
|
from .utils import TYPE_CHECKING
|
||||||
|
from .utils.chat_formatting import pagify, box
|
||||||
from redbot.core.utils.chat_formatting import pagify, box
|
|
||||||
|
|
||||||
if TYPE_CHECKING:
|
if TYPE_CHECKING:
|
||||||
from redbot.core.bot import Red
|
from redbot.core.bot import Red
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
import sys
|
import sys
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
from typing import TYPE_CHECKING, List
|
from typing import List
|
||||||
import hashlib
|
import hashlib
|
||||||
import shutil
|
import shutil
|
||||||
import logging
|
import logging
|
||||||
@ -8,6 +8,7 @@ import logging
|
|||||||
import appdirs
|
import appdirs
|
||||||
|
|
||||||
from .json_io import JsonIO
|
from .json_io import JsonIO
|
||||||
|
from .utils import TYPE_CHECKING
|
||||||
|
|
||||||
if TYPE_CHECKING:
|
if TYPE_CHECKING:
|
||||||
from . import Config
|
from . import Config
|
||||||
|
|||||||
@ -1,5 +1,3 @@
|
|||||||
from typing import NewType, TYPE_CHECKING
|
|
||||||
|
|
||||||
import asyncio
|
import asyncio
|
||||||
|
|
||||||
from aiohttp.web import Application
|
from aiohttp.web import Application
|
||||||
@ -7,6 +5,8 @@ from aiohttp_json_rpc import JsonRpc
|
|||||||
|
|
||||||
import logging
|
import logging
|
||||||
|
|
||||||
|
from .utils import TYPE_CHECKING, NewType
|
||||||
|
|
||||||
if TYPE_CHECKING:
|
if TYPE_CHECKING:
|
||||||
from .bot import Red
|
from .bot import Red
|
||||||
|
|
||||||
|
|||||||
@ -0,0 +1,12 @@
|
|||||||
|
__all__ = ['TYPE_CHECKING', 'NewType']
|
||||||
|
|
||||||
|
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,), {})
|
||||||
Loading…
x
Reference in New Issue
Block a user