Skip to content

Commit

Permalink
Upgrading black to v23.1 (#470)
Browse files Browse the repository at this point in the history
  • Loading branch information
HGSilveri authored Mar 1, 2023
1 parent 38f8665 commit 6b4798c
Show file tree
Hide file tree
Showing 12 changed files with 3 additions and 16 deletions.
2 changes: 1 addition & 1 deletion dev_requirements.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# tests
black[jupyter] < 23.1
black[jupyter] ~= 23.1
flake8
flake8-docstrings
isort
Expand Down
1 change: 0 additions & 1 deletion pulser-core/pulser/json/abstract_repr/deserializer.py
Original file line number Diff line number Diff line change
Expand Up @@ -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),
Expand Down
2 changes: 1 addition & 1 deletion pulser-core/pulser/register/_reg_drawer.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
1 change: 0 additions & 1 deletion pulser-core/pulser/waveforms.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion pulser-simulation/pulser_simulation/simresults.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 0 additions & 1 deletion tests/test_abstract_repr.py
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
2 changes: 0 additions & 2 deletions tests/test_channels.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down Expand Up @@ -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
Expand Down
4 changes: 0 additions & 4 deletions tests/test_sequence.py
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,6 @@ def test_magnetic_field():

@pytest.fixture
def devices():

device1 = Device(
name="test_device1",
dimensions=2,
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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(
Expand Down Expand Up @@ -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
Expand Down
1 change: 0 additions & 1 deletion tests/test_simulation.py
Original file line number Diff line number Diff line change
Expand Up @@ -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."):
Expand Down
1 change: 0 additions & 1 deletion tests/test_waveforms.py
Original file line number Diff line number Diff line change
Expand Up @@ -338,7 +338,6 @@ def test_serialization():


def test_get_item():

# Check errors raised

duration = constant.duration
Expand Down
1 change: 0 additions & 1 deletion tutorials/applications/Control-Z Gate Sequence.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down

0 comments on commit 6b4798c

Please sign in to comment.