Address @KunoiSayami suggestions · pyrogram/pyrogram@e517d3b · GitHub
Skip to content
This repository was archived by the owner on Dec 23, 2024. It is now read-only.

Commit e517d3b

Browse files
Address @KunoiSayami suggestions
1 parent bd213ab commit e517d3b

8 files changed

Lines changed: 16 additions & 16 deletions

File tree

pyrogram/connection/connection.py

Lines changed: 2 additions & 2 deletions

pyrogram/connection/transport/tcp/tcp_abridged.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818

1919
import logging
2020

21-
from typing import Union
21+
from typing import Optional
2222

2323
from .tcp import TCP
2424

@@ -43,7 +43,7 @@ async def send(self, data: bytes, *args):
4343
+ data
4444
)
4545

46-
async def recv(self, length: int = 0) -> Union[bytes, None]:
46+
async def recv(self, length: int = 0) -> Optional[bytes]:
4747
length = await super().recv(1)
4848

4949
if length is None:

pyrogram/connection/transport/tcp/tcp_abridged_o.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
import logging
2020
import os
2121

22-
from typing import Union
22+
from typing import Optional
2323

2424
from pyrogram.crypto import aes
2525
from .tcp import TCP
@@ -68,7 +68,7 @@ async def send(self, data: bytes, *args):
6868
)
6969
)
7070

71-
async def recv(self, length: int = 0) -> Union[bytes, None]:
71+
async def recv(self, length: int = 0) -> Optional[bytes]:
7272
length = await super().recv(1)
7373

7474
if length is None:

pyrogram/connection/transport/tcp/tcp_full.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
# along with Pyrogram. If not, see <http://www.gnu.org/licenses/>.
1818

1919
import logging
20-
from typing import Union
20+
from typing import Optional
2121
from binascii import crc32
2222
from struct import pack, unpack
2323

@@ -43,7 +43,7 @@ async def send(self, data: bytes, *args):
4343

4444
await super().send(data)
4545

46-
async def recv(self, length: int = 0) -> Union[bytes, None]:
46+
async def recv(self, length: int = 0) -> Optional[bytes]:
4747
length = await super().recv(4)
4848

4949
if length is None:

pyrogram/connection/transport/tcp/tcp_intermediate.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
# along with Pyrogram. If not, see <http://www.gnu.org/licenses/>.
1818

1919
import logging
20-
from typing import Union
20+
from typing import Optional
2121
from struct import pack, unpack
2222

2323
from .tcp import TCP
@@ -36,7 +36,7 @@ async def connect(self, address: tuple):
3636
async def send(self, data: bytes, *args):
3737
await super().send(pack("<i", len(data)) + data)
3838

39-
async def recv(self, length: int = 0) -> Union[bytes, None]:
39+
async def recv(self, length: int = 0) -> Optional[bytes]:
4040
length = await super().recv(4)
4141

4242
if length is None:

pyrogram/connection/transport/tcp/tcp_intermediate_o.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818

1919
import logging
2020
import os
21-
from typing import Union
21+
from typing import Optional
2222
from struct import pack, unpack
2323

2424
from pyrogram.crypto import aes
@@ -63,7 +63,7 @@ async def send(self, data: bytes, *args):
6363
)
6464
)
6565

66-
async def recv(self, length: int = 0) -> Union[bytes, None]:
66+
async def recv(self, length: int = 0) -> Optional[bytes]:
6767
length = await super().recv(4)
6868

6969
if length is None:

pyrogram/types/messages_and_media/message_entity.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
# You should have received a copy of the GNU Lesser General Public License
1717
# along with Pyrogram. If not, see <http://www.gnu.org/licenses/>.
1818

19-
from typing import Union
19+
from typing import Optional
2020

2121
import pyrogram
2222
from pyrogram import raw
@@ -86,7 +86,7 @@ def __init__(
8686
self.user = user
8787

8888
@staticmethod
89-
def _parse(client, entity, users: dict) -> Union["MessageEntity", None]:
89+
def _parse(client, entity, users: dict) -> Optional["MessageEntity"]:
9090
type = MessageEntity.ENTITIES.get(entity.ID, None)
9191

9292
if type is None:

pyrogram/types/user_and_chats/user.py

Lines changed: 2 additions & 2 deletions

0 commit comments

Comments
 (0)