-
Notifications
You must be signed in to change notification settings - Fork 192
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
👌 IMPROVE: Make verdi group
messages consistent
#4999
👌 IMPROVE: Make verdi group
messages consistent
#4999
Conversation
Codecov Report
@@ Coverage Diff @@
## develop #4999 +/- ##
===========================================
+ Coverage 80.17% 80.17% +0.01%
===========================================
Files 515 515
Lines 36746 36741 -5
===========================================
- Hits 29457 29453 -4
+ Misses 7289 7288 -1
Flags with carried forward coverage won't be shown. Click here to find out more.
Continue to review full report at Codecov.
|
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 am always a fan of consistency and I also like:
{group.__class__.__name__}<{group.label}>
as the standard representation of a Group
instance. But to prevent us having to repeat this lengthy snippet each time, what about we make this the implementation of Group.__str__
? Then we just put {group}
in the string and presto. The current __str__
implementation includes the user name but I think that is used so little that we can remove it.
Fine by me - if there are no objections to this? @giovannipizzi @ltalirz @chrisjsewell @mbercx ? (I will add a commit with this change as it's quick, which can then be reverted if there's a huge uprising of sorts.) Edit: Looking at the code I have just realized you are mixing |
Remove mention of user. Use {group} directly in verdi group click messages.
c68807a
to
07c88b5
Compare
Wasn't really mixing them up, but was just describing how I think the def __repr__(self):
return f'self.__class__.__name__<self.uuid>'
def __str__(self):
return f'self.__class__.__name__<self.label>' I forgot where, but we started using this definition in other places since some time ago. We just never got around to apply this to all important ORM classes. |
I don't completely agree with this, at least not the
This would then instead become: def __repr__(self):
return f'{self.__class__.__name__}(label={self.label}, user={self.user}, description={self.description}, type_string={self.type_string}, backend={self.backend})'
def __str__(self):
return f'{self.__class__.__name__}<{self.label}>' I'm not sure whether all the attributes here match up exactly with the initialization parameters --- but, yeah.
Might be good to make a collective issue for this then? Low priority but still important. |
Also, update __str__ to "Group<LABEL>".
I know that this is what is often written on this topic, but I don't think this is useful or necessary in practice. Note that even if you get the full signature correct (and even you yourself already admit here that you are not sure your current implementation is correct) there is no guarantee that you know where the class was imported from and so you cannot necessarily reconstruct the object using |
Okay. I think this is something that should be decided and implemented for all ORM classes in one go (separate PR) instead of changing it here. So I'll open an issue for this (if one doesn't already exist) and revert changes to |
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.
Discussion of the actua group str contruct has moved to #3087, so this is good to go thanks 👍
verdi group
messages consistentverdi group
messages consistent
Closes #4998.
label
instead ofname
.group.__class__.__name__
always.Edit: This PR has been updated according to the discussion below.