-
Notifications
You must be signed in to change notification settings - Fork 3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Make the Black workflow just run black with default settings. Instead of including specific directories, exclude the ones that haven't been blackened yet via `pyproject.toml`. Leave a few small files out of the exclusion list; blacken them instead. This is one step towards project-wide code formatting. It also makes it easier to format your entire patch when you touch multiple components, since you don't have to remember which directories to apply `black` to.
- Loading branch information
Showing
19 changed files
with
237 additions
and
199 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,38 +5,11 @@ jobs: | |
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- id: files | ||
uses: tj-actions/[email protected] | ||
with: | ||
files: | | ||
cvat-sdk/**/*.py | ||
cvat-cli/**/*.py | ||
tests/python/**/*.py | ||
cvat/apps/quality_control/**/*.py | ||
cvat/apps/analytics_report/**/*.py | ||
dir_names: true | ||
|
||
- name: Run checks | ||
env: | ||
PR_FILES_AM: ${{ steps.files.outputs.added_modified }} | ||
PR_FILES_RENAMED: ${{ steps.files.outputs.renamed }} | ||
run: | | ||
# If different modules use different Black configs, | ||
# we need to run Black for each python component group separately. | ||
# Otherwise, they all will use the same config. | ||
pipx install $(grep "^black" ./cvat-cli/requirements/development.txt) | ||
UPDATED_DIRS="${{steps.files.outputs.all_changed_files}}" | ||
echo "Black version: $(black --version)" | ||
if [[ ! -z $UPDATED_DIRS ]]; then | ||
pipx install $(egrep "black.*" ./cvat-cli/requirements/development.txt) | ||
echo "Black version: "$(black --version) | ||
echo "The dirs will be checked: $UPDATED_DIRS" | ||
EXIT_CODE=0 | ||
for DIR in $UPDATED_DIRS; do | ||
black --check --diff $DIR || EXIT_CODE=$(($? | $EXIT_CODE)) || true | ||
done | ||
exit $EXIT_CODE | ||
else | ||
echo "No files with the \"py\" extension found" | ||
fi | ||
black --check --diff . |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,16 @@ | ||
from django.apps import apps | ||
|
||
if apps.is_installed('silk'): | ||
if apps.is_installed("silk"): | ||
from silk.profiling.profiler import silk_profile # pylint: disable=unused-import | ||
else: | ||
from functools import wraps | ||
|
||
def silk_profile(name=None): | ||
def profile(f): | ||
@wraps(f) | ||
def wrapped(*args, **kwargs): | ||
return f(*args, **kwargs) | ||
|
||
return wrapped | ||
|
||
return profile |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -24,6 +24,7 @@ | |
|
||
|
||
if debug.is_debugging_enabled(): | ||
|
||
class DebuggerApp(ASGIHandler): | ||
""" | ||
Support for VS code debugger | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.