Feature/prompt user to paste code properly 35 - Take 2#137
Feature/prompt user to paste code properly 35 - Take 2#137tim-schilling wants to merge 2 commits into
Conversation
Ignore flake8 for unsupported line in constants
|
Thanks for having a look at this! I'll try to review in the coming days. |
knyghty
left a comment
There was a problem hiding this comment.
Thanks for this. I left some comments. I am not too sure about the mypy errors relating to the plugins. For guesslang not being found you can add guesslang.* to the excludes: https://mypy.readthedocs.io/en/stable/config_file.html#confval-exclude
| @@ -0,0 +1,23 @@ | |||
| from typing import Optional | |||
There was a problem hiding this comment.
I don't much like the name of this file, can it be utils? Or whatever is more appropriate.
| def get_parser( | ||
| message: hikari.Message, | ||
| ) -> Optional[Union[HTMLParser, PythonParser, JavascriptParser]]: |
There was a problem hiding this comment.
We're on 3.10 (which reminds me, should probably upgrade to 3.11), so we can do:
| def get_parser( | |
| message: hikari.Message, | |
| ) -> Optional[Union[HTMLParser, PythonParser, JavascriptParser]]: | |
| def get_parser( | |
| message: hikari.Message, | |
| ) -> HTMLParser | PythonParser | JavascriptParser || None: |
Additionally... Couldn't this be:
| def get_parser( | |
| message: hikari.Message, | |
| ) -> Optional[Union[HTMLParser, PythonParser, JavascriptParser]]: | |
| def get_parser(message: hikari.Message) -> CodeblockParser | None: |
| NamedTuple( | ||
| "MarkdownCodeblock", | ||
| [ | ||
| ("content", Optional[str]), |
There was a problem hiding this comment.
| ("content", Optional[str]), | |
| ("content", str | None), |
| return f"`{text}`" | ||
|
|
||
|
|
||
| def codeblock(text: str, language: Language) -> Optional[str]: |
There was a problem hiding this comment.
| def codeblock(text: str, language: Language) -> Optional[str]: | |
| def codeblock(text: str, language: Language) -> str | None: |
|
I guess for the plugin stuff in mypy, maybe just |
|
It's probably unlikely I'm going to get back around to this. |
This is another attempt at #42
I squashed the commits, rebased on main, and resolved most of the mypy issues. The Plugin concerns already exist in
nag, so I'm not sure how to handle those.I also pinned the new dependency to a specific commit to help avoid security issues down the road. However, this makes the build more fragile.