make mypy happy

This commit is contained in:
Evgenii Alekseev 2021-12-26 01:58:55 +03:00
parent 1e85c1db70
commit d1f990eac8

View File

@ -22,6 +22,7 @@ import sys
import tempfile import tempfile
from pathlib import Path from pathlib import Path
from typing import TypeVar
from ahriman import version from ahriman import version
from ahriman.application import handlers from ahriman.application import handlers
@ -32,8 +33,11 @@ from ahriman.models.sign_settings import SignSettings
from ahriman.models.user_access import UserAccess from ahriman.models.user_access import UserAccess
# pylint thinks it is bad idea, but get the fuck off # this workaround is for several things
SubParserAction = argparse._SubParsersAction # pylint: disable=protected-access # firstly python devs don't think that is it error and asking you for workarounds https://bugs.python.org/issue41592
# secondly linters don't like when you are importing private members
# thirdly new mypy doesn't like _SubParsersAction and thinks it is a template
SubParserAction = TypeVar("SubParserAction", bound="argparse._SubParsersAction[argparse.ArgumentParser]")
def _formatter(prog: str) -> argparse.HelpFormatter: def _formatter(prog: str) -> argparse.HelpFormatter: