|
| 1 | +#!/bin/bash |
| 2 | +# Copyright 2025 Google LLC |
| 3 | +# |
| 4 | +# Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | +# you may not use this file except in compliance with the License. |
| 6 | +# You may obtain a copy of the License at |
| 7 | +# |
| 8 | +# http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | +# |
| 10 | +# Unless required by applicable law or agreed to in writing, software |
| 11 | +# distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | +# See the License for the specific language governing permissions and |
| 14 | +# limitations under the License. |
| 15 | + |
| 16 | +# Autoformat ADK codebase. |
| 17 | + |
| 18 | +if ! command -v isort &> /dev/null |
| 19 | +then |
| 20 | + echo "isort not found, refer to CONTRIBUTING.md to set up dev environment first." |
| 21 | + exit |
| 22 | +fi |
| 23 | + |
| 24 | +if ! command -v pyink &> /dev/null |
| 25 | +then |
| 26 | + echo "pyink not found, refer to CONTRIBUTING.md to set up dev environment first." |
| 27 | + exit |
| 28 | +fi |
| 29 | + |
| 30 | +echo '---------------------------------------' |
| 31 | +echo '| Organizing imports for src/...' |
| 32 | +echo '---------------------------------------' |
| 33 | + |
| 34 | +isort src/ |
| 35 | +echo 'All done! ✨ 🍰 ✨' |
| 36 | + |
| 37 | +echo '---------------------------------------' |
| 38 | +echo '| Organizing imports for tests/...' |
| 39 | +echo '---------------------------------------' |
| 40 | + |
| 41 | +isort tests/ |
| 42 | +echo 'All done! ✨ 🍰 ✨' |
| 43 | + |
| 44 | +echo '---------------------------------------' |
| 45 | +echo '| Auto-formatting src/...' |
| 46 | +echo '---------------------------------------' |
| 47 | + |
| 48 | +find -L src/ -type f -name "*.py" -exec pyink --config pyproject.toml {} + |
| 49 | + |
| 50 | +echo '---------------------------------------' |
| 51 | +echo '| Auto-formatting tests/...' |
| 52 | +echo '---------------------------------------' |
| 53 | + |
| 54 | +find -L tests/ -type f -name "*.py" -exec pyink --config pyproject.toml {} + |
0 commit comments