Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion pyrightconfig.stricter.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@
"stubs/cffi",
"stubs/click-default-group",
"stubs/click-web",
"stubs/commonmark",
"stubs/corus",
"stubs/dateparser",
"stubs/defusedxml",
Expand Down
2 changes: 2 additions & 0 deletions stubs/commonmark/@tests/stubtest_allowlist.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# Testing modules are not included in type stubs
commonmark.tests.*
4 changes: 0 additions & 4 deletions stubs/commonmark/METADATA.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,2 @@
version = "0.9.*"
upstream_repository = "https://github.com/rtfd/commonmark.py"
partial_stub = true

[tool.stubtest]
ignore_missing_stub = true
2 changes: 2 additions & 0 deletions stubs/commonmark/commonmark/entitytrans.pyi
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
def _unescape(s: str) -> str: ...

__all__ = ["_unescape"]
4 changes: 2 additions & 2 deletions stubs/commonmark/commonmark/inlines.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -50,14 +50,14 @@ class InlineParser:
def removeDelimiter(self, delim: dict[str, Any]) -> None: ...
@staticmethod
def removeDelimitersBetween(bottom: dict[str, Any], top: dict[str, Any]) -> None: ...
def processEmphasis(self, stack_bottom) -> None: ...
def processEmphasis(self, stack_bottom: dict[str, Any]) -> None: ...
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: ...
Copy link
Collaborator

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.

And @srittau already accepted those in #13681

Copy link
Contributor Author

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

Copy link
Collaborator

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

Copy link
Contributor Author

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

def removeBracket(self) -> None: ...
def parseEntity(self, block: Node) -> bool: ...
def parseString(self, block: Node) -> bool: ...
Expand Down
2 changes: 2 additions & 0 deletions stubs/commonmark/commonmark/normalize_reference.pyi
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
def normalize_reference(string: str) -> str: ...

__all__ = ["normalize_reference"]