mirror of
https://github.com/LonamiWebs/Telethon.git
synced 2026-09-08 01:41:59 +00:00
Use modern typehint syntax
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
import struct
|
||||
from typing import Optional, Tuple
|
||||
from typing import Optional
|
||||
|
||||
from pytest import raises
|
||||
from telethon._impl.crypto import AuthKey
|
||||
@@ -49,7 +49,7 @@ def test_rpc_error_parsing() -> None:
|
||||
PLAIN_REQUEST = b"Hey!"
|
||||
|
||||
|
||||
def unwrap_finalize(finalized: Optional[Tuple[MsgId, bytes]]) -> bytes:
|
||||
def unwrap_finalize(finalized: Optional[tuple[MsgId, bytes]]) -> bytes:
|
||||
assert finalized is not None
|
||||
_, buffer = finalized
|
||||
return buffer
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
from typing import Tuple
|
||||
|
||||
from pytest import raises
|
||||
from telethon._impl.mtproto import Abridged
|
||||
|
||||
@@ -11,7 +9,7 @@ class Output(bytearray):
|
||||
self += data
|
||||
|
||||
|
||||
def setup_pack(n: int) -> Tuple[Abridged, bytes, Output]:
|
||||
def setup_pack(n: int) -> tuple[Abridged, bytes, Output]:
|
||||
input = bytes(x & 0xFF for x in range(n))
|
||||
return Abridged(), input, Output()
|
||||
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
from typing import Tuple
|
||||
|
||||
from pytest import raises
|
||||
from telethon._impl.mtproto import Full
|
||||
|
||||
@@ -11,12 +9,12 @@ class Output(bytearray):
|
||||
self += data
|
||||
|
||||
|
||||
def setup_pack(n: int) -> Tuple[Full, bytes, Output]:
|
||||
def setup_pack(n: int) -> tuple[Full, bytes, Output]:
|
||||
input = bytes(x & 0xFF for x in range(n))
|
||||
return Full(), input, Output()
|
||||
|
||||
|
||||
def setup_unpack(n: int) -> Tuple[bytes, Full, bytes, bytearray]:
|
||||
def setup_unpack(n: int) -> tuple[bytes, Full, bytes, bytearray]:
|
||||
transport, expected_output, input = setup_pack(n)
|
||||
transport.pack(expected_output, input)
|
||||
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
from typing import Tuple
|
||||
|
||||
from pytest import raises
|
||||
from telethon._impl.mtproto import Intermediate
|
||||
|
||||
@@ -11,7 +9,7 @@ class Output(bytearray):
|
||||
self += data
|
||||
|
||||
|
||||
def setup_pack(n: int) -> Tuple[Intermediate, bytes, Output]:
|
||||
def setup_pack(n: int) -> tuple[Intermediate, bytes, Output]:
|
||||
input = bytes(x & 0xFF for x in range(n))
|
||||
return Intermediate(), input, Output()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user