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
Issue2099 #2111
Issue2099 #2111
Conversation
I am going to leave this up to you. It is not required as long as the lines you modified follow PEP8. Although, fixing the output of pycodestyle in the same file would be very much welcome 😄.
We will indeed need a test for repr. It does not need to be very complicated and in fact, something similar to what you show in the description of this pr should work. In this case, we would create a few different
This will not be necessary this time.
|
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.
thanks for your contribution! I added one suggestion but we would need some tests to be added as explained above before this gets merged. Feel free to ask any question!
I am working on it right now and will commit to the repo with all the changes. |
…for the edits made.
@AGaliciaMartinez Hello, I have made the required changes in the repr() of QobjEvo. Output of the new code:
In your suggestion, there wasnt a "<" before QobjEvo, so I added that. I have also edited the page according to the Kindly check the test too. This is my first test, so do suggest changes, if required. I could not think of different cases, so I write 4 cases, and checked them according to the expected result. |
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.
I think we are close to getting it finished! good work! Lets try the following for the tests though: 1 that has a qobjevo with type=ket, superrep=None, isconstant=True, num_elements=1
. And another one that has type=oper, superrep=True, isconstant=False, num_elements=2
. Changig the dimensions/ shape between both examples would also be useful.
Also, regarding the |
@AGaliciaMartinez Thank you! Now it looks like this:
I have added many tests according to your suggestions. Now there are 7 cases to check. |
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.
Be careful when applying pycodestyle
to cython code. cython has new keywords that it does not knows.
… tests with bad formatting
Changes to the test:
Changes to the @Ericgig @AGaliciaMartinez Kindly let me know if there are any more changes to be done. |
Thank you for the fixes. |
@Ericgig I resolved the conversation. Do I need to do anything else? |
It's not the conversation but the conflict in the |
@Ericgig I have resolved the conflict. |
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.
A few lines are too long, but the code is good.
qutip/core/cy/qobjevo.pyx
Outdated
@@ -241,6 +241,10 @@ cdef class QobjEvo: | |||
if compress: | |||
self.compress() | |||
|
|||
def __repr__(self): | |||
cls = self.__class__.__name__ | |||
return f'{cls}: dims={self.dims}, shape={self.shape}, type={self.type}, superrep={self.superrep}, isconstant={self.isconstant}, num_elements={self.num_elements}' |
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 line is quite wide, can you split it?
I have made corrections to the lines of code which I added in the file repr:
|
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.
Look good, thank you.
Help needed in the following
doc
folder, and the notebook. Feel free to ask if you are not sure.doc/changes/<PR number>.<type>
'type' can be one of the following: feature, bugfix, doc, removal, misc, or deprecation (see here for more information).Description
Added
__repr__
toQobjEvo
It is showing the following attributes:
dims
,shape
,type
,superop
(if a super operator is present),isconstant
andnum_elements
.Output:
Related issues or PRs
Fix #2099