mirror of
https://github.com/aiogram/aiogram.git
synced 2026-04-08 16:37:47 +00:00
Migrate from Black to Ruff (#1750)
* Migrate from Black to Ruff and reformat code with enabling additional linter checks * Add changelog for migration to Ruff as formatter and linter * Add type ignores for specific attributes and replace tuple with set for chat type check * Remove file from another changes
This commit is contained in:
parent
a4a3f42c71
commit
ec7da0f678
214 changed files with 886 additions and 964 deletions
|
|
@ -1,12 +1,8 @@
|
|||
import asyncio
|
||||
from collections.abc import AsyncGenerator, AsyncIterable
|
||||
from typing import (
|
||||
Any,
|
||||
AsyncContextManager,
|
||||
AsyncGenerator,
|
||||
AsyncIterable,
|
||||
Dict,
|
||||
List,
|
||||
Union,
|
||||
)
|
||||
from unittest.mock import AsyncMock, patch
|
||||
|
||||
|
|
@ -115,10 +111,10 @@ class TestAiohttpSession:
|
|||
str_: str
|
||||
int_: int
|
||||
bool_: bool
|
||||
unset_: Union[str, Default] = Default("parse_mode")
|
||||
unset_: str | Default = Default("parse_mode")
|
||||
null_: None
|
||||
list_: List[str]
|
||||
dict_: Dict[str, Any]
|
||||
list_: list[str]
|
||||
dict_: dict[str, Any]
|
||||
|
||||
session = AiohttpSession()
|
||||
form = session.build_form_data(
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
import datetime
|
||||
import json
|
||||
from typing import Any, AsyncContextManager, AsyncGenerator, Dict, Optional
|
||||
from collections.abc import AsyncGenerator
|
||||
from typing import Any, AsyncContextManager
|
||||
from unittest.mock import AsyncMock, patch
|
||||
|
||||
import pytest
|
||||
|
|
@ -39,7 +40,7 @@ class CustomSession(BaseSession):
|
|||
self,
|
||||
token: str,
|
||||
method: TelegramMethod[TelegramType],
|
||||
timeout: Optional[int] = UNSET_PARSE_MODE,
|
||||
timeout: int | None = UNSET_PARSE_MODE,
|
||||
) -> None: # type: ignore
|
||||
assert isinstance(token, str)
|
||||
assert isinstance(method, TelegramMethod)
|
||||
|
|
@ -47,7 +48,7 @@ class CustomSession(BaseSession):
|
|||
async def stream_content(
|
||||
self,
|
||||
url: str,
|
||||
headers: Optional[Dict[str, Any]] = None,
|
||||
headers: dict[str, Any] | None = None,
|
||||
timeout: int = 30,
|
||||
chunk_size: int = 65536,
|
||||
raise_for_status: bool = True,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue