Add ISBN 10 to 13 converter bot#335
Open
davidscotson wants to merge 1 commit intointernetarchive:masterfrom
Open
Add ISBN 10 to 13 converter bot#335davidscotson wants to merge 1 commit intointernetarchive:masterfrom
davidscotson wants to merge 1 commit intointernetarchive:masterfrom
Conversation
cclauss
reviewed
Jun 29, 2023
| # we only update editions with no existing isbn 13s (for now at least) | ||
| continue | ||
|
|
||
| isbns_13 = [] |
Contributor
There was a problem hiding this comment.
It is too easy to overlook the plural form when it is in the middle of the variable name.
Suggested change
| isbns_13 = [] | |
| isbn_13s = [] |
Can't this be a set() instead of a list() so the deduping is automatic?
Contributor
Author
There was a problem hiding this comment.
I avoided that becausi it might randomise the order of the existing entries, but in this specific bot we're only running it on things without existing isbn_13s anyway, so that's probably a worthwhile change.
cclauss
suggested changes
Jun 29, 2023
Comment on lines
+55
to
+57
| isbns_13 = dedupe( | ||
| isbns_13 | ||
| ) # remove duplicates, shouldn't normally be necessary |
Contributor
There was a problem hiding this comment.
Do not wrap the line just for a comment.
Suggested change
| isbns_13 = dedupe( | |
| isbns_13 | |
| ) # remove duplicates, shouldn't normally be necessary | |
| # remove duplicates, shouldn't normally be necessary | |
| isbns_13 = dedupe(isbns_13) |
Contributor
Author
There was a problem hiding this comment.
If we switch to a set, the comment (and code) becomes unnecessary, so that might be the way to go.
| self.save(lambda: edition.save(comment=comment)) | ||
|
|
||
|
|
||
| def dedupe(input_list: list) -> list: |
Contributor
There was a problem hiding this comment.
Suggested change
| def dedupe(input_list: list) -> list: | |
| def dedupe(input_list: list) -> list: | |
| return sorted(set(input_list)) |
This file contains hidden or 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
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.
Closes #334
Description:
In this Pull Request we have made the following changes: