Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve typing hints #537

Open
wants to merge 4 commits into
base: master
from

Conversation

@alissonlauffer
Copy link
Contributor

@alissonlauffer alissonlauffer commented Nov 14, 2020

Proposed changes

  • Change type1 or type2 to Union[type1, type2] because the first one is not a valid syntax for typing hints (though it does not give any SyntaxError).
  • Change Union[type1, None] to Optional[type1] as proposed in #537 (review).
Copy link

@KunoiSayami KunoiSayami left a comment

Use Optional[X] may more intuitive than Union[X, None]
Reference: https://docs.python.org/3/library/typing.html#typing.Optional

pyrogram/connection/connection.py Outdated Show resolved Hide resolved
pyrogram/connection/connection.py Outdated Show resolved Hide resolved
pyrogram/connection/transport/tcp/tcp_abridged.py Outdated Show resolved Hide resolved
pyrogram/connection/transport/tcp/tcp_abridged.py Outdated Show resolved Hide resolved
pyrogram/connection/transport/tcp/tcp_abridged_o.py Outdated Show resolved Hide resolved
pyrogram/types/messages_and_media/message_entity.py Outdated Show resolved Hide resolved
pyrogram/types/messages_and_media/message_entity.py Outdated Show resolved Hide resolved
pyrogram/types/user_and_chats/user.py Outdated Show resolved Hide resolved
pyrogram/types/user_and_chats/user.py Outdated Show resolved Hide resolved
@alissonlauffer alissonlauffer force-pushed the alissonlauffer:typing-fixes branch from 73689e0 to e517d3b Nov 29, 2020
@alissonlauffer alissonlauffer force-pushed the alissonlauffer:typing-fixes branch 2 times, most recently from ecc796c to a26e648 Nov 29, 2020
@alissonlauffer alissonlauffer force-pushed the alissonlauffer:typing-fixes branch from a26e648 to d4d9310 Dec 6, 2020
@alissonlauffer alissonlauffer force-pushed the alissonlauffer:typing-fixes branch from 36df8dc to e45fea1 Dec 8, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Linked issues

Successfully merging this pull request may close these issues.

None yet

2 participants
You can’t perform that action at this time.