-
Notifications
You must be signed in to change notification settings - Fork 89
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
Fix renderer ignore #230
Conversation
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.
dd91354
to
9a5028e
Compare
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.
Nice stuff, thanks for doing it!
show_error_codes = true | ||
enable_error_code = [ | ||
"ignore-without-code" | ||
] |
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.
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( |
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.
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.
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