Skip to content

Commit 249660b

Browse files
authored
Merge pull request #375 from stephane-caron/fix/is_not_None
Replace `!= None` with `is not None` in Python bindings
2 parents 5760e50 + e2cf443 commit 249660b

File tree

2 files changed

+9
-8
lines changed

2 files changed

+9
-8
lines changed

CHANGELOG.md

+1
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
88

99
### Fixed
1010
* Fix an arcane compilation issue on Clang-19 ([#379](https://github.com/Simple-Robotics/proxsuite/pull/379))
11+
* Replace `!= None` with `is not None` in Python bindings ([#375](https://github.com/Simple-Robotics/proxsuite/pull/375))
1112

1213
### Changed
1314
* Upgrade nanobind submodule to v2.5.0 ([#378](https://github.com/Simple-Robotics/proxsuite/pull/378))

bindings/python/proxsuite/torch/qplayer.py

+8-8
Original file line numberDiff line numberDiff line change
@@ -194,9 +194,9 @@ def backward(ctx, dl_dzhat, dl_dlams, dl_dnus):
194194
for i in range(nBatch):
195195
rhs = np.zeros(n_tot)
196196
rhs[:dim] = dl_dzhat[i]
197-
if dl_dlams != None:
197+
if dl_dlams is not None:
198198
rhs[dim : dim + neq] = dl_dlams[i]
199-
if dl_dnus != None:
199+
if dl_dnus is not None:
200200
rhs[dim + neq :] = dl_dnus[i]
201201
vector_of_loss_derivatives.append(rhs)
202202

@@ -212,9 +212,9 @@ def backward(ctx, dl_dzhat, dl_dlams, dl_dnus):
212212
for i in range(nBatch):
213213
rhs = np.zeros(n_tot)
214214
rhs[:dim] = dl_dzhat[i].cpu()
215-
if dl_dlams != None:
215+
if dl_dlams is not None:
216216
rhs[dim : dim + neq] = dl_dlams[i].cpu()
217-
if dl_dnus != None:
217+
if dl_dnus is not None:
218218
rhs[dim + neq :] = dl_dnus[i].cpu()
219219
qpi = ctx.vector_of_qps.get(i)
220220
proxsuite.proxqp.dense.compute_backward(
@@ -472,13 +472,13 @@ def backward(ctx, dl_dzhat, dl_dlams, dl_dnus, dl_ds_e, dl_ds_i):
472472

473473
rhs = np.zeros(kkt.shape[0])
474474
rhs[:dim] = -dl_dzhat[i]
475-
if dl_dlams != None:
475+
if dl_dlams is not None:
476476
if n_eq != 0:
477477
rhs[dim : dim + n_eq] = -dl_dlams[i]
478478
active_set = None
479479
if n_in != 0:
480480
active_set = -z_i[:n_in_sol] + z_i[n_in_sol:] >= 0
481-
if dl_dnus != None:
481+
if dl_dnus is not None:
482482
if n_in != 0:
483483
# we must convert dl_dnus to a uni sided version
484484
# to do so we reconstitute the active set
@@ -488,10 +488,10 @@ def backward(ctx, dl_dzhat, dl_dlams, dl_dnus, dl_ds_e, dl_ds_i):
488488
rhs[dim + n_eq + n_in_sol : dim + n_eq + n_in][active_set] = (
489489
-dl_dnus[i][active_set]
490490
)
491-
if dl_ds_e != None:
491+
if dl_ds_e is not None:
492492
if dl_ds_e.shape[0] != 0:
493493
rhs[dim + n_eq + n_in : dim + 2 * n_eq + n_in] = -dl_ds_e[i]
494-
if dl_ds_i != None:
494+
if dl_ds_i is not None:
495495
if dl_ds_i.shape[0] != 0:
496496
# we must convert dl_dnus to a uni sided version
497497
# to do so we reconstitute the active set

0 commit comments

Comments
 (0)