From 6b4798ca04659e8134466736edb599ffc6612de6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Henrique=20Silv=C3=A9rio?= Date: Wed, 1 Mar 2023 10:14:43 +0100 Subject: [PATCH] Upgrading black to v23.1 (#470) --- dev_requirements.txt | 2 +- pulser-core/pulser/json/abstract_repr/deserializer.py | 1 - pulser-core/pulser/register/_reg_drawer.py | 2 +- pulser-core/pulser/waveforms.py | 1 - pulser-simulation/pulser_simulation/simresults.py | 2 +- tests/test_abstract_repr.py | 1 - tests/test_channels.py | 2 -- tests/test_sequence.py | 4 ---- tests/test_simulation.py | 1 - tests/test_waveforms.py | 1 - tutorials/applications/Control-Z Gate Sequence.ipynb | 1 - .../quantum_simulation/Building 1D Rydberg Crystals.ipynb | 1 - 12 files changed, 3 insertions(+), 16 deletions(-) diff --git a/dev_requirements.txt b/dev_requirements.txt index 504be6766..f04602142 100644 --- a/dev_requirements.txt +++ b/dev_requirements.txt @@ -1,5 +1,5 @@ # tests -black[jupyter] < 23.1 +black[jupyter] ~= 23.1 flake8 flake8-docstrings isort diff --git a/pulser-core/pulser/json/abstract_repr/deserializer.py b/pulser-core/pulser/json/abstract_repr/deserializer.py index b5035ec7e..9df4f1f2a 100644 --- a/pulser-core/pulser/json/abstract_repr/deserializer.py +++ b/pulser-core/pulser/json/abstract_repr/deserializer.py @@ -150,7 +150,6 @@ def _deserialize_parameter( def _deserialize_waveform(obj: dict, vars: dict) -> Waveform: - if obj["kind"] == "constant": return ConstantWaveform( duration=_deserialize_parameter(obj["duration"], vars), diff --git a/pulser-core/pulser/register/_reg_drawer.py b/pulser-core/pulser/register/_reg_drawer.py index d88d42f49..f2da97219 100644 --- a/pulser-core/pulser/register/_reg_drawer.py +++ b/pulser-core/pulser/register/_reg_drawer.py @@ -323,7 +323,7 @@ def _initialize_fig_axes_projection( ) proportions = [] - for (ix, iy) in combinations(np.arange(3), 2): + for ix, iy in combinations(np.arange(3), 2): big_side = max(diffs[[ix, iy]]) Ls = diffs[[ix, iy]] / big_side Ls *= max( diff --git a/pulser-core/pulser/waveforms.py b/pulser-core/pulser/waveforms.py index 13e806885..ac6653ef2 100644 --- a/pulser-core/pulser/waveforms.py +++ b/pulser-core/pulser/waveforms.py @@ -1019,7 +1019,6 @@ def from_max_val( duration_best = duration else: - # Start with a waveform based on the duration guess kaiser_guess = np.kaiser(duration_guess, beta) diff --git a/pulser-simulation/pulser_simulation/simresults.py b/pulser-simulation/pulser_simulation/simresults.py index 4929fbbe8..f30d2ab3e 100644 --- a/pulser-simulation/pulser_simulation/simresults.py +++ b/pulser-simulation/pulser_simulation/simresults.py @@ -621,7 +621,7 @@ def sample_state( return sampled_state detected_sample_dict: Counter = Counter() - for (shot, n_detects) in sampled_state.items(): + for shot, n_detects in sampled_state.items(): eps = self._meas_errors["epsilon"] eps_p = self._meas_errors["epsilon_prime"] # Shot as an array of 1s and 0s diff --git a/tests/test_abstract_repr.py b/tests/test_abstract_repr.py index 1bb4c4e78..414fbf482 100644 --- a/tests/test_abstract_repr.py +++ b/tests/test_abstract_repr.py @@ -550,7 +550,6 @@ def _get_serialized_seq( variables: dict[str, dict] = None, **override_kwargs: Any, ) -> dict[str, Any]: - seq_dict = { "version": "1", "name": "John Doe", diff --git a/tests/test_channels.py b/tests/test_channels.py index 86c513191..18025c64c 100644 --- a/tests/test_channels.py +++ b/tests/test_channels.py @@ -199,7 +199,6 @@ def test_eom_channel(): def test_modulation_errors(): - wf = ConstantWaveform(100, 1) no_eom_msg = "The channel Rydberg.Global(.*) does not have an EOM." with pytest.raises(TypeError, match=no_eom_msg): @@ -243,7 +242,6 @@ def test_modulation_errors(): ], ) def test_modulation(channel, tr, eom, side_buffer_len): - wf = ConstantWaveform(100, 1) out_ = channel.modulate(wf.samples, eom=eom) assert len(out_) == wf.duration + 2 * tr diff --git a/tests/test_sequence.py b/tests/test_sequence.py index c5b740d4b..9d648c849 100644 --- a/tests/test_sequence.py +++ b/tests/test_sequence.py @@ -142,7 +142,6 @@ def test_magnetic_field(): @pytest.fixture def devices(): - device1 = Device( name="test_device1", dimensions=2, @@ -240,7 +239,6 @@ def devices(): @pytest.fixture def pulses(): - rise = Pulse.ConstantDetuning( RampWaveform(252, 0.0, 2.3 * 2 * np.pi), -4 * np.pi, @@ -273,7 +271,6 @@ def init_seq( def test_switch_device_down(devices, pulses): - # Device checkout seq = init_seq(Chadoq2, "ising", "rydberg_global", None) with pytest.warns( @@ -358,7 +355,6 @@ def test_switch_device_down(devices, pulses): @pytest.mark.parametrize("device_ind, strict", [(1, False), (2, True)]) def test_switch_device_up(device_ind, devices, pulses, strict): - # Device checkout seq = init_seq(Chadoq2, "ising", "rydberg_global", None) assert seq.switch_device(Chadoq2)._device == Chadoq2 diff --git a/tests/test_simulation.py b/tests/test_simulation.py index f8a2cdb0d..30ce5f206 100644 --- a/tests/test_simulation.py +++ b/tests/test_simulation.py @@ -452,7 +452,6 @@ def test_eval_times(seq): sim = Simulation(seq, sampling_rate=1.0) sim.evaluation_times = 3.0 with pytest.raises(ValueError, match="Wrong evaluation time label."): - sim = Simulation(seq, sampling_rate=1.0) sim.evaluation_times = 123 with pytest.raises(ValueError, match="Wrong evaluation time label."): diff --git a/tests/test_waveforms.py b/tests/test_waveforms.py index 092cdfb65..c20e377b9 100644 --- a/tests/test_waveforms.py +++ b/tests/test_waveforms.py @@ -338,7 +338,6 @@ def test_serialization(): def test_get_item(): - # Check errors raised duration = constant.duration diff --git a/tutorials/applications/Control-Z Gate Sequence.ipynb b/tutorials/applications/Control-Z Gate Sequence.ipynb index 53cf165d1..7615c3e8d 100644 --- a/tutorials/applications/Control-Z Gate Sequence.ipynb +++ b/tutorials/applications/Control-Z Gate Sequence.ipynb @@ -306,7 +306,6 @@ "outputs": [], "source": [ "def CZ_sequence(initial_id):\n", - "\n", " # Prepare State\n", " prep_state = preparation_sequence(initial_id, reg)\n", " prep_time = max(\n", diff --git a/tutorials/quantum_simulation/Building 1D Rydberg Crystals.ipynb b/tutorials/quantum_simulation/Building 1D Rydberg Crystals.ipynb index 994e50ade..9c61f3868 100644 --- a/tutorials/quantum_simulation/Building 1D Rydberg Crystals.ipynb +++ b/tutorials/quantum_simulation/Building 1D Rydberg Crystals.ipynb @@ -86,7 +86,6 @@ "\n", "\n", "def blockade_cluster(N):\n", - "\n", " atom_coords = [\n", " ((R_blockade / N) * x + 40 * group, 0)\n", " for group in range(groups)\n",