Skip to content

Commit 28595bb

Browse files
authored
chore: Bump dev dependencies and run black (#264)
1 parent 07facba commit 28595bb

11 files changed

+89
-124
lines changed

docs/conf.py

+3-2
Original file line numberDiff line numberDiff line change
@@ -32,15 +32,16 @@
3232
import sys
3333
from typing import List
3434

35-
import toml
35+
import tomli
3636

3737
import qctrlopencontrols
3838

3939
# pylint:disable=invalid-name
4040
sys.path.insert(0, os.path.abspath(".."))
4141

4242
# -- Project information -----------------------------------------------------
43-
parsed = toml.load("../pyproject.toml")
43+
with open("../pyproject.toml", "rb") as f:
44+
parsed = tomli.load(f)
4445
package_info = parsed["tool"]["poetry"]
4546
project = package_info["description"]
4647
author = ", ".join(package_info["authors"])

poetry.lock

+65-55
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pyproject.toml

+7-8
Original file line numberDiff line numberDiff line change
@@ -63,18 +63,17 @@ packages = [
6363
[tool.poetry.dependencies]
6464
python = ">=3.8,<3.12"
6565
numpy = ">=1.24.0"
66-
toml = "^0.10.2"
67-
6866

6967
[tool.poetry.dev-dependencies]
70-
black = "^22.3.0"
71-
mypy = "^0.991"
72-
pytest = "^7.0"
73-
pylint = "^2.16.1"
74-
sphinx = "^5.0.0"
75-
qctrl-sphinx-theme = "~0.1.2"
68+
black = "^23.1.0"
7669
isort = "^5.7.0"
70+
mypy = "^1.1.1"
7771
pre-commit = "^2.9.3"
72+
pylint = "^2.17.1"
73+
pytest = "^7.2.2"
74+
qctrl-sphinx-theme = "~0.1.2"
75+
sphinx = "^5.0.0"
76+
tomli = "^2.0.1"
7877

7978
[tool.poetry.urls]
8079
GitHub = "https://github.com/qctrl"

qctrlopencontrols/driven_controls/driven_control.py

-2
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,6 @@ def __init__(
101101
detunings: Optional[np.ndarray] = None,
102102
name: Optional[str] = None,
103103
):
104-
105104
self.name = name
106105

107106
durations = np.asarray(durations, dtype=float)
@@ -554,7 +553,6 @@ def export_to_file(
554553
def export(
555554
self, coordinates=Coordinate.CYLINDRICAL.value, dimensionless_rabi_rate=True
556555
) -> dict[str, Any]:
557-
558556
"""
559557
Returns a dictionary formatted for plotting using the ``qctrl-visualizer`` package.
560558

qctrlopencontrols/driven_controls/predefined.py

+4-12
Original file line numberDiff line numberDiff line change
@@ -1038,9 +1038,7 @@ def new_gaussian_control(
10381038
"""
10391039

10401040
check_arguments(
1041-
duration > 0.0,
1042-
"Pulse duration must be positive.",
1043-
{"duration": duration},
1041+
duration > 0.0, "Pulse duration must be positive.", {"duration": duration}
10441042
)
10451043

10461044
check_arguments(
@@ -1050,9 +1048,7 @@ def new_gaussian_control(
10501048
)
10511049

10521050
check_arguments(
1053-
width > 0.0,
1054-
"Width of ideal Gaussian pulse must be positive.",
1055-
{"width": width},
1051+
width > 0.0, "Width of ideal Gaussian pulse must be positive.", {"width": width}
10561052
)
10571053

10581054
# work out exact segment duration
@@ -1287,9 +1283,7 @@ def new_drag_control(
12871283
"""
12881284

12891285
check_arguments(
1290-
duration > 0.0,
1291-
"Pulse duration must be positive.",
1292-
{"duration": duration},
1286+
duration > 0.0, "Pulse duration must be positive.", {"duration": duration}
12931287
)
12941288

12951289
check_arguments(
@@ -1299,9 +1293,7 @@ def new_drag_control(
12991293
)
13001294

13011295
check_arguments(
1302-
width > 0.0,
1303-
"Width of ideal Gaussian pulse must be positive.",
1304-
{"width": width},
1296+
width > 0.0, "Width of ideal Gaussian pulse must be positive.", {"width": width}
13051297
)
13061298

13071299
# compute sampling parameters

qctrlopencontrols/dynamic_decoupling_sequences/dynamic_decoupling_sequence.py

-1
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,6 @@ def __init__(
8282
detuning_rotations: np.ndarray,
8383
name: Optional[str] = None,
8484
):
85-
8685
check_arguments(
8786
duration > 0,
8887
"Sequence duration must be above zero.",

qctrlopencontrols/dynamic_decoupling_sequences/predefined.py

+10-32
Original file line numberDiff line numberDiff line change
@@ -174,9 +174,7 @@ def new_ramsey_sequence(
174174
<https://link.aps.org/doi/10.1103/PhysRev.78.695>`_
175175
"""
176176
check_arguments(
177-
duration > 0,
178-
"Sequence duration must be positive.",
179-
{"duration": duration},
177+
duration > 0, "Sequence duration must be positive.", {"duration": duration}
180178
)
181179

182180
if pre_post_rotation:
@@ -233,9 +231,7 @@ def new_spin_echo_sequence(
233231
"""
234232

235233
check_arguments(
236-
duration > 0,
237-
"Sequence duration must be positive.",
238-
{"duration": duration},
234+
duration > 0, "Sequence duration must be positive.", {"duration": duration}
239235
)
240236

241237
offsets = np.array([duration / 2.0])
@@ -308,9 +304,7 @@ def new_carr_purcell_sequence(
308304
"""
309305

310306
check_arguments(
311-
duration > 0,
312-
"Sequence duration must be positive.",
313-
{"duration": duration},
307+
duration > 0, "Sequence duration must be positive.", {"duration": duration}
314308
)
315309
check_arguments(
316310
offset_count >= 1,
@@ -393,9 +387,7 @@ def new_cpmg_sequence(
393387
"""
394388

395389
check_arguments(
396-
duration > 0,
397-
"Sequence duration must be positive.",
398-
{"duration": duration},
390+
duration > 0, "Sequence duration must be positive.", {"duration": duration}
399391
)
400392
check_arguments(
401393
offset_count >= 1,
@@ -474,9 +466,7 @@ def new_uhrig_sequence(
474466
"""
475467

476468
check_arguments(
477-
duration > 0,
478-
"Sequence duration must be positive.",
479-
{"duration": duration},
469+
duration > 0, "Sequence duration must be positive.", {"duration": duration}
480470
)
481471
check_arguments(
482472
offset_count >= 1,
@@ -555,9 +545,7 @@ def new_periodic_sequence(
555545
"""
556546

557547
check_arguments(
558-
duration > 0,
559-
"Sequence duration must be positve.",
560-
{"duration": duration},
548+
duration > 0, "Sequence duration must be positve.", {"duration": duration}
561549
)
562550
check_arguments(
563551
offset_count >= 1,
@@ -660,9 +648,7 @@ def new_walsh_sequence(
660648
"""
661649

662650
check_arguments(
663-
duration > 0,
664-
"Sequence duration must be positive.",
665-
{"duration": duration},
651+
duration > 0, "Sequence duration must be positive.", {"duration": duration}
666652
)
667653
check_arguments(
668654
1 <= paley_order <= 2000,
@@ -782,9 +768,7 @@ def new_quadratic_sequence(
782768
"""
783769

784770
check_arguments(
785-
duration > 0,
786-
"Sequence duration must be positive.",
787-
{"duration": duration},
771+
duration > 0, "Sequence duration must be positive.", {"duration": duration}
788772
)
789773
check_arguments(
790774
inner_offset_count >= 1,
@@ -904,9 +888,7 @@ def new_x_concatenated_sequence(
904888
"""
905889

906890
check_arguments(
907-
duration > 0,
908-
"Sequence duration must be positive.",
909-
{"duration": duration},
891+
duration > 0, "Sequence duration must be positive.", {"duration": duration}
910892
)
911893
check_arguments(
912894
concatenation_order >= 1,
@@ -1009,9 +991,7 @@ def new_xy_concatenated_sequence(
1009991
"""
1010992

1011993
check_arguments(
1012-
duration > 0,
1013-
"Sequence duration must be positive.",
1014-
{"duration": duration},
994+
duration > 0, "Sequence duration must be positive.", {"duration": duration}
1015995
)
1016996
check_arguments(
1017997
concatenation_order >= 1,
@@ -1072,7 +1052,6 @@ def new_xy_concatenated_sequence(
10721052

10731053
carr_idx = 0
10741054
while rabi_idx < len(rabi_offsets) and azimuthal_idx < len(azimuthal_offsets):
1075-
10761055
if rabi_offsets[rabi_idx] < azimuthal_offsets[azimuthal_idx]:
10771056
rabi_rotations[carr_idx] = np.pi
10781057
offsets[carr_idx] = rabi_offsets[rabi_idx]
@@ -1085,7 +1064,6 @@ def new_xy_concatenated_sequence(
10851064
carr_idx += 1
10861065

10871066
if rabi_idx < len(rabi_offsets):
1088-
10891067
while rabi_idx < len(rabi_offsets):
10901068
rabi_rotations[carr_idx] = np.pi
10911069
offsets[carr_idx] = rabi_offsets[rabi_idx]

qctrlopencontrols/utils.py

-1
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@
2727

2828

2929
def create_repr_from_attributes(class_instance=None, attributes=None) -> str:
30-
3130
"""
3231
Returns a string representation of an object.
3332

tests/test_driven_controls.py

-3
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,6 @@ def _remove_file(filename):
3838

3939

4040
def test_driven_controls():
41-
4241
"""
4342
Tests the construction of driven controls.
4443
"""
@@ -183,7 +182,6 @@ def test_control_directions_with_small_amplitudes():
183182

184183

185184
def test_control_export():
186-
187185
"""
188186
Tests exporting the control to a file.
189187
"""
@@ -283,7 +281,6 @@ def test_plot_data():
283281

284282

285283
def test_pretty_print():
286-
287284
"""
288285
Tests pretty output of driven control.
289286
"""

tests/test_dynamical_decoupling.py

-6
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,6 @@ def test_dynamical_decoupling_sequence():
115115
assert sequence.name == _name
116116

117117
with pytest.raises(ArgumentsValueError):
118-
119118
# duration cannot be negative
120119
_ = DynamicDecouplingSequence(
121120
duration=-2.0,
@@ -126,7 +125,6 @@ def test_dynamical_decoupling_sequence():
126125
)
127126

128127
with pytest.raises(ArgumentsValueError):
129-
130128
# rabi rotations cannot be negative
131129
_ = DynamicDecouplingSequence(
132130
duration=2.0,
@@ -202,7 +200,6 @@ def test_sequence_plot():
202200

203201

204202
def test_pretty_string_format():
205-
206203
"""
207204
Tests `__str__` of the dynamic decoupling sequence.
208205
"""
@@ -276,7 +273,6 @@ def test_pretty_string_format():
276273

277274

278275
def test_conversion_to_driven_controls():
279-
280276
"""
281277
Tests the method to convert a DDS to Driven Control.
282278
"""
@@ -761,7 +757,6 @@ def test_conversion_of_tightly_packed_sequence():
761757

762758

763759
def test_free_evolution_conversion():
764-
765760
"""
766761
Tests the conversion of free evolution.
767762
"""
@@ -831,7 +826,6 @@ def test_free_evolution_conversion():
831826

832827

833828
def test_export_to_file():
834-
835829
"""
836830
Tests exporting to file.
837831
"""

tests/test_predefined_dynamical_decoupling.py

-2
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,6 @@
3939

4040

4141
def test_ramsey_sequence():
42-
4342
"""
4443
Tests the Ramsey sequence.
4544
"""
@@ -70,7 +69,6 @@ def test_ramsey_sequence():
7069

7170

7271
def test_spin_echo_sequence():
73-
7472
"""
7573
Test the spin echo sequence.
7674
"""

0 commit comments

Comments
 (0)