-
Notifications
You must be signed in to change notification settings - Fork 2.6k
Add missing __getitem__
and other attributes to BitLocations
#13997
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
In an oversight after Qiskit#13860, when switching to use the pyo3 friendly `BitLocations` which is not an instance of `namedtuple` we did not extend it to include sequence methods `__getitem__` and `__len__`, which results in breaking api changes. The following commits add those methods to `BitLocations` and also labels the class correctly as a `sequence` in PyO3.
One or more of the following people are relevant to this code:
|
Pull Request Test Coverage Report for Build 13817269288Warning: This coverage report may be inaccurate.This pull request's base commit is no longer the HEAD commit of its target branch. This means it includes changes from outside the original pull request, including, potentially, unrelated coverage changes.
Details
💛 - Coveralls |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks better to me, thanks for the updates. Just a few small inline comments
Co-authored-by: Matthew Treinish <mtreinish@kortar.org>
) * Add: `__getitem__` and other attributes to `BitLocations` In an oversight after #13860, when switching to use the pyo3 friendly `BitLocations` which is not an instance of `namedtuple` we did not extend it to include sequence methods `__getitem__` and `__len__`, which results in breaking api changes. The following commits add those methods to `BitLocations` and also labels the class correctly as a `sequence` in PyO3. * Fix: Address review comments * Fix: More formatting issues in tests * Apply suggestions from code review Co-authored-by: Matthew Treinish <mtreinish@kortar.org> --------- Co-authored-by: Matthew Treinish <mtreinish@kortar.org> (cherry picked from commit 3a80a81)
) (#14008) * Add: `__getitem__` and other attributes to `BitLocations` In an oversight after #13860, when switching to use the pyo3 friendly `BitLocations` which is not an instance of `namedtuple` we did not extend it to include sequence methods `__getitem__` and `__len__`, which results in breaking api changes. The following commits add those methods to `BitLocations` and also labels the class correctly as a `sequence` in PyO3. * Fix: Address review comments * Fix: More formatting issues in tests * Apply suggestions from code review Co-authored-by: Matthew Treinish <mtreinish@kortar.org> --------- Co-authored-by: Matthew Treinish <mtreinish@kortar.org> (cherry picked from commit 3a80a81) Co-authored-by: Raynel Sanchez <87539502+raynelfss@users.noreply.github.com>
…kit#13997) * Add: `__getitem__` and other attributes to `BitLocations` In an oversight after Qiskit#13860, when switching to use the pyo3 friendly `BitLocations` which is not an instance of `namedtuple` we did not extend it to include sequence methods `__getitem__` and `__len__`, which results in breaking api changes. The following commits add those methods to `BitLocations` and also labels the class correctly as a `sequence` in PyO3. * Fix: Address review comments * Fix: More formatting issues in tests * Apply suggestions from code review Co-authored-by: Matthew Treinish <mtreinish@kortar.org> --------- Co-authored-by: Matthew Treinish <mtreinish@kortar.org>
Fixes #13996
Summary
We accidentaly removed the capability of indexing a
BitLocation
object. These commits add that functionality back!Details and comments
In an oversight after #13860, when switching to use the pyo3 friendly
BitLocations
which is not an instance ofnamedtuple
we did not extend it to include sequence methods__getitem__
and__len__
, which results in breaking api changes.The following commits add those methods to
BitLocations
and also labels the class correctly as asequence
in PyO3.