Skip to content
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

Fix renderer ignore #230

Merged
merged 4 commits into from
Mar 14, 2022
Merged

Fix renderer ignore #230

merged 4 commits into from
Mar 14, 2022

Conversation

bhrutledge
Copy link
Contributor

Follow-up to #225.

Based on: https://mypy.readthedocs.io/en/stable/kinds_of_types.html#callable-types-and-lambdas

mypy can infer lambda types; it seems we just need to annotate the lookup dict.

The cast isn't necessary to pass mypy, but offers a little more clarity.

FYI @miketheman

@bhrutledge bhrutledge requested a review from di March 12, 2022 11:13
Based on:
https://mypy.readthedocs.io/en/stable/kinds_of_types.html#callable-types-and-lambdas

mypy can infer lambda types; it seems we just need to annotate the
lookup dict.
This isn't necessary to pass mypy, but offers a little more clarity.
Copy link
Member

@miketheman miketheman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice stuff, thanks for doing it!

Comment on lines +8 to +11
show_error_codes = true
enable_error_code = [
"ignore-without-code"
]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice addition!

variants = {
"GFM": lambda raw: cmarkgfm.github_flavored_markdown_to_html(
variants: Dict[str, Callable[[str], str]] = {
"GFM": lambda raw: cast(str, cmarkgfm.github_flavored_markdown_to_html(
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nifty trick, I'll have to remember it for the future. I've confirmed this was included in CPython since 3.5, so we're definitely safe there.

@di di merged commit 361f7fc into pypa:main Mar 14, 2022
@bhrutledge bhrutledge deleted the fix-renderer-ignore branch March 14, 2022 21:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants