From 30467b44cd82973576c8073136dede6aa2fa60f0 Mon Sep 17 00:00:00 2001 From: Maxime Desroches Date: Tue, 6 Aug 2024 21:39:18 -0700 Subject: [PATCH 1/5] pre-commit: bring back some checks (#33196) * add this * add this * nice ... * 120 * remove * no remote * 0 * this * no submodules * like this * try this * validate * like this * split * pass files * no par * check exist * no build * fix * 24.04 * default * test failure * continue * actually fail * clean * import * fix * line * mypy * clean * simpler * final * better * final clean * not true --- .github/workflows/selfdrive_tests.yaml | 26 +++++++---- pyproject.toml | 8 +++- scripts/lint.sh | 64 ++++++++++++++++++++++++-- uv.lock | 49 ++++++++++++++++++++ 4 files changed, 133 insertions(+), 14 deletions(-) diff --git a/.github/workflows/selfdrive_tests.yaml b/.github/workflows/selfdrive_tests.yaml index 8c46e15c2f..b0dbfbebee 100644 --- a/.github/workflows/selfdrive_tests.yaml +++ b/.github/workflows/selfdrive_tests.yaml @@ -61,13 +61,20 @@ jobs: cd $STRIPPED_DIR ${{ env.RUN }} "release/check-dirty.sh && \ MAX_EXAMPLES=5 $PYTEST -m 'not slow' selfdrive/car" - - name: static analysis + - name: Getting modified files + timeout-minutes: 1 + run: | + cd $GITHUB_WORKSPACE + git fetch --unshallow --recurse-submodules=no origin master:master + ALL_FILES=$(git diff --name-only --cached --diff-filter=AM $(git merge-base HEAD master)) + echo FILES=$(echo $ALL_FILES) >> $GITHUB_ENV + - name: Static analysis timeout-minutes: 1 run: | cd $GITHUB_WORKSPACE cp pyproject.toml $STRIPPED_DIR cd $STRIPPED_DIR - ${{ env.RUN }} "scripts/lint.sh" + ${{ env.RUN }} "scripts/lint.sh $FILES" build: strategy: @@ -140,16 +147,17 @@ jobs: runs-on: ${{ ((github.repository == 'commaai/openpilot') && ((github.event_name != 'pull_request') || (github.event.pull_request.head.repo.full_name == 'commaai/openpilot'))) && 'namespace-profile-amd64-8x16' || 'ubuntu-latest' }} + env: + PYTHONWARNINGS: default steps: - uses: actions/checkout@v4 - with: - submodules: true - - uses: ./.github/workflows/setup-with-retry - - name: Build openpilot - run: ${{ env.RUN }} "scons -j$(nproc)" - - name: static analysis + - name: Setup + run: tools/op.sh setup + - name: Get ancestor commit + run: git fetch --unshallow --recurse-submodules=no origin master:master + - name: Static analysis timeout-minutes: 1 - run: ${{ env.RUN }} "scripts/lint.sh" + run: tools/op.sh lint unit_tests: name: unit tests diff --git a/pyproject.toml b/pyproject.toml index 24ec80e787..56eafc954b 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -88,6 +88,7 @@ testing = [ "pytest-repeat", "ruff", "codespell", + "pre-commit-hooks", ] dev = [ @@ -177,9 +178,11 @@ plugins = [ "numpy.typing.mypy_plugin", ] exclude = [ - "body/", "cereal/", + "msgq/", + "msgq_repo/", "opendbc/", + "opendbc_repo/", "panda/", "rednose/", "rednose_repo/", @@ -204,6 +207,9 @@ warn_return_any=true # allow implicit optionals for default args implicit_optional = true +local_partial_types=true +explicit_package_bases=true + # https://beta.ruff.rs/docs/configuration/#using-pyprojecttoml [tool.ruff] indent-width = 2 diff --git a/scripts/lint.sh b/scripts/lint.sh index 3da79f62f4..d766961cd1 100755 --- a/scripts/lint.sh +++ b/scripts/lint.sh @@ -1,11 +1,67 @@ #!/bin/bash set -e +RED='\033[0;31m' +GREEN='\033[0;32m' +NC='\033[0m' + DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null && pwd )" cd $DIR/../ -# TODO: bring back rest of pre-commit checks: -# https://github.com/commaai/openpilot/blob/4b11c9e914707df9def598616995be2a5d355a6a/.pre-commit-config.yaml#L2 +FAILED=0 + +IGNORED_FILES="uv\.lock|docs\/CARS.md" + +function run() { + echo -en "$1" + + for ((i=0; i<$((50 - ${#1})); i++)); do + echo -n "." + done + + shift 1; + CMD="$@" + + set +e + log="$((eval "$CMD" ) 2>&1)" + + if [[ $? -eq 0 ]]; then + echo -e "[${GREEN}✔${NC}]" + else + echo -e "[${RED}✗${NC}]" + echo "$log" + FAILED=1 + fi + set -e +} + +function run_tests() { + ALL_FILES=$(echo "$@" | sed -E "s/$IGNORED_FILES//g") + PYTHON_FILES=$(echo "$ALL_FILES" | grep --color=never '.py$' || true) + + if [[ -n "$PYTHON_FILES" ]]; then + run "ruff" ruff check $PYTHON_FILES --quiet + run "mypy" mypy $PYTHON_FILES + run "Import check" lint-imports + fi + + if [[ -n "$ALL_FILES" ]]; then + run "Codespell" codespell $ALL_FILES + run "Large files check" python3 -m pre_commit_hooks.check_added_large_files --enforce-all $ALL_FILES --maxkb=120 + run "Shebang check" python3 -m pre_commit_hooks.check_shebang_scripts_are_executable $ALL_FILES + fi + + return $FAILED +} -ruff check . -lint-imports +if [[ -n $@ ]]; then + VALID_FILES="" + for f in $@; do + if [[ -f "$f" ]]; then + VALID_FILES+="$f"$'\n' + fi + done + run_tests "$VALID_FILES" +else + run_tests "$(git diff --name-only --cached --diff-filter=AM $(git merge-base HEAD master))" +fi diff --git a/uv.lock b/uv.lock index bca0895ebf..b5a734f300 100644 --- a/uv.lock +++ b/uv.lock @@ -1454,6 +1454,7 @@ testing = [ { name = "hypothesis", marker = "python_version == '3.11' or python_version >= '3.12' or (python_version < '3.12' and (python_version < '3.11' or python_version > '3.11'))" }, { name = "import-linter", marker = "python_version == '3.11' or python_version >= '3.12' or (python_version < '3.12' and (python_version < '3.11' or python_version > '3.11'))" }, { name = "mypy", marker = "python_version == '3.11' or python_version >= '3.12' or (python_version < '3.12' and (python_version < '3.11' or python_version > '3.11'))" }, + { name = "pre-commit-hooks", marker = "python_version == '3.11' or python_version >= '3.12' or (python_version < '3.12' and (python_version < '3.11' or python_version > '3.11'))" }, { name = "pytest", marker = "python_version == '3.11' or python_version >= '3.12' or (python_version < '3.12' and (python_version < '3.11' or python_version > '3.11'))" }, { name = "pytest-asyncio", marker = "python_version == '3.11' or python_version >= '3.12' or (python_version < '3.12' and (python_version < '3.11' or python_version > '3.11'))" }, { name = "pytest-cov", marker = "python_version == '3.11' or python_version >= '3.12' or (python_version < '3.12' and (python_version < '3.11' or python_version > '3.11'))" }, @@ -1637,6 +1638,18 @@ wheels = [ { url = "https://files.pythonhosted.org/packages/9b/fb/a70a4214956182e0d7a9099ab17d50bfcba1056188e9b14f35b9e2b62a0d/portalocker-2.10.1-py3-none-any.whl", hash = "sha256:53a5984ebc86a025552264b459b46a2086e269b21823cb572f8f28ee759e45bf", size = 18423 }, ] +[[distribution]] +name = "pre-commit-hooks" +version = "4.6.0" +source = { registry = "https://pypi.org/simple" } +dependencies = [ + { name = "ruamel-yaml", marker = "python_version == '3.11' or python_version >= '3.12' or (python_version < '3.12' and (python_version < '3.11' or python_version > '3.11'))" }, +] +sdist = { url = "https://files.pythonhosted.org/packages/83/0d/b4e97cd99b26c0cd8265c9f19ee7e55248142f0c9955e4d119de96fa4a13/pre_commit_hooks-4.6.0.tar.gz", hash = "sha256:eb1f43ee67869cd41b4c59017fad4a0f9d4d61201d163f2135535aaf65035a2b", size = 29579 } +wheels = [ + { url = "https://files.pythonhosted.org/packages/95/d8/d09b270248bc2441f966dd094a3de8ae813112d2687036f621202bdef80b/pre_commit_hooks-4.6.0-py2.py3-none-any.whl", hash = "sha256:a69199e6a2d45ec59c1020a81ca1549abddc2afb798276d9a0d951752d6abbfe", size = 41193 }, +] + [[distribution]] name = "progressbar" version = "2.5" @@ -4882,6 +4895,42 @@ wheels = [ { url = "https://files.pythonhosted.org/packages/8c/28/92423fe9673b738c180fb5b6b8ea4203fe4b02c1d20b06b7fae79d11cc24/rerun_sdk-0.17.0-cp38-abi3-win_amd64.whl", hash = "sha256:34e5595a326cbdddfebdf00b08e877358c564fce74cc8c6d617fc89ef3a6aa70", size = 29490986 }, ] +[[distribution]] +name = "ruamel-yaml" +version = "0.18.6" +source = { registry = "https://pypi.org/simple" } +dependencies = [ + { name = "ruamel-yaml-clib", marker = "python_version < '3.13' and platform_python_implementation == 'CPython'" }, +] +sdist = { url = "https://files.pythonhosted.org/packages/29/81/4dfc17eb6ebb1aac314a3eb863c1325b907863a1b8b1382cdffcb6ac0ed9/ruamel.yaml-0.18.6.tar.gz", hash = "sha256:8b27e6a217e786c6fbe5634d8f3f11bc63e0f80f6a5890f28863d9c45aac311b", size = 143362 } +wheels = [ + { url = "https://files.pythonhosted.org/packages/73/67/8ece580cc363331d9a53055130f86b096bf16e38156e33b1d3014fffda6b/ruamel.yaml-0.18.6-py3-none-any.whl", hash = "sha256:57b53ba33def16c4f3d807c0ccbc00f8a6081827e81ba2491691b76882d0c636", size = 117761 }, +] + +[[distribution]] +name = "ruamel-yaml-clib" +version = "0.2.8" +source = { registry = "https://pypi.org/simple" } +sdist = { url = "https://files.pythonhosted.org/packages/46/ab/bab9eb1566cd16f060b54055dd39cf6a34bfa0240c53a7218c43e974295b/ruamel.yaml.clib-0.2.8.tar.gz", hash = "sha256:beb2e0404003de9a4cab9753a8805a8fe9320ee6673136ed7f04255fe60bb512", size = 213824 } +wheels = [ + { url = "https://files.pythonhosted.org/packages/b1/15/971b385c098e8d0d170893f5ba558452bb7b776a0c90658b8f4dd0e3382b/ruamel.yaml.clib-0.2.8-cp311-cp311-macosx_10_9_universal2.whl", hash = "sha256:bef08cd86169d9eafb3ccb0a39edb11d8e25f3dae2b28f5c52fd997521133069", size = 148870 }, + { url = "https://files.pythonhosted.org/packages/01/b0/4ddef56e9f703d7909febc3a421d709a3482cda25826816ec595b73e3847/ruamel.yaml.clib-0.2.8-cp311-cp311-macosx_13_0_arm64.whl", hash = "sha256:b16420e621d26fdfa949a8b4b47ade8810c56002f5389970db4ddda51dbff248", size = 134475 }, + { url = "https://files.pythonhosted.org/packages/a4/f7/22d6b620ed895a05d40802d8281eff924dc6190f682d933d4efff60db3b5/ruamel.yaml.clib-0.2.8-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl", hash = "sha256:25c515e350e5b739842fc3228d662413ef28f295791af5e5110b543cf0b57d9b", size = 544020 }, + { url = "https://files.pythonhosted.org/packages/7c/e4/0d19d65e340f93df1c47f323d95fa4b256bb28320290f5fddef90837853a/ruamel.yaml.clib-0.2.8-cp311-cp311-manylinux_2_24_aarch64.whl", hash = "sha256:1707814f0d9791df063f8c19bb51b0d1278b8e9a2353abbb676c2f685dee6afe", size = 642643 }, + { url = "https://files.pythonhosted.org/packages/c9/ff/f781eb5e2ae011e586d5426e2086a011cf1e0f59704a6cad1387975c5a62/ruamel.yaml.clib-0.2.8-cp311-cp311-musllinux_1_1_i686.whl", hash = "sha256:46d378daaac94f454b3a0e3d8d78cafd78a026b1d71443f4966c696b48a6d899", size = 695832 }, + { url = "https://files.pythonhosted.org/packages/e3/41/f62e67ac651358b8f0d60cfb12ab2daf99b1b69eeaa188d0cec809d943a6/ruamel.yaml.clib-0.2.8-cp311-cp311-musllinux_1_1_x86_64.whl", hash = "sha256:09b055c05697b38ecacb7ac50bdab2240bfca1a0c4872b0fd309bb07dc9aa3a9", size = 730923 }, + { url = "https://files.pythonhosted.org/packages/9f/f0/19ab8acbf983cd1b37f47d27ceb8b10a738d60d36316a54bad57e0d73fbb/ruamel.yaml.clib-0.2.8-cp311-cp311-win32.whl", hash = "sha256:53a300ed9cea38cf5a2a9b069058137c2ca1ce658a874b79baceb8f892f915a7", size = 99999 }, + { url = "https://files.pythonhosted.org/packages/ec/54/d8a795997921d87224c65d44499ca595a833093fb215b133f920c1062956/ruamel.yaml.clib-0.2.8-cp311-cp311-win_amd64.whl", hash = "sha256:c2a72e9109ea74e511e29032f3b670835f8a59bbdc9ce692c5b4ed91ccf1eedb", size = 118008 }, + { url = "https://files.pythonhosted.org/packages/7a/a2/eb5e9d088cb9d15c24d956944c09dca0a89108ad6e2e913c099ef36e3f0d/ruamel.yaml.clib-0.2.8-cp312-cp312-macosx_10_9_universal2.whl", hash = "sha256:ebc06178e8821efc9692ea7544aa5644217358490145629914d8020042c24aa1", size = 144636 }, + { url = "https://files.pythonhosted.org/packages/66/98/8de4f22bbfd9135deb3422e96d450c4bc0a57d38c25976119307d2efe0aa/ruamel.yaml.clib-0.2.8-cp312-cp312-macosx_13_0_arm64.whl", hash = "sha256:edaef1c1200c4b4cb914583150dcaa3bc30e592e907c01117c08b13a07255ec2", size = 135684 }, + { url = "https://files.pythonhosted.org/packages/30/d3/5fe978cd01a61c12efd24d65fa68c6f28f28c8073a06cf11db3a854390ca/ruamel.yaml.clib-0.2.8-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:d176b57452ab5b7028ac47e7b3cf644bcfdc8cacfecf7e71759f7f51a59e5c92", size = 734571 }, + { url = "https://files.pythonhosted.org/packages/55/b3/e2531a050758b717c969cbf76c103b75d8a01e11af931b94ba656117fbe9/ruamel.yaml.clib-0.2.8-cp312-cp312-manylinux_2_24_aarch64.whl", hash = "sha256:1dc67314e7e1086c9fdf2680b7b6c2be1c0d8e3a8279f2e993ca2a7545fecf62", size = 643946 }, + { url = "https://files.pythonhosted.org/packages/0d/aa/06db7ca0995b513538402e11280282c615b5ae5f09eb820460d35fb69715/ruamel.yaml.clib-0.2.8-cp312-cp312-musllinux_1_1_i686.whl", hash = "sha256:3213ece08ea033eb159ac52ae052a4899b56ecc124bb80020d9bbceeb50258e9", size = 692169 }, + { url = "https://files.pythonhosted.org/packages/27/38/4cf4d482b84ecdf51efae6635cc5483a83cf5ca9d9c13e205a750e251696/ruamel.yaml.clib-0.2.8-cp312-cp312-musllinux_1_1_x86_64.whl", hash = "sha256:aab7fd643f71d7946f2ee58cc88c9b7bfc97debd71dcc93e03e2d174628e7e2d", size = 740325 }, + { url = "https://files.pythonhosted.org/packages/6f/67/c62c6eea53a4feb042727a3d6c18f50dc99683c2b199c06bd2a9e3db8e22/ruamel.yaml.clib-0.2.8-cp312-cp312-win32.whl", hash = "sha256:5c365d91c88390c8d0a8545df0b5857172824b1c604e867161e6b3d59a827eaa", size = 98639 }, + { url = "https://files.pythonhosted.org/packages/10/d2/52a3d810d0b5b3720725c0504a27b3fced7b6f310fe928f7019d79387bc1/ruamel.yaml.clib-0.2.8-cp312-cp312-win_amd64.whl", hash = "sha256:1758ce7d8e1a29d23de54a16ae867abd370f01b5a69e1a3ba75223eaa3ca1a1b", size = 115305 }, +] + [[distribution]] name = "rubicon-objc" version = "0.4.9" From 3af774725f568ab2289fed92b820e89929950136 Mon Sep 17 00:00:00 2001 From: Maxime Desroches Date: Tue, 6 Aug 2024 21:48:56 -0700 Subject: [PATCH 2/5] Revert "pre-commit: bring back some checks (#33196)" (#33216) This reverts commit 30467b44cd82973576c8073136dede6aa2fa60f0. --- .github/workflows/selfdrive_tests.yaml | 26 ++++------- pyproject.toml | 8 +--- scripts/lint.sh | 64 ++------------------------ uv.lock | 49 -------------------- 4 files changed, 14 insertions(+), 133 deletions(-) diff --git a/.github/workflows/selfdrive_tests.yaml b/.github/workflows/selfdrive_tests.yaml index b0dbfbebee..8c46e15c2f 100644 --- a/.github/workflows/selfdrive_tests.yaml +++ b/.github/workflows/selfdrive_tests.yaml @@ -61,20 +61,13 @@ jobs: cd $STRIPPED_DIR ${{ env.RUN }} "release/check-dirty.sh && \ MAX_EXAMPLES=5 $PYTEST -m 'not slow' selfdrive/car" - - name: Getting modified files - timeout-minutes: 1 - run: | - cd $GITHUB_WORKSPACE - git fetch --unshallow --recurse-submodules=no origin master:master - ALL_FILES=$(git diff --name-only --cached --diff-filter=AM $(git merge-base HEAD master)) - echo FILES=$(echo $ALL_FILES) >> $GITHUB_ENV - - name: Static analysis + - name: static analysis timeout-minutes: 1 run: | cd $GITHUB_WORKSPACE cp pyproject.toml $STRIPPED_DIR cd $STRIPPED_DIR - ${{ env.RUN }} "scripts/lint.sh $FILES" + ${{ env.RUN }} "scripts/lint.sh" build: strategy: @@ -147,17 +140,16 @@ jobs: runs-on: ${{ ((github.repository == 'commaai/openpilot') && ((github.event_name != 'pull_request') || (github.event.pull_request.head.repo.full_name == 'commaai/openpilot'))) && 'namespace-profile-amd64-8x16' || 'ubuntu-latest' }} - env: - PYTHONWARNINGS: default steps: - uses: actions/checkout@v4 - - name: Setup - run: tools/op.sh setup - - name: Get ancestor commit - run: git fetch --unshallow --recurse-submodules=no origin master:master - - name: Static analysis + with: + submodules: true + - uses: ./.github/workflows/setup-with-retry + - name: Build openpilot + run: ${{ env.RUN }} "scons -j$(nproc)" + - name: static analysis timeout-minutes: 1 - run: tools/op.sh lint + run: ${{ env.RUN }} "scripts/lint.sh" unit_tests: name: unit tests diff --git a/pyproject.toml b/pyproject.toml index 56eafc954b..24ec80e787 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -88,7 +88,6 @@ testing = [ "pytest-repeat", "ruff", "codespell", - "pre-commit-hooks", ] dev = [ @@ -178,11 +177,9 @@ plugins = [ "numpy.typing.mypy_plugin", ] exclude = [ + "body/", "cereal/", - "msgq/", - "msgq_repo/", "opendbc/", - "opendbc_repo/", "panda/", "rednose/", "rednose_repo/", @@ -207,9 +204,6 @@ warn_return_any=true # allow implicit optionals for default args implicit_optional = true -local_partial_types=true -explicit_package_bases=true - # https://beta.ruff.rs/docs/configuration/#using-pyprojecttoml [tool.ruff] indent-width = 2 diff --git a/scripts/lint.sh b/scripts/lint.sh index d766961cd1..3da79f62f4 100755 --- a/scripts/lint.sh +++ b/scripts/lint.sh @@ -1,67 +1,11 @@ #!/bin/bash set -e -RED='\033[0;31m' -GREEN='\033[0;32m' -NC='\033[0m' - DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null && pwd )" cd $DIR/../ -FAILED=0 - -IGNORED_FILES="uv\.lock|docs\/CARS.md" - -function run() { - echo -en "$1" - - for ((i=0; i<$((50 - ${#1})); i++)); do - echo -n "." - done - - shift 1; - CMD="$@" - - set +e - log="$((eval "$CMD" ) 2>&1)" - - if [[ $? -eq 0 ]]; then - echo -e "[${GREEN}✔${NC}]" - else - echo -e "[${RED}✗${NC}]" - echo "$log" - FAILED=1 - fi - set -e -} - -function run_tests() { - ALL_FILES=$(echo "$@" | sed -E "s/$IGNORED_FILES//g") - PYTHON_FILES=$(echo "$ALL_FILES" | grep --color=never '.py$' || true) - - if [[ -n "$PYTHON_FILES" ]]; then - run "ruff" ruff check $PYTHON_FILES --quiet - run "mypy" mypy $PYTHON_FILES - run "Import check" lint-imports - fi - - if [[ -n "$ALL_FILES" ]]; then - run "Codespell" codespell $ALL_FILES - run "Large files check" python3 -m pre_commit_hooks.check_added_large_files --enforce-all $ALL_FILES --maxkb=120 - run "Shebang check" python3 -m pre_commit_hooks.check_shebang_scripts_are_executable $ALL_FILES - fi - - return $FAILED -} +# TODO: bring back rest of pre-commit checks: +# https://github.com/commaai/openpilot/blob/4b11c9e914707df9def598616995be2a5d355a6a/.pre-commit-config.yaml#L2 -if [[ -n $@ ]]; then - VALID_FILES="" - for f in $@; do - if [[ -f "$f" ]]; then - VALID_FILES+="$f"$'\n' - fi - done - run_tests "$VALID_FILES" -else - run_tests "$(git diff --name-only --cached --diff-filter=AM $(git merge-base HEAD master))" -fi +ruff check . +lint-imports diff --git a/uv.lock b/uv.lock index b5a734f300..bca0895ebf 100644 --- a/uv.lock +++ b/uv.lock @@ -1454,7 +1454,6 @@ testing = [ { name = "hypothesis", marker = "python_version == '3.11' or python_version >= '3.12' or (python_version < '3.12' and (python_version < '3.11' or python_version > '3.11'))" }, { name = "import-linter", marker = "python_version == '3.11' or python_version >= '3.12' or (python_version < '3.12' and (python_version < '3.11' or python_version > '3.11'))" }, { name = "mypy", marker = "python_version == '3.11' or python_version >= '3.12' or (python_version < '3.12' and (python_version < '3.11' or python_version > '3.11'))" }, - { name = "pre-commit-hooks", marker = "python_version == '3.11' or python_version >= '3.12' or (python_version < '3.12' and (python_version < '3.11' or python_version > '3.11'))" }, { name = "pytest", marker = "python_version == '3.11' or python_version >= '3.12' or (python_version < '3.12' and (python_version < '3.11' or python_version > '3.11'))" }, { name = "pytest-asyncio", marker = "python_version == '3.11' or python_version >= '3.12' or (python_version < '3.12' and (python_version < '3.11' or python_version > '3.11'))" }, { name = "pytest-cov", marker = "python_version == '3.11' or python_version >= '3.12' or (python_version < '3.12' and (python_version < '3.11' or python_version > '3.11'))" }, @@ -1638,18 +1637,6 @@ wheels = [ { url = "https://files.pythonhosted.org/packages/9b/fb/a70a4214956182e0d7a9099ab17d50bfcba1056188e9b14f35b9e2b62a0d/portalocker-2.10.1-py3-none-any.whl", hash = "sha256:53a5984ebc86a025552264b459b46a2086e269b21823cb572f8f28ee759e45bf", size = 18423 }, ] -[[distribution]] -name = "pre-commit-hooks" -version = "4.6.0" -source = { registry = "https://pypi.org/simple" } -dependencies = [ - { name = "ruamel-yaml", marker = "python_version == '3.11' or python_version >= '3.12' or (python_version < '3.12' and (python_version < '3.11' or python_version > '3.11'))" }, -] -sdist = { url = "https://files.pythonhosted.org/packages/83/0d/b4e97cd99b26c0cd8265c9f19ee7e55248142f0c9955e4d119de96fa4a13/pre_commit_hooks-4.6.0.tar.gz", hash = "sha256:eb1f43ee67869cd41b4c59017fad4a0f9d4d61201d163f2135535aaf65035a2b", size = 29579 } -wheels = [ - { url = "https://files.pythonhosted.org/packages/95/d8/d09b270248bc2441f966dd094a3de8ae813112d2687036f621202bdef80b/pre_commit_hooks-4.6.0-py2.py3-none-any.whl", hash = "sha256:a69199e6a2d45ec59c1020a81ca1549abddc2afb798276d9a0d951752d6abbfe", size = 41193 }, -] - [[distribution]] name = "progressbar" version = "2.5" @@ -4895,42 +4882,6 @@ wheels = [ { url = "https://files.pythonhosted.org/packages/8c/28/92423fe9673b738c180fb5b6b8ea4203fe4b02c1d20b06b7fae79d11cc24/rerun_sdk-0.17.0-cp38-abi3-win_amd64.whl", hash = "sha256:34e5595a326cbdddfebdf00b08e877358c564fce74cc8c6d617fc89ef3a6aa70", size = 29490986 }, ] -[[distribution]] -name = "ruamel-yaml" -version = "0.18.6" -source = { registry = "https://pypi.org/simple" } -dependencies = [ - { name = "ruamel-yaml-clib", marker = "python_version < '3.13' and platform_python_implementation == 'CPython'" }, -] -sdist = { url = "https://files.pythonhosted.org/packages/29/81/4dfc17eb6ebb1aac314a3eb863c1325b907863a1b8b1382cdffcb6ac0ed9/ruamel.yaml-0.18.6.tar.gz", hash = "sha256:8b27e6a217e786c6fbe5634d8f3f11bc63e0f80f6a5890f28863d9c45aac311b", size = 143362 } -wheels = [ - { url = "https://files.pythonhosted.org/packages/73/67/8ece580cc363331d9a53055130f86b096bf16e38156e33b1d3014fffda6b/ruamel.yaml-0.18.6-py3-none-any.whl", hash = "sha256:57b53ba33def16c4f3d807c0ccbc00f8a6081827e81ba2491691b76882d0c636", size = 117761 }, -] - -[[distribution]] -name = "ruamel-yaml-clib" -version = "0.2.8" -source = { registry = "https://pypi.org/simple" } -sdist = { url = "https://files.pythonhosted.org/packages/46/ab/bab9eb1566cd16f060b54055dd39cf6a34bfa0240c53a7218c43e974295b/ruamel.yaml.clib-0.2.8.tar.gz", hash = "sha256:beb2e0404003de9a4cab9753a8805a8fe9320ee6673136ed7f04255fe60bb512", size = 213824 } -wheels = [ - { url = "https://files.pythonhosted.org/packages/b1/15/971b385c098e8d0d170893f5ba558452bb7b776a0c90658b8f4dd0e3382b/ruamel.yaml.clib-0.2.8-cp311-cp311-macosx_10_9_universal2.whl", hash = "sha256:bef08cd86169d9eafb3ccb0a39edb11d8e25f3dae2b28f5c52fd997521133069", size = 148870 }, - { url = "https://files.pythonhosted.org/packages/01/b0/4ddef56e9f703d7909febc3a421d709a3482cda25826816ec595b73e3847/ruamel.yaml.clib-0.2.8-cp311-cp311-macosx_13_0_arm64.whl", hash = "sha256:b16420e621d26fdfa949a8b4b47ade8810c56002f5389970db4ddda51dbff248", size = 134475 }, - { url = "https://files.pythonhosted.org/packages/a4/f7/22d6b620ed895a05d40802d8281eff924dc6190f682d933d4efff60db3b5/ruamel.yaml.clib-0.2.8-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl", hash = "sha256:25c515e350e5b739842fc3228d662413ef28f295791af5e5110b543cf0b57d9b", size = 544020 }, - { url = "https://files.pythonhosted.org/packages/7c/e4/0d19d65e340f93df1c47f323d95fa4b256bb28320290f5fddef90837853a/ruamel.yaml.clib-0.2.8-cp311-cp311-manylinux_2_24_aarch64.whl", hash = "sha256:1707814f0d9791df063f8c19bb51b0d1278b8e9a2353abbb676c2f685dee6afe", size = 642643 }, - { url = "https://files.pythonhosted.org/packages/c9/ff/f781eb5e2ae011e586d5426e2086a011cf1e0f59704a6cad1387975c5a62/ruamel.yaml.clib-0.2.8-cp311-cp311-musllinux_1_1_i686.whl", hash = "sha256:46d378daaac94f454b3a0e3d8d78cafd78a026b1d71443f4966c696b48a6d899", size = 695832 }, - { url = "https://files.pythonhosted.org/packages/e3/41/f62e67ac651358b8f0d60cfb12ab2daf99b1b69eeaa188d0cec809d943a6/ruamel.yaml.clib-0.2.8-cp311-cp311-musllinux_1_1_x86_64.whl", hash = "sha256:09b055c05697b38ecacb7ac50bdab2240bfca1a0c4872b0fd309bb07dc9aa3a9", size = 730923 }, - { url = "https://files.pythonhosted.org/packages/9f/f0/19ab8acbf983cd1b37f47d27ceb8b10a738d60d36316a54bad57e0d73fbb/ruamel.yaml.clib-0.2.8-cp311-cp311-win32.whl", hash = "sha256:53a300ed9cea38cf5a2a9b069058137c2ca1ce658a874b79baceb8f892f915a7", size = 99999 }, - { url = "https://files.pythonhosted.org/packages/ec/54/d8a795997921d87224c65d44499ca595a833093fb215b133f920c1062956/ruamel.yaml.clib-0.2.8-cp311-cp311-win_amd64.whl", hash = "sha256:c2a72e9109ea74e511e29032f3b670835f8a59bbdc9ce692c5b4ed91ccf1eedb", size = 118008 }, - { url = "https://files.pythonhosted.org/packages/7a/a2/eb5e9d088cb9d15c24d956944c09dca0a89108ad6e2e913c099ef36e3f0d/ruamel.yaml.clib-0.2.8-cp312-cp312-macosx_10_9_universal2.whl", hash = "sha256:ebc06178e8821efc9692ea7544aa5644217358490145629914d8020042c24aa1", size = 144636 }, - { url = "https://files.pythonhosted.org/packages/66/98/8de4f22bbfd9135deb3422e96d450c4bc0a57d38c25976119307d2efe0aa/ruamel.yaml.clib-0.2.8-cp312-cp312-macosx_13_0_arm64.whl", hash = "sha256:edaef1c1200c4b4cb914583150dcaa3bc30e592e907c01117c08b13a07255ec2", size = 135684 }, - { url = "https://files.pythonhosted.org/packages/30/d3/5fe978cd01a61c12efd24d65fa68c6f28f28c8073a06cf11db3a854390ca/ruamel.yaml.clib-0.2.8-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:d176b57452ab5b7028ac47e7b3cf644bcfdc8cacfecf7e71759f7f51a59e5c92", size = 734571 }, - { url = "https://files.pythonhosted.org/packages/55/b3/e2531a050758b717c969cbf76c103b75d8a01e11af931b94ba656117fbe9/ruamel.yaml.clib-0.2.8-cp312-cp312-manylinux_2_24_aarch64.whl", hash = "sha256:1dc67314e7e1086c9fdf2680b7b6c2be1c0d8e3a8279f2e993ca2a7545fecf62", size = 643946 }, - { url = "https://files.pythonhosted.org/packages/0d/aa/06db7ca0995b513538402e11280282c615b5ae5f09eb820460d35fb69715/ruamel.yaml.clib-0.2.8-cp312-cp312-musllinux_1_1_i686.whl", hash = "sha256:3213ece08ea033eb159ac52ae052a4899b56ecc124bb80020d9bbceeb50258e9", size = 692169 }, - { url = "https://files.pythonhosted.org/packages/27/38/4cf4d482b84ecdf51efae6635cc5483a83cf5ca9d9c13e205a750e251696/ruamel.yaml.clib-0.2.8-cp312-cp312-musllinux_1_1_x86_64.whl", hash = "sha256:aab7fd643f71d7946f2ee58cc88c9b7bfc97debd71dcc93e03e2d174628e7e2d", size = 740325 }, - { url = "https://files.pythonhosted.org/packages/6f/67/c62c6eea53a4feb042727a3d6c18f50dc99683c2b199c06bd2a9e3db8e22/ruamel.yaml.clib-0.2.8-cp312-cp312-win32.whl", hash = "sha256:5c365d91c88390c8d0a8545df0b5857172824b1c604e867161e6b3d59a827eaa", size = 98639 }, - { url = "https://files.pythonhosted.org/packages/10/d2/52a3d810d0b5b3720725c0504a27b3fced7b6f310fe928f7019d79387bc1/ruamel.yaml.clib-0.2.8-cp312-cp312-win_amd64.whl", hash = "sha256:1758ce7d8e1a29d23de54a16ae867abd370f01b5a69e1a3ba75223eaa3ca1a1b", size = 115305 }, -] - [[distribution]] name = "rubicon-objc" version = "0.4.9" From ba7a60c5a20c5f252bc89ba3e2559edf5ab65c59 Mon Sep 17 00:00:00 2001 From: Shane Smiskol Date: Wed, 7 Aug 2024 02:05:32 -0500 Subject: [PATCH 3/5] remove CAN capnp conversion from car interfaces (#33218) remove pandad from interfaces --- .importlinter | 1 - selfdrive/car/card.py | 4 ++-- selfdrive/car/interfaces.py | 6 ++---- selfdrive/car/tests/test_models.py | 8 ++++---- 4 files changed, 8 insertions(+), 11 deletions(-) diff --git a/.importlinter b/.importlinter index f2d1d4f2b0..e510ee91fb 100644 --- a/.importlinter +++ b/.importlinter @@ -38,7 +38,6 @@ ignore_imports = openpilot.selfdrive.car.ecu_addrs -> openpilot.common.params # requires generic CAN send/receive functions openpilot.selfdrive.car.ecu_addrs -> openpilot.selfdrive.pandad - openpilot.selfdrive.car.interfaces -> openpilot.selfdrive.pandad openpilot.selfdrive.car.isotp_parallel_query -> openpilot.selfdrive.pandad openpilot.selfdrive.car.tests.test_fw_fingerprint -> openpilot.selfdrive.pandad diff --git a/selfdrive/car/card.py b/selfdrive/car/card.py index e878a14c31..a8afa0dec9 100755 --- a/selfdrive/car/card.py +++ b/selfdrive/car/card.py @@ -12,7 +12,7 @@ from openpilot.common.params import Params from openpilot.common.realtime import config_realtime_process, Priority, Ratekeeper from openpilot.common.swaglog import cloudlog, ForwardingHandler -from openpilot.selfdrive.pandad import can_list_to_can_capnp +from openpilot.selfdrive.pandad import can_capnp_to_list, can_list_to_can_capnp from openpilot.selfdrive.car import DT_CTRL, carlog from openpilot.selfdrive.car.car_helpers import get_car, get_one_can from openpilot.selfdrive.car.interfaces import CarInterfaceBase @@ -108,7 +108,7 @@ class Car: # Update carState from CAN can_strs = messaging.drain_sock_raw(self.can_sock, wait_for_one=True) - CS = self.CI.update(self.CC_prev, can_strs) + CS = self.CI.update(self.CC_prev, can_capnp_to_list(can_strs)) self.sm.update(0) diff --git a/selfdrive/car/interfaces.py b/selfdrive/car/interfaces.py index 90d50f0903..68f7f1ec24 100644 --- a/selfdrive/car/interfaces.py +++ b/selfdrive/car/interfaces.py @@ -16,7 +16,6 @@ from openpilot.selfdrive.car.conversions import Conversions as CV from openpilot.selfdrive.car.helpers import clip from openpilot.selfdrive.car.values import PLATFORMS from openpilot.selfdrive.controls.lib.events import Events -from openpilot.selfdrive.pandad import can_capnp_to_list ButtonType = car.CarState.ButtonEvent.Type GearShifter = car.CarState.GearShifter @@ -229,12 +228,11 @@ class CarInterfaceBase(ABC): def _update(self, c: car.CarControl) -> car.CarState: pass - def update(self, c: car.CarControl, can_strings: list[bytes]) -> car.CarState: + def update(self, c: car.CarControl, can_packets: list[int, list[int, bytes, int]]) -> car.CarState: # parse can - can_list = can_capnp_to_list(can_strings) for cp in self.can_parsers: if cp is not None: - cp.update_strings(can_list) + cp.update_strings(can_packets) # get CarState ret = self._update(c) diff --git a/selfdrive/car/tests/test_models.py b/selfdrive/car/tests/test_models.py index 22a80f359a..f57def0362 100644 --- a/selfdrive/car/tests/test_models.py +++ b/selfdrive/car/tests/test_models.py @@ -217,7 +217,7 @@ class TestCarModelBase(unittest.TestCase): CC = car.CarControl.new_message().as_reader() for i, msg in enumerate(self.can_msgs): - CS = self.CI.update(CC, (msg.as_builder().to_bytes(),)) + CS = self.CI.update(CC, can_capnp_to_list((msg.as_builder().to_bytes(),))) self.CI.apply(CC, msg.logMonoTime) if CS.canValid: @@ -358,7 +358,7 @@ class TestCarModelBase(unittest.TestCase): can = messaging.new_message('can', 1) can.can = [log.CanData(address=address, dat=dat, src=bus)] - CS = self.CI.update(CC, (can.to_bytes(),)) + CS = self.CI.update(CC, can_capnp_to_list((can.to_bytes(),))) if self.safety.get_gas_pressed_prev() != prev_panda_gas: self.assertEqual(CS.gasPressed, self.safety.get_gas_pressed_prev()) @@ -397,7 +397,7 @@ class TestCarModelBase(unittest.TestCase): # warm up pass, as initial states may be different for can in self.can_msgs[:300]: - self.CI.update(CC, (can.as_builder().to_bytes(), )) + self.CI.update(CC, can_capnp_to_list((can.as_builder().to_bytes(), ))) for msg in filter(lambda m: m.src in range(64), can.can): to_send = libpanda_py.make_CANPacket(msg.address, msg.src % 4, msg.dat) self.safety.safety_rx_hook(to_send) @@ -407,7 +407,7 @@ class TestCarModelBase(unittest.TestCase): checks = defaultdict(int) card = Car(CI=self.CI) for idx, can in enumerate(self.can_msgs): - CS = self.CI.update(CC, (can.as_builder().to_bytes(), )) + CS = self.CI.update(CC, can_capnp_to_list((can.as_builder().to_bytes(), ))) for msg in filter(lambda m: m.src in range(64), can.can): to_send = libpanda_py.make_CANPacket(msg.address, msg.src % 4, msg.dat) ret = self.safety.safety_rx_hook(to_send) From 184519834c99291ddbaa0f92842bda3ab89d797d Mon Sep 17 00:00:00 2001 From: Maxime Desroches Date: Wed, 7 Aug 2024 16:02:09 -0700 Subject: [PATCH 4/5] more codespell errors (#33223) more spell --- .github/workflows/ci_weekly_report.yaml | 6 +++--- pyproject.toml | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/ci_weekly_report.yaml b/.github/workflows/ci_weekly_report.yaml index 22b8745872..9821283cb5 100644 --- a/.github/workflows/ci_weekly_report.yaml +++ b/.github/workflows/ci_weekly_report.yaml @@ -58,14 +58,14 @@ jobs: const jobName = job.name.split(" / ")[2]; const runRegex = /\((.*?)\)/; const run = job.name.match(runRegex)[1]; - report[jobName] = report[jobName] || { successes: [], failures: [], cancelled: [] }; + report[jobName] = report[jobName] || { successes: [], failures: [], canceled: [] }; switch (job.conclusion) { case "success": report[jobName].successes.push({ "run_number": run, "link": job.html_url}); break; case "failure": report[jobName].failures.push({ "run_number": run, "link": job.html_url }); break; - case "cancelled": - report[jobName].cancelled.push({ "run_number": run, "link": job.html_url }); break; + case "canceled": + report[jobName].canceled.push({ "run_number": run, "link": job.html_url }); break; } }); return JSON.stringify({"jobs": report}); diff --git a/pyproject.toml b/pyproject.toml index 24ec80e787..b311a854dc 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -167,7 +167,7 @@ testpaths = [ [tool.codespell] quiet-level = 3 # if you've got a short variable name that's getting flagged, add it here -ignore-words-list = "bu,ro,te,ue,alo,hda,ois,nam,nams,ned,som,parm,setts,inout,warmup,bumb,nd,sie,preints,whit,indexIn,ws,uint,grey,deque,stdio,amin,BA,LITE,atEnd,UIs,errorString,arange,FocusIn,od,tim,relA,hist,copyable" +ignore-words-list = "bu,ro,te,ue,alo,hda,ois,nam,nams,ned,som,parm,setts,inout,warmup,bumb,nd,sie,preints,whit,indexIn,ws,uint,grey,deque,stdio,amin,BA,LITE,atEnd,UIs,errorString,arange,FocusIn,od,tim,relA,hist,copyable,jupyter,thead" builtin = "clear,rare,informal,code,names,en-GB_to_en-US" skip = "./third_party/*, ./tinygrad/*, ./tinygrad_repo/*, ./msgq/*, ./panda/*, ./opendbc/*, ./opendbc_repo/*, ./rednose/*, ./rednose_repo/*, ./teleoprtc/*, ./teleoprtc_repo/*, ./selfdrive/ui/translations/*.ts, uv.lock, *.onnx, ./cereal/gen/*, */c_generated_code/*" From 51bd3682148ce7a00ac76281d76c278716a1c24a Mon Sep 17 00:00:00 2001 From: Shane Smiskol Date: Wed, 7 Aug 2024 18:12:00 -0500 Subject: [PATCH 5/5] make_can_msg: returns tuple (#33222) * bump * make_man_msg returns tuple * fix CI.update typing * bump * better name * Revert "better name" This reverts commit 4deb38d4ed99e43721960f69da1dd46a1069eb42. * common --- opendbc_repo | 2 +- selfdrive/car/__init__.py | 6 ++++-- selfdrive/car/interfaces.py | 10 +++++----- selfdrive/car/isotp_parallel_query.py | 4 ++-- selfdrive/pandad/pandad_api_impl.pyx | 4 ++-- 5 files changed, 14 insertions(+), 12 deletions(-) diff --git a/opendbc_repo b/opendbc_repo index 1e9f853615..f4d077b832 160000 --- a/opendbc_repo +++ b/opendbc_repo @@ -1 +1 @@ -Subproject commit 1e9f8536151818f08af2ddd478f577f8461af31d +Subproject commit f4d077b832d46ac149c2b07dc37d777dc21237ea diff --git a/selfdrive/car/__init__.py b/selfdrive/car/__init__.py index 1da53d4cfa..fa69b75e9f 100644 --- a/selfdrive/car/__init__.py +++ b/selfdrive/car/__init__.py @@ -12,6 +12,8 @@ from panda.python.uds import SERVICE_TYPE from openpilot.selfdrive.car.docs_definitions import CarDocs from openpilot.selfdrive.car.helpers import clip, interp +CanMsgType = tuple[int, bytes, int] + # set up logging carlog = logging.getLogger('carlog') carlog.setLevel(logging.INFO) @@ -193,8 +195,8 @@ def get_friction(lateral_accel_error: float, lateral_accel_deadzone: float, fric return friction -def make_can_msg(addr, dat, bus): - return [addr, dat, bus] +def make_can_msg(addr: int, dat: bytes, bus: int) -> CanMsgType: + return addr, dat, bus def make_tester_present_msg(addr, bus, subaddr=None, suppress_response=False): diff --git a/selfdrive/car/interfaces.py b/selfdrive/car/interfaces.py index 68f7f1ec24..f02990f6b5 100644 --- a/selfdrive/car/interfaces.py +++ b/selfdrive/car/interfaces.py @@ -11,7 +11,8 @@ from functools import cache from cereal import car from openpilot.common.basedir import BASEDIR from openpilot.common.simple_kalman import KF1D, get_kalman_gain -from openpilot.selfdrive.car import DT_CTRL, apply_hysteresis, gen_empty_fingerprint, scale_rot_inertia, scale_tire_stiffness, get_friction, STD_CARGO_KG +from openpilot.selfdrive.car import CanMsgType, DT_CTRL, apply_hysteresis, gen_empty_fingerprint, scale_rot_inertia, scale_tire_stiffness, get_friction, \ + STD_CARGO_KG from openpilot.selfdrive.car.conversions import Conversions as CV from openpilot.selfdrive.car.helpers import clip from openpilot.selfdrive.car.values import PLATFORMS @@ -51,7 +52,6 @@ class LatControlInputs(NamedTuple): aego: float -SendCan = tuple[int, bytes, int] TorqueFromLateralAccelCallbackType = Callable[[LatControlInputs, car.CarParams.LateralTorqueTuning, float, float, bool, bool], float] @@ -108,7 +108,7 @@ class CarInterfaceBase(ABC): dbc_name = "" if self.cp is None else self.cp.dbc_name self.CC: CarControllerBase = CarController(dbc_name, CP) - def apply(self, c: car.CarControl, now_nanos: int) -> tuple[car.CarControl.Actuators, list[SendCan]]: + def apply(self, c: car.CarControl, now_nanos: int) -> tuple[car.CarControl.Actuators, list[CanMsgType]]: return self.CC.update(c, self.CS, now_nanos) @staticmethod @@ -228,7 +228,7 @@ class CarInterfaceBase(ABC): def _update(self, c: car.CarControl) -> car.CarState: pass - def update(self, c: car.CarControl, can_packets: list[int, list[int, bytes, int]]) -> car.CarState: + def update(self, c: car.CarControl, can_packets: list[tuple[int, list[CanMsgType]]]) -> car.CarState: # parse can for cp in self.can_parsers: if cp is not None: @@ -467,7 +467,7 @@ class CarControllerBase(ABC): self.frame = 0 @abstractmethod - def update(self, CC: car.CarControl.Actuators, CS: car.CarState, now_nanos: int) -> tuple[car.CarControl.Actuators, list[SendCan]]: + def update(self, CC: car.CarControl.Actuators, CS: car.CarState, now_nanos: int) -> tuple[car.CarControl.Actuators, list[CanMsgType]]: pass diff --git a/selfdrive/car/isotp_parallel_query.py b/selfdrive/car/isotp_parallel_query.py index c5f74a8156..cb7a1da7fa 100644 --- a/selfdrive/car/isotp_parallel_query.py +++ b/selfdrive/car/isotp_parallel_query.py @@ -3,7 +3,7 @@ from collections import defaultdict from functools import partial import cereal.messaging as messaging -from openpilot.selfdrive.car import carlog +from openpilot.selfdrive.car import carlog, CanMsgType from openpilot.selfdrive.car.fw_query_definitions import AddrType from openpilot.selfdrive.pandad import can_list_to_can_capnp from panda.python.uds import CanClient, IsoTpMessage, FUNCTIONAL_ADDRS, get_rx_addr_for_tx_addr @@ -27,7 +27,7 @@ class IsoTpParallelQuery: assert tx_addr not in FUNCTIONAL_ADDRS, f"Functional address should be defined in functional_addrs: {hex(tx_addr)}" self.msg_addrs = {tx_addr: get_rx_addr_for_tx_addr(tx_addr[0], rx_offset=response_offset) for tx_addr in real_addrs} - self.msg_buffer: dict[int, list[tuple[int, bytes, int]]] = defaultdict(list) + self.msg_buffer: dict[int, list[CanMsgType]] = defaultdict(list) def rx(self): """Drain can socket and sort messages into buffers based on address""" diff --git a/selfdrive/pandad/pandad_api_impl.pyx b/selfdrive/pandad/pandad_api_impl.pyx index 8a12e1c433..787968f53e 100644 --- a/selfdrive/pandad/pandad_api_impl.pyx +++ b/selfdrive/pandad/pandad_api_impl.pyx @@ -50,7 +50,7 @@ def can_capnp_to_list(strings, msgtype='can'): cdef vector[CanData].iterator it = data.begin() while it != data.end(): d = &deref(it) - frames = [[f.address, (&f.dat[0])[:f.dat.size()], f.src] for f in d.frames] - result.append([d.nanos, frames]) + frames = [(f.address, (&f.dat[0])[:f.dat.size()], f.src) for f in d.frames] + result.append((d.nanos, frames)) preinc(it) return result