-
Notifications
You must be signed in to change notification settings - Fork 81
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
List tool improvements #255
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
... instead of just the names of the items. Signed-off-by: Andreas Lauser <[email protected]> Signed-off-by: Gerrit Ecke <[email protected]>
for `list` the new `--dump-database` argument fills the gap (more or less), for the other commands it is IMO not necessary because in their present form, I cannot see their usefulness for non-interactive scripts. the `list` command's new `--dump-database` option is useful for debugging purposes: it is about an order of magnitude faster than `odxtools list -a $PDX_FILE`, and -- as a bonus -- it prints all information that is internalized by the database object. Signed-off-by: Andreas Lauser <[email protected]> Signed-off-by: Gerrit Ecke <[email protected]>
the reason is that `rich.print` is pretty slow... Signed-off-by: Andreas Lauser <[email protected]> Signed-off-by: Gerrit Ecke <[email protected]>
it is `indent`, not `ident`! Signed-off-by: Andreas Lauser <[email protected]> Signed-off-by: Gerrit Ecke <[email protected]>
Signed-off-by: Andreas Lauser <[email protected]> Signed-off-by: Gerrit Ecke <[email protected]>
also, print the identifying prefix of a service instead of trying to encode a full request. (which can and does fail for other reasons than not having all required parameters specified.) Signed-off-by: Andreas Lauser <[email protected]> Signed-off-by: Gerrit Ecke <[email protected]>
... instead of trying to encode a complete request. (this can fail for different reasons than not having specified all required parameters.) Signed-off-by: Andreas Lauser <[email protected]> Signed-off-by: Gerrit Ecke <[email protected]>
This code was hard to maintain, located in the wrong place, did not work for quite a few edge cases, and finally a simple table of the parameters is far more useful from a user's point of view IMO. Signed-off-by: Andreas Lauser <[email protected]> Signed-off-by: Gerrit Ecke <[email protected]>
once all possible DOPs are implemented, this hack should become unnecessary. Signed-off-by: Andreas Lauser <[email protected]> Signed-off-by: Gerrit Ecke <[email protected]>
this tool suffered from a bit of bitrot... Signed-off-by: Andreas Lauser <[email protected]> Signed-off-by: Gerrit Ecke <[email protected]>
kayoub5
reviewed
Jan 19, 2024
odxtools/nameditemlist.py
Outdated
@@ -172,7 +172,7 @@ def __str__(self) -> str: | |||
return f"[{', '.join( [self._get_item_key(x) for x in self])}]" | |||
|
|||
def __repr__(self) -> str: | |||
return self.__str__() | |||
return f"[{', '.join([repr(x) for x in self])}]" |
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.
Make sure to include class name
f"NamedItemList[{', '.join([repr(x) for x in self])}]"
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.
fixed: 36d0fff
thanks to [at]kayoub5 for the suggestion! Signed-off-by: Andreas Lauser <[email protected]> Signed-off-by: Gerrit Ecke <[email protected]>
kayoub5
approved these changes
Jan 19, 2024
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This pull request contains various improvements for the CLI tools, in particular for
list
. The motivation for this is that, albeit the new output is pretty,list
did not work for some of my real-world datasets anymore and -- after I fixed these issues (cf 8b75587 and a008df6) -- it was about an order of magnitude slower than it used to be. Since this is a problem for my smoke testing script (which used to take about 60 seconds to complete and now took about 10 minutes), I added the--dump-database
option tolist
. This prints everything that gets internalized in an as performant way as possible instead of the printing objects that are handled by the printing helper function in an as intuitive way as possible. (NB that these changes motivated #253 .)Andreas Lauser <[email protected]>, on behalf of MBition GmbH.
Provider Information