Skip to content

Commit ffb61ee

Browse files
committed
Make exit() function a bit more aesthetic
1 parent 6475537 commit ffb61ee

File tree

1 file changed

+11
-10
lines changed

1 file changed

+11
-10
lines changed

mypy_django_plugin/main.py

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -62,16 +62,17 @@ def exit(error_type: int) -> NoReturn:
6262
"""
6363
from mypy.main import CapturableArgumentParser
6464

65-
usage = '\n'.join(['(config)',
66-
'...',
67-
'[mypy.plugins.django_stubs]',
68-
'\tdjango_settings_module: str (required)',
69-
'...']).expandtabs(4)
70-
handler = CapturableArgumentParser(prog="(django-stubs) mypy", usage=usage)
71-
messages = {1: "'django_settings_module' is not set: mypy config file is not specified or found",
72-
2: "'django_settings_module' is not set: no section [mypy.plugins.django-stubs]",
73-
3: "'django_settings_module' is not set: the setting is not provided"}
74-
handler.error(messages[error_type])
65+
usage = """(config)
66+
...
67+
[mypy.plugins.django_stubs]
68+
django_settings_module: str (required)
69+
...
70+
""".replace("\n ", "\n")
71+
handler = CapturableArgumentParser(prog='(django-stubs) mypy', usage=usage)
72+
messages = {1: 'mypy config file is not specified or found',
73+
2: 'no section [mypy.plugins.django-stubs]',
74+
3: 'the setting is not provided'}
75+
handler.error("'django_settings_module' is not set: " + messages[error_type])
7576

7677
parser = configparser.ConfigParser()
7778
try:

0 commit comments

Comments
 (0)