mirror of
https://github.com/TheFunny/TelegramTwitterMediaBot.git
synced 2026-09-23 23:32:05 +00:00
fix annotations
This commit is contained in:
@@ -1,3 +1,5 @@
|
|||||||
|
from __future__ import annotations
|
||||||
|
|
||||||
import html
|
import html
|
||||||
from functools import wraps
|
from functools import wraps
|
||||||
from typing import TYPE_CHECKING
|
from typing import TYPE_CHECKING
|
||||||
@@ -8,7 +10,7 @@ from telegram.ext import (ApplicationBuilder, CallbackQueryHandler, CommandHandl
|
|||||||
InlineQueryHandler, MessageHandler, PicklePersistence, filters)
|
InlineQueryHandler, MessageHandler, PicklePersistence, filters)
|
||||||
|
|
||||||
import common
|
import common
|
||||||
from tweet import TGTweet
|
from tweet import TelegramTweet
|
||||||
|
|
||||||
if TYPE_CHECKING:
|
if TYPE_CHECKING:
|
||||||
from telegram import Chat, Message, Update
|
from telegram import Chat, Message, Update
|
||||||
|
|||||||
@@ -1,5 +1,9 @@
|
|||||||
|
from __future__ import annotations
|
||||||
|
|
||||||
import html
|
import html
|
||||||
from typing import Generator
|
from functools import cached_property
|
||||||
|
from typing import TYPE_CHECKING
|
||||||
|
from uuid import uuid4
|
||||||
|
|
||||||
from httpx import AsyncClient
|
from httpx import AsyncClient
|
||||||
from telegram import (InlineQueryResultMpeg4Gif, InlineQueryResultPhoto, InlineQueryResultVideo, InputMediaPhoto,
|
from telegram import (InlineQueryResultMpeg4Gif, InlineQueryResultPhoto, InlineQueryResultVideo, InputMediaPhoto,
|
||||||
@@ -7,6 +11,9 @@ from telegram import (InlineQueryResultMpeg4Gif, InlineQueryResultPhoto, InlineQ
|
|||||||
|
|
||||||
from common import get_logger, x_media_regex, x_tco_regex, x_url_regex
|
from common import get_logger, x_media_regex, x_tco_regex, x_url_regex
|
||||||
|
|
||||||
|
if TYPE_CHECKING:
|
||||||
|
from typing import Generator, TypedDict
|
||||||
|
|
||||||
logger = get_logger(__name__)
|
logger = get_logger(__name__)
|
||||||
|
|
||||||
|
|
||||||
@@ -18,15 +25,15 @@ message_raw_text = """{url}
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
|
|
||||||
def create_client() -> 'AsyncClient':
|
def create_client() -> AsyncClient:
|
||||||
return AsyncClient(http2=True)
|
return AsyncClient(http2=True)
|
||||||
|
|
||||||
|
|
||||||
async def close_client(_client: 'AsyncClient') -> None:
|
async def close_client(_client: AsyncClient) -> None:
|
||||||
await _client.aclose()
|
await _client.aclose()
|
||||||
|
|
||||||
|
|
||||||
async def fetch_json(_client: 'AsyncClient', url: str) -> dict:
|
async def fetch_json(_client: AsyncClient, url: str) -> dict:
|
||||||
logger.info(f"Fetching {url}")
|
logger.info(f"Fetching {url}")
|
||||||
response = await _client.get(url)
|
response = await _client.get(url)
|
||||||
assert response.status_code == response.is_success, f"Failed to fetch {url}, status code {response.status_code}"
|
assert response.status_code == response.is_success, f"Failed to fetch {url}, status code {response.status_code}"
|
||||||
|
|||||||
Reference in New Issue
Block a user