Revision a5a0e77e916382a3a06ce9ce05499a4acb2f0c30 authored by dependabot[bot] on 23 January 2024, 11:18:26 UTC, committed by GitHub on 23 January 2024, 11:18:26 UTC
1 parent 79aaa84
Raw File
format_python_code.sh
#! /bin/env bash

set -e

PYTHON="${PYTHON:-python3}"
BLACK="${PYTHON} -m black"
ISORT="${PYTHON} -m isort"

if ! ${BLACK} --version >/dev/null 2>&1; then
    echo "black is not found, please check it is installed"
    exit 1
fi
if ! ${ISORT} --version >/dev/null 2>&1; then
    echo "isort is not found, please check it is installed"
    exit 1
fi

# The commands must be run on each module directory separately,
# otherwise tools confuse the "current" module
for paths in \
    "cvat-sdk" \
    "cvat-cli" \
    "tests/python/" \
    "cvat/apps/quality_control" \
    "cvat/apps/analytics_report" \
    ; do
    ${BLACK} -- ${paths}
    ${ISORT} -- ${paths}
done
back to top