mirror of
https://github.com/aiogram/aiogram.git
synced 2026-04-08 16:37:47 +00:00
Enable Python 3.10 for tests (#719)
* Try to test on Python 3.10 * Prevent to YAML type cast * Bump poetry * Removed async_lru * Disable fail-fast on tests * Fixed typing * Added patch-notes
This commit is contained in:
parent
99c99cec78
commit
7405db2ad3
11 changed files with 36 additions and 81 deletions
|
|
@ -17,7 +17,6 @@ from typing import (
|
|||
)
|
||||
|
||||
import aiofiles
|
||||
from async_lru import alru_cache
|
||||
|
||||
from aiogram.utils.mixins import ContextInstanceMixin
|
||||
from aiogram.utils.token import extract_bot_id, validate_token
|
||||
|
|
@ -178,6 +177,7 @@ class Bot(ContextInstanceMixin["Bot"]):
|
|||
self.session = session
|
||||
self.parse_mode = parse_mode
|
||||
self.__token = token
|
||||
self._me: Optional[User] = None
|
||||
|
||||
@property
|
||||
def token(self) -> str:
|
||||
|
|
@ -208,9 +208,10 @@ class Bot(ContextInstanceMixin["Bot"]):
|
|||
await self.session.close()
|
||||
self.reset_current(token)
|
||||
|
||||
@alru_cache() # type: ignore
|
||||
async def me(self) -> User:
|
||||
return await self.get_me()
|
||||
if self._me is None: # pragma: no cover
|
||||
self._me = await self.get_me()
|
||||
return self._me
|
||||
|
||||
@classmethod
|
||||
async def __download_file_binary_io(
|
||||
|
|
|
|||
|
|
@ -65,7 +65,9 @@ async def create_start_link(bot: Bot, payload: str, encode: bool = False) -> str
|
|||
:return: link
|
||||
"""
|
||||
username = (await bot.me()).username
|
||||
return create_deep_link(username=username, link_type="start", payload=payload, encode=encode)
|
||||
return create_deep_link(
|
||||
username=cast(str, username), link_type="start", payload=payload, encode=encode
|
||||
)
|
||||
|
||||
|
||||
async def create_startgroup_link(bot: Bot, payload: str, encode: bool = False) -> str:
|
||||
|
|
@ -82,7 +84,7 @@ async def create_startgroup_link(bot: Bot, payload: str, encode: bool = False) -
|
|||
"""
|
||||
username = (await bot.me()).username
|
||||
return create_deep_link(
|
||||
username=username, link_type="startgroup", payload=payload, encode=encode
|
||||
username=cast(str, username), link_type="startgroup", payload=payload, encode=encode
|
||||
)
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue