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

Change sys.exit to Raise. #2440

Merged
merged 4 commits into from Aug 24, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 4 additions & 0 deletions CHANGES.md
Expand Up @@ -10,6 +10,10 @@
- The failsafe for accidentally added backslashes in f-string expressions has been
hardened to handle more edge cases during quote normalization (#2437)

### _Blackd_

- Replace sys.exit(-1) with raise ImportError (#2440)

### Integrations

- The provided pre-commit hooks no longer specify `language_version` to avoid overriding
Expand Down
9 changes: 3 additions & 6 deletions src/blackd/__init__.py
@@ -1,6 +1,5 @@
import asyncio
import logging
import sys
from concurrent.futures import Executor, ProcessPoolExecutor
from datetime import datetime
from functools import partial
Expand All @@ -11,13 +10,11 @@
from aiohttp import web
import aiohttp_cors
except ImportError as ie:
print(
raise ImportError(
f"aiohttp dependency is not installed: {ie}. "
+ "Please re-install black with the '[d]' extra install "
+ "to obtain aiohttp_cors: `pip install black[d]`",
file=sys.stderr,
)
sys.exit(-1)
+ "to obtain aiohttp_cors: `pip install black[d]`"
) from None

import black
from black.concurrency import maybe_install_uvloop
Expand Down