Skip to content

Commit 5d20d2e

Browse files
bump black version (#617)
Co-authored-by: Steve Wood <[email protected]>
1 parent 40743dd commit 5d20d2e

File tree

7 files changed

+28
-19
lines changed

7 files changed

+28
-19
lines changed

docs/tutorials/07_examples_vehicle_routing.ipynb

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -297,9 +297,7 @@
297297
" my_obj = list(instance.reshape(1, n**2)[0]) + [0.0 for x in range(0, n - 1)]\n",
298298
" my_ub = [1 for x in range(0, n**2 + n - 1)]\n",
299299
" my_lb = [0 for x in range(0, n**2)] + [0.1 for x in range(0, n - 1)]\n",
300-
" my_ctype = \"\".join([\"I\" for x in range(0, n**2)]) + \"\".join(\n",
301-
" [\"C\" for x in range(0, n - 1)]\n",
302-
" )\n",
300+
" my_ctype = \"\".join([\"I\" for x in range(0, n**2)]) + \"\".join([\"C\" for x in range(0, n - 1)])\n",
303301
"\n",
304302
" my_rhs = (\n",
305303
" 2 * ([K] + [1 for x in range(0, n - 1)])\n",

docs/tutorials/08_cvar_optimization.ipynb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -213,6 +213,7 @@
213213
"objectives = {alpha: [] for alpha in alphas} # set of tested objective functions w.r.t. alpha\n",
214214
"results = {} # results of minimum eigensolver w.r.t alpha\n",
215215
"\n",
216+
"\n",
216217
"# callback to store intermediate results\n",
217218
"def callback(i, params, obj, stddev, alpha):\n",
218219
" # we translate the objective from the internal Ising representation\n",

qiskit_optimization/algorithms/qrao/magic_rounding.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# This code is part of a Qiskit project.
22
#
3-
# (C) Copyright IBM 2023.
3+
# (C) Copyright IBM 2023, 2024.
44
#
55
# This code is licensed under the Apache License, Version 2.0. You may
66
# obtain a copy of this license in the LICENSE.txt file in the root directory
@@ -446,9 +446,11 @@ def round(self, rounding_context: RoundingContext) -> RoundingResult:
446446
[int(bit) for bit in soln]
447447
),
448448
probability=count / self._shots,
449-
status=OptimizationResultStatus.SUCCESS
450-
if rounding_context.encoding.problem.is_feasible([int(bit) for bit in soln])
451-
else OptimizationResultStatus.INFEASIBLE,
449+
status=(
450+
OptimizationResultStatus.SUCCESS
451+
if rounding_context.encoding.problem.is_feasible([int(bit) for bit in soln])
452+
else OptimizationResultStatus.INFEASIBLE
453+
),
452454
)
453455
for soln, count in soln_counts.items()
454456
]

qiskit_optimization/algorithms/qrao/semideterministic_rounding.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# This code is part of a Qiskit project.
22
#
3-
# (C) Copyright IBM 2023.
3+
# (C) Copyright IBM 2023, 2024.
44
#
55
# This code is licensed under the Apache License, Version 2.0. You may
66
# obtain a copy of this license in the LICENSE.txt file in the root directory
@@ -68,9 +68,11 @@ def round(self, rounding_context: RoundingContext) -> RoundingResult:
6868
x=np.asarray(rounded_vars),
6969
fval=rounding_context.encoding.problem.objective.evaluate(rounded_vars),
7070
probability=1.0,
71-
status=OptimizationResultStatus.SUCCESS
72-
if rounding_context.encoding.problem.is_feasible(rounded_vars)
73-
else OptimizationResultStatus.INFEASIBLE,
71+
status=(
72+
OptimizationResultStatus.SUCCESS
73+
if rounding_context.encoding.problem.is_feasible(rounded_vars)
74+
else OptimizationResultStatus.INFEASIBLE
75+
),
7476
)
7577
]
7678

qiskit_optimization/converters/integer_to_binary.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# This code is part of a Qiskit project.
22
#
3-
# (C) Copyright IBM 2020, 2023.
3+
# (C) Copyright IBM 2020, 2024.
44
#
55
# This code is licensed under the Apache License, Version 2.0. You may
66
# obtain a copy of this license in the LICENSE.txt file in the root directory
@@ -77,7 +77,7 @@ def convert(self, problem: QuadraticProgram) -> QuadraticProgram:
7777
if x.vartype == Variable.Type.INTEGER:
7878
new_vars = self._convert_var(x.name, x.lowerbound, x.upperbound)
7979
self._conv[x] = new_vars
80-
for (var_name, _) in new_vars:
80+
for var_name, _ in new_vars:
8181
self._dst.binary_var(var_name)
8282
else:
8383
if x.vartype == Variable.Type.CONTINUOUS:
@@ -164,7 +164,11 @@ def _substitute_int_var(self):
164164
linear, linear_constant = self._convert_linear_coefficients_dict(
165165
self._src.objective.linear.to_dict(use_name=True)
166166
)
167-
quadratic, q_linear, q_constant, = self._convert_quadratic_coefficients_dict(
167+
(
168+
quadratic,
169+
q_linear,
170+
q_constant,
171+
) = self._convert_quadratic_coefficients_dict(
168172
self._src.objective.quadratic.to_dict(use_name=True)
169173
)
170174

requirements-dev.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
coverage>=4.4.0
22
matplotlib>=2.1
3-
black[jupyter]~=22.0
3+
black[jupyter]~=24.1
44
pylint>=2.16.2
55
pylatexenc>=1.4
66
stestr>=4.1.0

test/algorithms/qrao/test_magic_rounding.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# This code is part of a Qiskit project.
22
#
3-
# (C) Copyright IBM 2023.
3+
# (C) Copyright IBM 2023, 2024.
44
#
55
# This code is licensed under the Apache License, Version 2.0. You may
66
# obtain a copy of this license in the LICENSE.txt file in the root directory
@@ -328,9 +328,11 @@ def make_solution_sample(
328328
x=x,
329329
fval=problem.objective.evaluate(x),
330330
probability=probability,
331-
status=OptimizationResultStatus.SUCCESS
332-
if problem.is_feasible(x)
333-
else OptimizationResultStatus.INFEASIBLE,
331+
status=(
332+
OptimizationResultStatus.SUCCESS
333+
if problem.is_feasible(x)
334+
else OptimizationResultStatus.INFEASIBLE
335+
),
334336
)
335337

336338

0 commit comments

Comments
 (0)