Skip to content

Commit a8efbc5

Browse files
authored
CI - enforce lint and type checks for benchmarks (#7828)
- check/pylint - enforce pylint for benchmarks - pylint - add missing copyright notice - check/mypy - enforce type check for benchmarks - Skip type-check for ASV benchmark scripts Not worth fixing as these will be replaced by pytest-benchmark-s. Related to #7796
1 parent e96726a commit a8efbc5

File tree

9 files changed

+31
-2
lines changed

9 files changed

+31
-2
lines changed

benchmarks/bench_linalg_decompositions.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
1414

15+
# mypy: ignore-errors
16+
1517
import numpy as np
1618

1719
import cirq

benchmarks/circuit_construction.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,9 @@
1111
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
14+
15+
# mypy: ignore-errors
16+
1417
import itertools
1518
from collections.abc import Sequence
1619

benchmarks/dynamical_decoupling_perf.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,17 @@
1+
# Copyright 2025 The Cirq Developers
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# https://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
115
import itertools
216

317
import pytest

benchmarks/randomized_benchmarking.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
1414

15+
# mypy: ignore-errors
16+
1517
import functools
1618
from collections.abc import Sequence
1719

benchmarks/serialization.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
1414

15+
# mypy: ignore-errors
16+
1517
import cirq
1618

1719

benchmarks/transformers/routing.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
1414

15+
# mypy: ignore-errors
16+
1517
import cirq
1618

1719

benchmarks/transformers/transformer_primitives.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
1414

15+
# mypy: ignore-errors
16+
1517
import cirq
1618

1719

check/mypy

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,8 @@ read -r -a CIRQ_PACKAGES < \
1818
<(env PYTHONPATH=. python dev_tools/modules.py list --mode package-path)
1919

2020
echo -e -n "\033[31m"
21-
mypy --config-file=dev_tools/conf/$CONFIG_FILE "$@" "${CIRQ_PACKAGES[@]}" dev_tools examples
21+
mypy --config-file=dev_tools/conf/$CONFIG_FILE "$@" \
22+
"${CIRQ_PACKAGES[@]}" benchmarks dev_tools examples
2223
result=$?
2324
echo -e -n "\033[0m"
2425

check/pylint

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,4 +16,5 @@ read -r -a CIRQ_MODULES < \
1616
<(env PYTHONPATH=. python dev_tools/modules.py list --mode package-path)
1717

1818
# Add dev_tools to $PYTHONPATH so that pylint can find custom checkers
19-
env PYTHONPATH=dev_tools pylint --jobs=0 --rcfile=dev_tools/conf/.pylintrc "$@" "${CIRQ_MODULES[@]}" dev_tools examples
19+
env PYTHONPATH=dev_tools pylint --jobs=0 --rcfile=dev_tools/conf/.pylintrc "$@" \
20+
"${CIRQ_MODULES[@]}" benchmarks dev_tools examples

0 commit comments

Comments
 (0)