-
Notifications
You must be signed in to change notification settings - Fork 298
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
Add Type Hints to image/__init__.py #818
Conversation
empty |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Most of this looks good, but there are a large amount of inaccuracies. I have made comments for those that I have found, but there could be more.
Pardon the delay, but it's quite challenging to review this PR. There are many mistakes, and it takes a lot of time to review manually. I added a few more comments for issues that I found. There are also several issues that appear all throughout, but I did not comment them.
def function():
"""This is preferred
def function():
"""
Not this
|
Ok. Are you the only one reviewing pyglet PRs.
…On Wed, May 24, 2023 at 2:03 AM Benjamin ***@***.***> wrote:
Pardon the delay, but it's quite challenging to review this PR. There are
many mistakes, and it takes a lot of time to review manually. I added a few
more comments for issues that I found. There are also several issues that
appear all throughout, but I did not comment them.
1.
Many of the classmethods are wrong. cls should be the actual object of
the class that will be returned, but it's often shown as AbstractImage.
This might pass a type checker, but it's returning the subclass is more
accurate.
2.
There are many unnecessary docstring breaks. All docstrings should
start on the same line as the triple quotes for compactness. For example:
def function():
"""This is preferreddef function(): """
Not this
1. Many functions are unnecessarily wrapped. pyglet adheres to PEP8,
with the exception of a relaxed line length limit. It's acceptable (and
preferred) to allow function definitions to reach 100 (or up to 110)
columns, rather than splitting to multiple lines.
—
Reply to this email directly, view it on GitHub
<#818 (comment)>, or
unsubscribe
<https://github.com/notifications/unsubscribe-auth/ATHLIH7HGS5QINI6F3FVYDDXHXFFZANCNFSM6AAAAAAXRGF2NM>
.
You are receiving this because you authored the thread.Message ID:
***@***.***>
|
def save(self, filename: str= "", | ||
file: Optional[IO]=None, | ||
encoder: Optional[str]=None | ||
) -> Optional[ImageEncodeException]: |
Check notice
Code scanning / CodeQL
Explicit returns mixed with implicit (fall through) returns Note
I wanted to fix #787 so I type hinted it.