Skip to content

Commit eb1232a

Browse files
committed
ruff check lint fixes
1 parent 0fe794d commit eb1232a

10 files changed

Lines changed: 15 additions & 11 deletions

File tree

dev_tools/qualtran_dev_tools/make_reference_docs/_components/render_docstring.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,7 @@ def _write_yields(f, part: DocstringSectionYields, level: int):
167167
f.write('\n')
168168

169169
else:
170-
subpart: DocstringYield
170+
param: DocstringYield
171171
for param in part.value:
172172
pname = param.name if param.name else 'yld'
173173
f.write(f'{pname}\n')

dev_tools/qualtran_dev_tools/make_reference_docs/_make.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@
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+
# ruff: noqa: E402
1416
import ast
1517
import warnings
1618
from collections import defaultdict

dev_tools/qualtran_dev_tools/shell_tools.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,9 @@ def run(
9191
if abbreviate_non_option_arguments:
9292
cmd_desc = abbreviate_command_arguments_after_switches(cmd_desc)
9393
print("run:", cmd_desc, file=sys.stderr)
94-
return subprocess.run(args, **subprocess_run_kwargs) # pylint: disable=subprocess-run-check
94+
return subprocess.run( # noqa: PLW1510
95+
args, **subprocess_run_kwargs
96+
) # pylint: disable=subprocess-run-check
9597

9698

9799
def output_of(args: Union[str, List[str]], **kwargs) -> str:

qualtran/bloqs/block_encoding/product_test.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -234,12 +234,12 @@ def test_product_symbolic_call_graph_decomposes():
234234
from qualtran.bloqs.basic_gates import Hadamard, TGate
235235
from qualtran.bloqs.block_encoding.unitary import Unitary
236236

237-
product_block_encoding = Product(
237+
Product(
238238
(
239239
Unitary(TGate(), ancilla_bitsize=sympy.symbols("anc")),
240240
Unitary(Hadamard(), ancilla_bitsize=sympy.symbols("anc")),
241241
)
242-
)
242+
).decompose_bloq()
243243

244244

245245
@pytest.mark.notebook

qualtran/bloqs/chemistry/trotter/hubbard/hubbard.ipynb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,9 @@
1717
"H = H_h + H_I\n",
1818
"$$\n",
1919
"\n",
20-
"where the hopping hamiltonian is given as \n",
20+
"where the hopping hamiltonian is given as\n",
2121
"$$\n",
22-
"H_h = -\\tau \\sum_{\\langle p, q\\rangle, \\sigma} \n",
22+
"H_h = -\\tau \\sum_{\\langle p, q\\rangle, \\sigma}\n",
2323
" \\left(a_{p\\sigma}^{\\dagger} a_{q\\sigma} + \\mathrm{h.c.} \\right)\n",
2424
"$$\n",
2525
"where the sum is over nearest neighbour lattice sites (under periodic boundary conditions).\n",

qualtran/bloqs/chemistry/trotter/ising/ising.ipynb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
"source": [
1010
"# Ising Trotter Bloqs\n",
1111
"\n",
12-
"Bloqs implementing Trotter steps for the 1D Ising model under periodic boundary conditions. \n",
12+
"Bloqs implementing Trotter steps for the 1D Ising model under periodic boundary conditions.\n",
1313
"\n",
1414
"The Ising model is given as\n",
1515
"$$\n",

qualtran/bloqs/gf_arithmetic/gf2_multiplication.ipynb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -224,7 +224,7 @@
224224
"from qualtran import QGF\n",
225225
"\n",
226226
"mx = galois.Poly.Degrees([0, 1, 3]) # x^3 + x + 1\n",
227-
"gf = galois.GF(2, 3, irreducible_poly=mx)\n",
227+
"# gf = galois.GF(2, 3, irreducible_poly=mx)\n",
228228
"const = 5 # x^2 + 1\n",
229229
"gf2_multiply_by_constant = GF2MulK(QGF(2, 3, mx), const)"
230230
]

qualtran/bloqs/gf_arithmetic/gf2_multiplication.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -478,7 +478,7 @@ def _gf2_multiply_by_constant() -> GF2MulK:
478478
from qualtran import QGF
479479

480480
mx = galois.Poly.Degrees([0, 1, 3]) # x^3 + x + 1
481-
gf = galois.GF(2, 3, irreducible_poly=mx)
481+
# gf = galois.GF(2, 3, irreducible_poly=mx)
482482
const = 5 # x^2 + 1
483483
gf2_multiply_by_constant = GF2MulK(QGF(2, 3, mx), const)
484484
return gf2_multiply_by_constant

qualtran/bloqs/rotations/phase_gradient.ipynb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -227,7 +227,7 @@
227227
},
228228
"outputs": [],
229229
"source": [
230-
"from qualtran import QFxp\n",
230+
"from qualtran import QFxp # noqa: F401\n",
231231
"\n",
232232
"phase_gradient_state = PhaseGradientState(4)"
233233
]

qualtran/bloqs/rotations/phase_gradient.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -215,7 +215,7 @@ def decompose_from_registers(
215215
# pylint: disable=unused-import
216216
@bloq_example
217217
def _phase_gradient_state() -> PhaseGradientState:
218-
from qualtran import QFxp
218+
from qualtran import QFxp # noqa: F401
219219

220220
phase_gradient_state = PhaseGradientState(4)
221221
return phase_gradient_state

0 commit comments

Comments
 (0)