-
Notifications
You must be signed in to change notification settings - Fork 480
Type hints #3826
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
base: main
Are you sure you want to change the base?
Type hints #3826
Conversation
@@ -40,7 +42,7 @@ def __repr__(self): | |||
return "<'%s' table at %x>" % (self.tableTag, id(self)) | |||
|
|||
def __eq__(self, other): | |||
if type(self) != type(other): | |||
if not isinstance(self, type(other)): |
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.
This is unrelated to type hints and changes the meaning of the code. The current code is written as intended: only compare when the types match exactly.
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.
You are right. I tried to avoid changes like this. I’ll remove it.
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.
flake complains about the !=
. Can this changed to is not
?
@@ -691,6 +691,8 @@ def write(self, writer, font, tableDict, value, repeatIndex=None): | |||
assert writer.items[lengthIndex] == b"\xde\xad\xbe\xef"[: conv.staticSize] | |||
writer.items[lengthIndex] = lengthWriter.getAllData() | |||
|
|||
def __repr__(self): |
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.
I recomment to make a separate PR for changes other than type annotations.
I fixed a few flake issues I missed. But tox is not happy at all when I run it locally. Is there anything I can do or can I ignore issues in files I didn’t touch? I have fixes some easy ones. But that is probably another PR? |
I think you need to And you should format the code with |
Add some type hints.