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

[infra] Update python format checker #14558

Merged
merged 1 commit into from
Jan 17, 2025
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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/check-format.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,10 @@ jobs:
python-version: '3.x'

# C format: clang-format-16 (already installed)
# Python format: yapf==0.40.2
# Python format: yapf==0.43.0
- name: Install packages
run: |
pip install yapf==0.40.2
pip install yapf==0.43.0

- name: Check
run: ./nnas format
Expand Down
3 changes: 3 additions & 0 deletions .yapfignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
runtime/3rdparty/**/*
tests/nnapi/nnapi_test_generator/**/*
tests/nnapi/specs/**/*
5 changes: 0 additions & 5 deletions infra/command/format
Original file line number Diff line number Diff line change
Expand Up @@ -166,11 +166,6 @@ function check_python_files() {
# Exceptional case: fm-equalize doesn't have '.py' extension.
FILES_TO_CHECK_PYTHON+=(`echo "$FILES_TO_CHECK" | tr ' ' '\n' | egrep '^compiler/fm-equalize/fm-equalize$'`)

for s in ${DIRECTORIES_NOT_TO_BE_TESTED[@]}; do
skip=${s#'.'/}/
FILES_TO_CHECK_PYTHON=(${FILES_TO_CHECK_PYTHON[*]/$skip*/})
done

if [[ ${#FILES_TO_CHECK_PYTHON} -ne 0 ]]; then
yapf -i ${FILES_TO_CHECK_PYTHON[@]}
EXIT_CODE=$?
Expand Down