Skip to content

Commit

Permalink
Check for print statements in code (#130)
Browse files Browse the repository at this point in the history
  • Loading branch information
MarcSerraPeralta authored Oct 31, 2024
1 parent e0207a2 commit 77a139e
Show file tree
Hide file tree
Showing 7 changed files with 24 additions and 9 deletions.
2 changes: 2 additions & 0 deletions .flake8
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[flake8]
select = T201, T203, T204 # T002 is the specific code for print statements in flake8-print
6 changes: 2 additions & 4 deletions .github/workflows/actions.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,7 @@ jobs:
- name: install python packages
run: |
python -m pip install --upgrade pip
pip install .
pip install pytest
pip install pytest-black
pip install .[dev]
- name: execute pytest
run: pytest tests/
run: pytest surface-sim/ tests/
3 changes: 1 addition & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -33,5 +33,4 @@ include = ["surface_sim", "surface_sim.*"] # package names should match these g
namespaces = false # to disable scanning PEP 420 namespaces (true by default)

[project.optional-dependencies]
dev = ["pip-tools", "pytest", "black", "pytest-black"]

dev = ["pip-tools", "pytest", "black", "pytest-black", "flake8", "flake8-print", "pytest-flake8"]
2 changes: 1 addition & 1 deletion pytest.ini
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
[pytest]
addopts = --black --import-mode=importlib
addopts = --black --import-mode=importlib --flake8 --cache-clear
python_files = test_*.py
18 changes: 18 additions & 0 deletions requirements_dev.txt
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,13 @@ dill==0.3.8
# via lmfit
exceptiongroup==1.2.2
# via pytest
flake8==5.0.4
# via
# flake8-print
# pytest-flake8
# surface-sim (pyproject.toml)
flake8-print==5.0.0
# via surface-sim (pyproject.toml)
fonttools==4.53.1
# via matplotlib
galois==0.0.16
Expand All @@ -42,6 +49,8 @@ lmfit==1.3.2
# via qec-util
matplotlib==3.9.2
# via qec-util
mccabe==0.7.0
# via flake8
mypy-extensions==1.0.0
# via black
netcdf4==1.7.1.post2
Expand Down Expand Up @@ -84,6 +93,12 @@ platformdirs==4.2.2
# via black
pluggy==1.5.0
# via pytest
pycodestyle==2.9.1
# via
# flake8
# flake8-print
pyflakes==2.5.0
# via flake8
pyparsing==3.1.2
# via matplotlib
pyproject-hooks==1.1.0
Expand All @@ -93,9 +108,12 @@ pyproject-hooks==1.1.0
pytest==8.3.2
# via
# pytest-black
# pytest-flake8
# surface-sim (pyproject.toml)
pytest-black==0.3.12
# via surface-sim (pyproject.toml)
pytest-flake8==1.2.2
# via surface-sim (pyproject.toml)
python-dateutil==2.9.0.post0
# via
# matplotlib
Expand Down
1 change: 0 additions & 1 deletion surface_sim/layouts/operations.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ def check_overlap_layout_pair(layout_1: Layout, layout_2: Layout) -> None:
"""
qubits_1 = set(layout_1.get_qubits())
qubits_2 = set(layout_2.get_qubits())
print(qubits_1, qubits_2)
if qubits_1.intersection(qubits_2) != set():
raise ValueError("The layouts have qubits with the same label.")

Expand Down
1 change: 0 additions & 1 deletion tests/log_gates/test_unrot_surface_code_css.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@

def test_set_trans_s():
layout = unrot_surface_code(distance=3)
print(layout.get_qubits(role="data"))
set_trans_s(layout, "D1")
gate_label = f"trans_s_{layout.get_logical_qubits()[0]}"

Expand Down

0 comments on commit 77a139e

Please sign in to comment.