INNER CODE UNIT · Python
sort_imports
PyCQA/isort · isort/main.py:77
def sort_imports(
file_name: str | Path,
config: Config,
check: bool = False,
ask_to_apply: bool = False,
write_to_stdout: bool = False,
**kwargs: Any,
) -> SortAttempt | None:
incorrectly_sorted: bool = False
skipped: bool = False
try:
if check:
try:
incorrectly_sorted = not api.check_file(file_name, config=config, **kwargs)
except FileSkipped:
skipped = True
return SortAttempt(incorrectly_sorted, skipped, True)