-
-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
Fixes for markdown stubs #4758
Fixes for markdown stubs #4758
Conversation
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
1 similar comment
This comment has been minimized.
This comment has been minimized.
Regrading |
I'm guessing pytype doesn't support the type ignore with error code |
@hauntsaninja Reasonable guess. Fixed. |
That seems like the right diagnosis to me. Might be as simple to fix as changing the |
This comment has been minimized.
This comment has been minimized.
Came up in python/typeshed#4758 - mypy supports having error codes in brackets after a `# type: ignore`. From https://github.com/python/mypy/blob/master/mypy/errorcodes.py and https://hub.packtpub.com/mypy-0-730-releases-with-more-precise-error-locations-display-error-codes/, it seems error codes look like my-error-code, and you can include multiple by separating them with commas. This change will also allow `# type: ignore[]`, but I think that's fine. PiperOrigin-RevId: 341947562
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.
Thanks! Remarks below.
Signed-off-by: Anders Kaseorg <[email protected]>
Signed-off-by: Anders Kaseorg <[email protected]>
Signed-off-by: Anders Kaseorg <[email protected]>
Signed-off-by: Anders Kaseorg <[email protected]>
This comment has been minimized.
This comment has been minimized.
Signed-off-by: Anders Kaseorg <[email protected]>
Signed-off-by: Anders Kaseorg <[email protected]>
This comment has been minimized.
This comment has been minimized.
1 similar comment
Diff from mypy_primer, showing the effect of this PR on open source code: - zerver/lib/markdown/tabbed_sections.py:163: error: Argument 1 to "TabbedSectionsGenerator" has incompatible type "**Dict[str, str]"; expected "Mapping[str, str]" [arg-type]
- zerver/lib/markdown/api_arguments_table_generator.py:19: error: Dict entry 0 has incompatible type "str": "List[str]"; expected "str": "str" [dict-item]
- zerver/lib/markdown/fenced_code.py:145: error: Dict entry 0 has incompatible type "str": "List[Any]"; expected "str": "str" [dict-item]
- zerver/lib/markdown/fenced_code.py:158: error: Argument "run_content_validators" to "FencedBlockPreprocessor" has incompatible type "str"; expected "bool" [arg-type]
- zerver/lib/markdown/__init__.py:527: error: Return type "Tuple[Optional[Element], int, int]" of "handleMatch" incompatible with return type "None" in supertype "InlineProcessor" [override]
+ zerver/lib/markdown/__init__.py:527: error: Return type "Tuple[Optional[Element], int, int]" of "handleMatch" incompatible with return type "Union[Tuple[Element, int, int], Tuple[None, None, None]]" in supertype "InlineProcessor" [override]
+ zerver/lib/markdown/__init__.py:535: error: Item "None" of "Optional[Element]" has no attribute "text" [union-attr]
+ zerver/lib/markdown/__init__.py:536: error: Incompatible return value type (got "Tuple[Optional[Element], Optional[int], Optional[int]]", expected "Tuple[Optional[Element], int, int]") [return-value]
- zerver/lib/markdown/__init__.py:1239: error: Return type "Optional[Element]" of "handleMatch" incompatible with return type "None" in supertype "Pattern" [override]
- zerver/lib/markdown/__init__.py:1344: error: Return type "Optional[Element]" of "handleMatch" incompatible with return type "None" in supertype "Pattern" [override]
- zerver/lib/markdown/__init__.py:1355: error: Return type "Optional[Element]" of "handleMatch" incompatible with return type "None" in supertype "Pattern" [override]
- zerver/lib/markdown/__init__.py:1365: error: Return type "Optional[Element]" of "handleMatch" incompatible with return type "None" in supertype "Pattern" [override]
- zerver/lib/markdown/__init__.py:1387: error: Return type "Element" of "handleMatch" incompatible with return type "None" in supertype "Pattern" [override]
- zerver/lib/markdown/__init__.py:1488: error: Return type "Union[Element, str, None]" of "handleMatch" incompatible with return type "None" in supertype "Pattern" [override]
- zerver/lib/markdown/__init__.py:1652: error: Return type "Union[Element, str]" of "handleMatch" incompatible with return type "None" in supertype "Pattern" [override]
- zerver/lib/markdown/__init__.py:1659: error: Return type "Optional[Element]" of "handleMatch" incompatible with return type "None" in supertype "Pattern" [override]
- zerver/lib/markdown/__init__.py:1704: error: Return type "Optional[Element]" of "handleMatch" incompatible with return type "None" in supertype "Pattern" [override]
- zerver/lib/markdown/__init__.py:1736: error: Return type "Optional[Element]" of "handleMatch" incompatible with return type "None" in supertype "Pattern" [override]
- zerver/lib/markdown/__init__.py:1766: error: Return type "Optional[Element]" of "handleMatch" incompatible with return type "None" in supertype "Pattern" [override]
- zerver/lib/markdown/__init__.py:1855: error: Return type "Tuple[Optional[Element], int, int]" of "handleMatch" incompatible with return type "None" in supertype "InlineProcessor" [override]
+ zerver/lib/markdown/__init__.py:1855: error: Return type "Tuple[Optional[Element], int, int]" of "handleMatch" incompatible with return type "Union[Tuple[Element, int, int], Tuple[None, None, None]]" in supertype "InlineProcessor" [override]
- zerver/lib/markdown/nested_code_blocks.py:75: error: Argument 1 to "NestedCodeBlocksRenderer" has incompatible type "**Dict[str, str]"; expected "Mapping[str, str]" [arg-type]
+ zerver/lib/markdown/__init__.py:1859: error: Incompatible return value type (got "Tuple[Optional[Element], Optional[int], Optional[int]]", expected "Tuple[Optional[Element], int, int]") [return-value]
|
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.
Thanks, one request for future reference: Please don't force push changes after review as it makes it harder to re-review changes. We squash merge in typeshed anyway.
markdown.Extension
aliasMarkdown
membersExtension.config
typePattern.handleMatch
typeCc: @erictraut @hauntsaninja @hynek @silasary