Switch away from iteration shims.
Review Request #11850 — Created Oct. 14, 2021 and submitted
Information | |
---|---|
david | |
Review Board | |
master | |
Reviewers | |
reviewboard | |
In the Python 2 to 3 conversion, many iteration methods (such as
items()
andkeys()
were changed from returning lists to iterators.
In order to be correct in usage everywhere, we usedsix
to ensure
consistent behavior across versions. Now that we're Python 3+ only on
the master branch, we can get rid of these and just use the builtins.
Ran unit tests.
Summary | |
---|---|
Description | From | Last Updated |
---|---|---|
Can we use a keyword argument per line? |
|
|
While here, can we modernize this? all_text_types_extra_data = { _key: {} for _key in extra_text_type_fields.keys() } |
|
|
While here, let's make this a bit nicer/less wasteful and use { ... } instead of set([ ... ]). |
|
|
So here's a question. Why were we even doing this before? Aren't we going from dict to dict? Can't we … |
|
|
I think this can just be list(self.commits.values()). |
|
|
Same here. |
|
|
While here, can we make this a modern dict comprehension? |
|
-
-
reviewboard/avatars/templatetags/avatars.py (Diff revision 1) Can we use a keyword argument per line?
-
reviewboard/webapi/mixins.py (Diff revision 1) While here, can we modernize this?
all_text_types_extra_data = { _key: {} for _key in extra_text_type_fields.keys() }
Change Summary:
Made requested changes.
Commits: |
|
|||||||||
---|---|---|---|---|---|---|---|---|---|---|
Diff: |
Revision 2 (+276 -340) |
Checks run (2 succeeded)
-
-
reviewboard/accounts/backends/standard.py (Diff revision 2) While here, let's make this a bit nicer/less wasteful and use
{ ... }
instead ofset([ ... ])
. -
reviewboard/avatars/templatetags/avatars.py (Diff revision 2) So here's a question. Why were we even doing this before? Aren't we going from
dict
todict
? Can't we just copy the result ofget_avatar_urls()
? -
reviewboard/diffviewer/tests/test_commit_utils.py (Diff revision 2) I think this can just be
list(self.commits.values())
. -
-
reviewboard/reviews/builtin_fields.py (Diff revision 2) While here, can we make this a modern dict comprehension?
Commits: |
|
|||||||||
---|---|---|---|---|---|---|---|---|---|---|
Diff: |
Revision 3 (+282 -368) |