-
Notifications
You must be signed in to change notification settings - Fork 2.3k
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
Fix an isintanceof statement to allow all numpy integers #5768
Conversation
This LGTM, but I think we should also do this in the quantum_info module too as you pointed out in #5758. I'm pretty sure the use of |
I'm wondering it because It's good to use the same type of index (just |
The intent of most of these locations in qiskit was to allow python or numpy integer types. There were occasional cases for some functions/classes where a numpy int was used if it came from something like |
@chriseclectic Thank you for your information. I replace |
The latest release of numpy, 1.20.0, deprecated type aliases for python's built in numeric types (complex, int, float, etc). The usage of these aliases has caused a myriad of deprecation warnings on import and during runtime everytime they were used. This commit fixes this so that terra's 0.16.x series is compatible with numpy 1.20.0. This commit is effectively a backport of Qiskit#5758 and Qiskit#5768 but because of significant divergance between master and stable/0.16 it was not a straight backport.
* Fix compatibility with numpy 1.20.0 The latest release of numpy, 1.20.0, deprecated type aliases for python's built in numeric types (complex, int, float, etc). The usage of these aliases has caused a myriad of deprecation warnings on import and during runtime everytime they were used. This commit fixes this so that terra's 0.16.x series is compatible with numpy 1.20.0. This commit is effectively a backport of #5758 and #5768 but because of significant divergance between master and stable/0.16 it was not a straight backport. * Disable pylint rule causing failure with fastjsonschema 2.15.0 (#5767) * Disable pylint rule causing failure with fastjsonschema 2.15.0 On Feb. 1, 2021 fastjsonschema 2.15.0 was released that made some changes to the exception API. [1][2] These changed the inheritance tree used for the exception classes so that 'JsonSchemaException' (which is the class qiskit is catching) was changed to be a base class instead of the class raised by validation errors. A new class 'JsonSchemaValueException' a subclass of that now base class is now raised by validation errors. The attributes used to wrap that exception and raise a custom exception are now defined in `JsonSchemaValueException` and not 'JsonSchemaException'. This is causing pylint to fail because the attributes are not defined in the base class. But in practice this will not raise an error as `JsonSchemaValueException` will always be raised even if we only isinstance check its base class. To still support old versions of fastjsonschema we shouldn't change that isinstance check so this commit just disables the rules. Especially since the qobj jsonschema validation is deprecated and will be removed in a future release as long as the code works pylint's pedantry isn't as important. [1] horejsek/python-fastjsonschema@64a635e [2] https://github.com/horejsek/python-fastjsonschema/blob/master/CHANGELOG.txt#L6-L8 * Fix lint in lint disable comment (cherry picked from commit 56facba) * Fix stray deprecated types
826ec86
to
8d3166f
Compare
I replaced all
|
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.
LGTM, thanks for updating.
Summary
Fix an
isinstance
of statement to allow all numpy integers.Discussed in #5758
Details and comments