Skip to content

Commit 98f8b37

Browse files
authored
Put back clang formatting, via pre-commit this time (#9160)
1 parent c01e115 commit 98f8b37

File tree

11 files changed

+50
-382
lines changed

11 files changed

+50
-382
lines changed

.github/scripts/run-clang-format.py

Lines changed: 0 additions & 331 deletions
This file was deleted.

.github/workflows/lint.yml

Lines changed: 0 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -40,36 +40,6 @@ jobs:
4040
exit 1
4141
fi
4242
43-
# c-source:
44-
# uses: pytorch/test-infra/.github/workflows/linux_job_v2.yml@main
45-
# permissions:
46-
# id-token: write
47-
# contents: read
48-
# with:
49-
# repository: pytorch/vision
50-
# test-infra-ref: main
51-
# script: |
52-
# set -euo pipefail
53-
54-
# echo '::group::Setup environment'
55-
# CONDA_PATH=$(which conda)
56-
# eval "$(${CONDA_PATH} shell.bash hook)"
57-
# conda create --name ci --quiet --yes -c conda-forge python=3.9 clang-format
58-
# conda activate ci
59-
# echo '::endgroup::'
60-
61-
62-
# echo '::group::Lint C source'
63-
# set +e
64-
# ./.github/scripts/run-clang-format.py -r torchvision/csrc --exclude "torchvision/csrc/io/image/cpu/giflib/*"
65-
66-
# if [ $? -ne 0 ]; then
67-
# git --no-pager diff
68-
# exit 1
69-
# fi
70-
# echo '::endgroup::'
71-
72-
7343
python-types:
7444
uses: pytorch/test-infra/.github/workflows/linux_job_v2.yml@main
7545
permissions:

.pre-commit-config.yaml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,3 +30,12 @@ repos:
3030
rev: 6.1.1
3131
hooks:
3232
- id: pydocstyle
33+
34+
- repo: https://github.com/pre-commit/mirrors-clang-format
35+
rev: v18.1.3
36+
hooks:
37+
- id: clang-format
38+
name: clang-format
39+
files: \.(cpp|hpp|c|h|cu)$
40+
types: [file]
41+
exclude: ^torchvision/csrc/io/image/cpu/giflib/

torchvision/csrc/io/decoder/gpu/gpu_decoder.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,8 @@ void GPUDecoder::seek(double timestamp, bool keyframes_only) {
4646
demuxer.seek(timestamp, flag);
4747
}
4848

49-
c10::Dict<std::string, c10::Dict<std::string, double>>
50-
GPUDecoder::get_metadata() const {
49+
c10::Dict<std::string, c10::Dict<std::string, double>> GPUDecoder::
50+
get_metadata() const {
5151
c10::Dict<std::string, c10::Dict<std::string, double>> metadata;
5252
c10::Dict<std::string, double> video_metadata;
5353
video_metadata.insert("duration", demuxer.get_duration());

0 commit comments

Comments
 (0)