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

Merged
merged 5 commits into from Dec 20, 2020
Merged

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 Improve typing hints #537 (review).

Copy link
Contributor

@KunoiSayami KunoiSayami left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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/connection/transport/tcp/tcp_intermediate_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 typing-fixes branch 2 times, most recently from ecc796c to a26e648 Compare November 29, 2020 22:26
@alissonlauffer alissonlauffer force-pushed the typing-fixes branch 2 times, most recently from 36df8dc to e45fea1 Compare December 8, 2020 20:32
pyrogram/filters.py Outdated Show resolved Hide resolved
pyrogram/filters.py Outdated Show resolved Hide resolved
@delivrance delivrance merged commit 1dc4df8 into pyrogram:master Dec 20, 2020
@alissonlauffer alissonlauffer deleted the typing-fixes branch December 3, 2021 10:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants