refactor: вынесен monkey-patch asyncio.iscoroutinefunction в utils/compat.py
This commit is contained in:
parent
88ed1a6aa1
commit
3a2c388adf
3
bot.py
3
bot.py
@ -1,5 +1,4 @@
|
||||
import asyncio
|
||||
import inspect
|
||||
import logging
|
||||
import os
|
||||
import sys
|
||||
@ -9,7 +8,7 @@ from typing import TYPE_CHECKING
|
||||
|
||||
# Python 3.14+: asyncio.iscoroutinefunction deprecated, removed in 3.16
|
||||
# discord.py 2.7.1 ещё не обновлена — применяем monkey-patch до импорта
|
||||
asyncio.iscoroutinefunction = inspect.iscoroutinefunction # type: ignore[assignment]
|
||||
from utils import compat # noqa: F401
|
||||
|
||||
import discord # noqa: E402
|
||||
from discord.ext import commands # noqa: E402
|
||||
|
||||
@ -1,8 +1,5 @@
|
||||
"""Pytest configuration — применяется до импорта тестов."""
|
||||
|
||||
import asyncio
|
||||
import inspect
|
||||
|
||||
# Python 3.14+: asyncio.iscoroutinefunction deprecated, removed in 3.16
|
||||
# discord.py 2.7.1 ещё не обновлена — применяем monkey-patch до импорта
|
||||
asyncio.iscoroutinefunction = inspect.iscoroutinefunction # type: ignore[assignment]
|
||||
from utils import compat # noqa: F401
|
||||
|
||||
7
utils/compat.py
Normal file
7
utils/compat.py
Normal file
@ -0,0 +1,7 @@
|
||||
"""Совместимость с Python 3.14+."""
|
||||
|
||||
import asyncio
|
||||
import inspect
|
||||
|
||||
# Python 3.14+: asyncio.iscoroutinefunction deprecated, removed in 3.16
|
||||
asyncio.iscoroutinefunction = inspect.iscoroutinefunction # type: ignore[assignment]
|
||||
Loading…
x
Reference in New Issue
Block a user