-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Complete stubs for commonmark
#13724
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
Conversation
According to mypy_primer, this change has no effect on the checked open source code. 🤖🎉 |
def parseLinkTitle(self) -> str | None: ... | ||
def parseLinkDestination(self) -> str | None: ... | ||
def parseLinkLabel(self) -> int: ... | ||
def parseOpenBracket(self, block: Node) -> Literal[True]: ... | ||
def parseBang(self, block: Node) -> Literal[True]: ... | ||
def parseCloseBracket(self, block: Node) -> Literal[True]: ... | ||
def addBracket(self, node, index, image) -> None: ... | ||
def addBracket(self, node: Node, index: int, image: bool | None) -> None: ... |
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.
Not sure if None
is completely appropriate here. It technically works, but looking at the source, it's always used as a boolean, no None
check, and only ever passed True
or False
in this method's usage.
But I also see that when a parameter is unused, the source defaults it to None
, even boolean.
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.
That's why I left None
because the internal logic doesn't prohibit it
maybe someone prefers not to pass this argument then it will work as False
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.
Well in this case if you don't pass an argument you'll get TypeError: addBracket() missing 1 required positional argument: 'image'
😉
But semantic details aside, reviewing this PR made me realize the library this stubs is archived and deprecated. And now that you completed it, I think it's good for a sendoff. #13725
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.
indeed, this can be fixed together with dict in PR before deletion
No description provided.